Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Add typed transactions - EIP 2718 - Berlin - #1978

Merged
carver merged 1 commit into
ethereum:masterfrom
carver:eip-2718-typed-txns
Feb 26, 2021
Merged

Add typed transactions - EIP 2718 - Berlin#1978
carver merged 1 commit into
ethereum:masterfrom
carver:eip-2718-typed-txns

Conversation

@carver

@carver carver commented Feb 25, 2021

Copy link
Copy Markdown
Contributor

What was wrong?

Fixes #1973

How was it fixed?

Uses the basic structure from ApeWorX/pyrlp#131 to enable dynamic encodings. It kicks the can down the road a bit to #1975 for actually supported any specific typed transactions, since they aren't defined until then.

Had to split the transaction responsibility up a bit: isolated a transaction builder/serializer from the actual transaction API. It causes some code churn, but not quite as much as I feared.

To-Do

Cute Animal Picture

put a cute animal picture link inside the parentheses

@carver
carver force-pushed the eip-2718-typed-txns branch from 7935801 to 54a828c Compare February 25, 2021 17:38
@carver
carver marked this pull request as ready for review February 25, 2021 17:41
@carver

carver commented Feb 25, 2021

Copy link
Copy Markdown
Contributor Author

Ok, I think this has the basic shape that we want. I won't ask for a final merge review yet, but it's far enough along if anyone wants to give architectural feedback, or just follow what's happening. cc @kclowes @marcgarreau

carver added a commit to carver/py-evm that referenced this pull request Feb 25, 2021
@carver
carver requested review from kclowes and wolovim February 25, 2021 22:45
@carver

carver commented Feb 25, 2021

Copy link
Copy Markdown
Contributor Author

Ok, now ready for a proper review. Are you folks up for a call tomorrow morning to look over it together? I know you're new to the repo, so hopefully we'll catch anything funky as I try to explain out loud what's going on. :)

@wolovim

wolovim commented Feb 25, 2021

Copy link
Copy Markdown
Contributor

@carver will give it a look now, but would love to talk through it in the morning - thanks :)

@kclowes

kclowes commented Feb 26, 2021

Copy link
Copy Markdown
Contributor

@carver yep, tomorrow morning would be great!

rlp.decode(encoded, sedes=sedes)
else:
# Check that the given transaction encodes to the start encoding
expected_txn = BerlinLegacyTransaction(**expected)

@carver carver Feb 26, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new_transaction() API.

Suggested change
expected_txn = BerlinLegacyTransaction(**expected)
expected_txn = sedes.new_transaction(**expected)

)


@pytest.mark.parametrize(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@pytest.mark.parametrize(
@pytest.mark.parametrize('vm_class', [BerlinVM])
@pytest.mark.parametrize(

Comment thread eth/vm/forks/berlin/transactions.py Outdated

# TODO: subclass rlp.sedes.dynamic.DynamicSerializable, when it's released
# See the example in pyrlp:tests/core/test_dynamic_entries.py
class BerlinTransaction(TransactionBuilderAPI):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BerlinTransaction(TransactionBuilderAPI):
class BerlinTransactionBuilder(TransactionBuilderAPI):

+ INVALID_TRANSACTION_TYPES
)
def test_transaction_decode(encoded, expected):
sedes = BerlinVM.get_transaction_class()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor:

Suggested change
sedes = BerlinVM.get_transaction_class()
sedes = BerlinVM.get_transaction_builder()

@carver

carver commented Feb 26, 2021

Copy link
Copy Markdown
Contributor Author

Handled all the notes taken during review.

- Refactor to split the responsibility for encode/decode and core
transaction API
- Test that legacy transactions still work in Berlin
- Test invalid vs unrecognized transaction types

Invalid types are disallowed by EIP-2718, unrecognized ones are just not
specified yet. (Although one will be soon, in EIP-2930)
@carver
carver force-pushed the eip-2718-typed-txns branch from 9f7cb72 to 8ac8e95 Compare February 26, 2021 20:25
@carver
carver merged commit 7ac5ef2 into ethereum:master Feb 26, 2021
@carver
carver deleted the eip-2718-typed-txns branch February 26, 2021 20:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typed Transaction Envelope: EIP-2718 for Berlin

3 participants