-
Notifications
You must be signed in to change notification settings - Fork 167
refactor(base_types,types,tests): Create RLP Serialization Classes #1359
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 tasks
spencer-tb
requested changes
Apr 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great refactor from my side! Just a few comments :)
I quite like the class naming btw
Co-authored-by: spencer <[email protected]>
spencer-tb
reviewed
Apr 1, 2025
spencer-tb
approved these changes
Apr 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ;)
Co-authored-by: spencer <[email protected]>
felix314159
pushed a commit
to felix314159/execution-spec-tests
that referenced
this pull request
May 16, 2025
…thereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-authored-by: spencer <[email protected]>
sonhv0212
pushed a commit
to ronin-chain/execution-spec-tests
that referenced
this pull request
May 20, 2025
…thereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-authored-by: spencer <[email protected]>
sonhv0212
pushed a commit
to ronin-chain/execution-spec-tests
that referenced
this pull request
May 20, 2025
…thereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-Authored-By: spencer <[email protected]>
sonhv0212
pushed a commit
to ronin-chain/execution-spec-tests
that referenced
this pull request
May 20, 2025
…thereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-Authored-By: spencer <[email protected]>
sonhv0212
pushed a commit
to ronin-chain/execution-spec-tests
that referenced
this pull request
May 20, 2025
…thereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-Authored-By: spencer <[email protected]>
sonhv0212
added a commit
to ronin-chain/execution-spec-tests
that referenced
this pull request
May 21, 2025
* feat(tests): EIP-2537: add bls12 audit test cases (ethereum#1275) * fix(test): remove test violating EIP-7523 (ethereum#1257) * fix(test): remove test violating EIP-7523 * Simplify the test by removing parameterization * chore(tests): update bls12 test vectors (ethereum#1289) * new(tests): add state test with empty 7702 authorization list (ethereum#1224) * new(tests): add state test with empty 7702 authorization list * fix(clis): Add exception to EELS --------- Co-authored-by: Mario Vega <[email protected]> * new(tests): EIP-7702: Sender not EOA test * Add self-sponsored variant * apply comments * fix(test): improve EIP-7702 test for type 4 transaction with empty to (ethereum#1337) * fix(tests): EIP-7702 verification/merge issue (ethereum#1358) * new(tests): EIP-7702: More RLP tests (ethereum#1347) * refactor(types): remove nonce-as-list from auth list * new(tests): EIP-7702: Tx serialization tests * refactor(tests): Use RLP encoding changes * Change log * new(tests): EIP-7702: more rlp tests * 🧹 chore(EIP-7623): Remove duplicate fixture (ethereum#1381) Co-authored-by: raxhvl <[email protected]> * feat(tests): Additional EIP-2935 coverage (ethereum#1379) Update CHANGELOG.md * new(tests): EIP-7702: Delegation Designation as Initcode, max-fee-per-gas tests (ethereum#1372) * new(tests): EIP-7702: Delegation designation as initcode * new(tests): EIP-7702: Invalid max_fee_per_gas/max_priority_fee_per_gas * docs: changelog * refactor(tests): Combine similar cases into one Co-Authored-By: spencer <[email protected]> --------- Co-authored-by: spencer <[email protected]> * fix(execute,tests): EIP-7702: send tx of eoa after setcode tx is mined (ethereum#1411) * fix(tests): EIP-7702: send transaction of an EOA after setcode tx is mined * refactor(execute): send batch of txs by block * fix(tests): Parametrize instead of change * refactor(execution): Change error check to per-block basis --------- Co-authored-by: Mario Vega <[email protected]> * feat(tests): update 7702 precompile test cases (ethereum#1431) - Add a test case that calls the delegated precompile acct directly from the same transaction as the auth. Supply enough gas only to cover the intrinsic cost of the call, with no extra gas for any precompile code execution. - Update the test case for all call opcodes to use all of the call opcodes. * feat(tests): eip7623 - parametrize `test_transaction_validity_type_*` with a tx to an eoa (ethereum#1422) * feat(tests): EIP-2537: extra BLS12-381 coverage (ethereum#1350) * feat(tests): bls point generator and extra coverage. * chore(tests): remove bls msm duplicates. * chore: fix tox issues. * feat(tests): Add more msm invalid tests --------- Co-authored-by: Mario Vega <[email protected]> * new(tests): EIP-7702 - ensure DELEGATECALLing a 7702 target works (ethereum#1485) Co-authored-by: Mario Vega <[email protected]> * feat(tests): add bls map to curve on identity cases (ethereum#1505) * fix(tests): EIP-7702: use penultimate block number instead of fixing block 0 (ethereum#1390) * fix(tests): EIP-7702: use penultimate block number instead of fixing block 0 * fix(tests): EIP-7702: use contract code to get blocknumber instead of rpc * Update uv.lock * Update uv.lock * Update uv.lock * Update uv.lock * Update pyproject.toml * refactor(base_types,types,tests): Create RLP Serialization Classes (ethereum#1359) * fix(types): tests: Add serialization unit tests * fix(types): tests: Fix unit tests * feat(base_types): Implement serialization RLP types * feat(base_types,types,fixtures): Apply serialization RLP types * fix(types): Auth tuple defaults * fix(fixtures,rpc,specs,types,tests): Transaction.rlp is a function * fix(base_types,types,rpc): fixes * refactor(base_types,types): Network wrapped transaction * fix(tests): Network wrapped transactions * fix(types): Fix NetworkWrappedTransaction rlp prefix * docs: Changelog * Apply suggestions from code review Co-authored-by: spencer <[email protected]> * Add network wrapper explanation * fix: tox * Update docs/CHANGELOG.md Co-authored-by: spencer <[email protected]> * Add comment --------- Co-Authored-By: spencer <[email protected]> * fix(tests): EIP-2537: mark slow * fix(tests): EIP-7623: remove blob in blob tx * fix(dependency): update prague execution specs * new(dependency): add joblib --------- Co-authored-by: spencer <[email protected]> Co-authored-by: Andrei Maiboroda <[email protected]> Co-authored-by: Paweł Bylica <[email protected]> Co-authored-by: Mario Vega <[email protected]> Co-authored-by: Dimitry Kh <[email protected]> Co-authored-by: raxhvl <[email protected]> Co-authored-by: raxhvl <[email protected]> Co-authored-by: Stuart Reed <[email protected]> Co-authored-by: felipe <[email protected]> Co-authored-by: danceratopz <[email protected]> Co-authored-by: pdobacz <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🗒️ Description
Creates
RLPSerializable
andSignableRLPSerializable
that can be inherited by a class to make it RLP serializable.RLPSerializable
When inherited by a class, and the class defines the
rlp_fields
class variable as a list of strings, the methodrlp
will now return an RLP encoded bytes that is composed by the fields named in the orderedrlp_fields
.The method will automatically convert the fields into values accepted by
ethereum_rlp.encode
.If the field contains an object that is also
RLPSerializable
(orSignableRLPSerializable
), it will call a method calledto_list
which returns the object's fields a list that is already converted to values accepted byethereum_rlp.encode
, so the encoding will treat this sub-field as a list of elements instead of an array of bytes.SignableRLPSerializable
Similar to
RLPSerializable
but it can also produce RLP encoded bytes that are meant to be signed with a private key, and also requires implementation of asign
method.E.g.
AuthorizationTuple
contains the following RLP related fields:Which means that the
sign
method will use an RLP encoded bytes composed of only["chain_id", "address", "nonce"]
, whereas the full RLP encoded object is composed of those same fields plus the["v", "r", "s"]
of the signature.Note: we could improve the names of both of these classes, suggestions welcome.
Testing Opportunities
While this PR only refactors and does not introduce many more functionality, it introduces the possibility of automatically generating tests for RLP encodeable objects, since the objects and their composition based on their fields are now better defined.
Test parity
Test fixtures were generated using
uv run fill --from=Cancun --until=Prague -n auto -m "not slow and not eip_version_check"
against main generated functions (plus #1357 and #1358) and the resulting fixtures were identical.🔗 Related Issues
None
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.