Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typed transactions - EIP 2718 - Berlin #1978

Merged
merged 1 commit into from Feb 26, 2021

Conversation

carver
Copy link
Contributor

@carver carver commented Feb 25, 2021

What was wrong?

Fixes #1973

How was it fixed?

Uses the basic structure from ethereum/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 marked this pull request as ready for review February 25, 2021 17:41
@carver
Copy link
Contributor Author

carver commented Feb 25, 2021

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
Copy link
Contributor Author

carver commented Feb 25, 2021

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
Copy link
Member

wolovim commented Feb 25, 2021

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

@kclowes
Copy link
Collaborator

kclowes commented Feb 26, 2021

@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)
Copy link
Contributor Author

@carver carver Feb 26, 2021

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
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(


# 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
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
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
Copy link
Contributor Author

carver commented Feb 26, 2021

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 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 join this conversation on GitHub. Already have an account? Sign in to comment
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