feat(tests): add type-0 transaction RLP validity tests#3156
Conversation
Port the core malformation classes of the legacy TransactionTests suites (ttWrongRLP, ttNonce, ttValue, ttRSValue, ttVValue, ttAddress), which were never converted because the ported-static pipeline only handles state-test fillers and the raw malformed bytes cannot round-trip through a structured transaction model. A local RLP encoder builds each corruption deliberately, since a correct encoder cannot emit non-canonical forms: per-field leading zeros, 33-byte field overflows, 19 and 21 byte addresses, fields encoded as lists, structural corruptions of the outer list (truncation, trailing bytes, wrong element counts, header size mismatches, size with leading zeros), and well-encoded but invalid signature values. A valid re-encoded control case anchors the encoder to the framework's byte-exact output. The transaction_test fixture format records the declared exception without consulting the transition tool, so all 30 cases were verified externally by feeding the generated fixture bytes through EELS decode_transaction, recover_sender and validate_transaction at Frontier, London and Cancun: every invalid vector is rejected and the control is accepted with the matching sender. Notably the gas limit and gas price are unbounded scalars in the spec, so their oversized encodings are valid at the transaction level; the overflow cases cover the 256-bit bounded fields (nonce, value, r, s) only.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #3156 +/- ##
================================================
Coverage 93.30% 93.31%
================================================
Files 624 624
Lines 36991 36994 +3
Branches 3384 3384
================================================
+ Hits 34515 34521 +6
+ Misses 1694 1693 -1
+ Partials 782 780 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
danceratopz
left a comment
There was a problem hiding this comment.
Thanks @chfast! I think we have a bit of work to do regarding awareness of and ease of consuming the transaction_test format. Could you test these against evmone? If so, mind sharing how?
The other way to run transaction_test is via hive execute. I think we have a bit of work to do if that's the goal. No need to dive into this now, I'm not sure that should be the goal for these (invalid) tests, that should get rejected at the JSON RPC layer.
danceratopz
left a comment
There was a problem hiding this comment.
Added some suggestions here chfast#2. Thanks!
|
This is discussion starter for transaction decoding testing. I don't consume the transaction tests in evmone, but I plan to do so soon as I'm adding full transaction decoding capability. But this seems to be working with The alternative to specific |
Description
Port the core malformation classes of the legacy TransactionTests suites (ttWrongRLP, ttNonce, ttValue, ttRSValue, ttVValue, ttAddress), which were never converted because the ported-static pipeline only handles state-test fillers and the raw malformed bytes cannot round-trip through a structured transaction model.
A local RLP encoder builds each corruption deliberately, since a correct encoder cannot emit non-canonical forms: per-field leading zeros, 33-byte field overflows, 19 and 21 byte addresses, fields encoded as lists, structural corruptions of the outer list (truncation, trailing bytes, wrong element counts, header size mismatches, size with leading zeros), and well-encoded but invalid signature values. A valid re-encoded control case anchors the encoder to the framework's byte-exact output.
The transaction_test fixture format records the declared exception without consulting the transition tool, so all 30 cases were verified externally by feeding the generated fixture bytes through EELS decode_transaction, recover_sender and validate_transaction at Frontier, London and Cancun: every invalid vector is rejected and the control is accepted with the matching sender. Notably the gas limit and gas price are unbounded scalars in the spec, so their oversized encodings are valid at the transaction level; the overflow cases cover the 256-bit bounded fields (nonce, value, r, s) only.
Related Issues or PRs
N/A.
Checklist
just static<type>(<area>): <title>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.