state: Move Authorization into its own header - #1613
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the EIP-7702 set-code transaction authorization tuple into a dedicated authorization.hpp header, updates field ordering to match the EIP tuple definition, and tightens y_parity handling to reflect its 1-byte wire-format constraint.
Changes:
- Moved
state::Authorization/AuthorizationListout oftransaction.hppinto a newtest/state/authorization.hpp. - Reordered authorization fields to
chain_id, address, nonce, y_parity, r, s(withsignerlast) and updated serialization/encoding code accordingly. - Changed
y_paritystorage touint8_tand updated the state-test loader to reject values that don’t fit in a byte.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/utils/statetest_loader.cpp | Parses v into y_parity with explicit 1-byte bounds checking for malformed tests. |
| test/utils/statetest_export.cpp | Updates structured binding order and ensures y_parity is exported numerically (avoids uint8_t formatting pitfalls). |
| test/utils/rlp_encode.cpp | Encodes y_parity as an integer for RLP tuple encoding. |
| test/unittests/state_transition_eip7702_test.cpp | Updates unit test to use .y_parity instead of .v. |
| test/state/transaction.hpp | Includes new authorization.hpp and removes the embedded Authorization definition. |
| test/state/state.cpp | Switches validation logic from auth.v to auth.y_parity. |
| test/state/CMakeLists.txt | Adds authorization.hpp to the evmone-state target sources. |
| test/state/authorization.hpp | New header introducing the extracted Authorization tuple with reordered fields and uint8_t y_parity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1613 +/- ##
=======================================
Coverage 97.38% 97.38%
=======================================
Files 164 164
Lines 14789 14789
Branches 3411 3411
=======================================
Hits 14403 14403
Misses 281 281
Partials 105 105
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The EIP-7702 authorization tuple has its own signing hash and signature recovery, which do not belong in transaction.hpp. Give it a home first. Order the fields as the tuple is specified: chain_id, address, nonce, y_parity, r, s; and put signer, which is not part of it, at the end. y_parity becomes uint8_t: EIP-7702 bounds it to one byte, and a value above 1 invalidates the tuple, not the transaction, so the field must still be able to hold it. The state test loader now rejects a wider one.
chfast
force-pushed
the
state/authorization-move
branch
from
July 26, 2026 13:23
35a11e8 to
a623423
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The EIP-7702 authorization tuple has its own signing hash and signature recovery, which do not belong in transaction.hpp. Give it a home first.
Order the fields as the tuple is specified: chain_id, address, nonce, y_parity, r, s. Put signer, which is not part of it, at the end.
y_parity becomes uint8_t: EIP-7702 bounds it to one byte, and a value above 1 invalidates the tuple, not the transaction, so the field must still be able to hold it. The state test loader now rejects a wider one.