Skip to content

state: Recover the EIP-7702 authorization authority from the signature - #1611

Merged
chfast merged 1 commit into
masterfrom
state/authority-recovery
Jul 26, 2026
Merged

state: Recover the EIP-7702 authorization authority from the signature#1611
chfast merged 1 commit into
masterfrom
state/authority-recovery

Conversation

@chfast

@chfast chfast commented Jul 26, 2026

Copy link
Copy Markdown
Member

process_authorization_list took the authority from the non-standard
"signer" JSON field and only checked the signature's shape: y_parity in
{0, 1} and s <= secp256k1n/2. The signature itself was never verified, so
a t8n input could name any address as the signer of a garbage signature
and get a delegation designator installed on it, diverging from geth's
state root.

Recover the authority with strict (non-malleable) ecrecover instead. This
folds the three shape checks into one call and lets the signer field go;
every fixture already carries r, s and v.

The unit tests can no longer name an authority, so they carry signed
tuples as literals.

Closes #1483.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.40%. Comparing base (3368397) to head (6cee007).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1611      +/-   ##
==========================================
+ Coverage   97.38%   97.40%   +0.01%     
==========================================
  Files         164      166       +2     
  Lines       14789    14810      +21     
  Branches     3411     3412       +1     
==========================================
+ Hits        14403    14425      +22     
  Misses        281      281              
+ Partials      105      104       -1     
Flag Coverage Δ
eest-develop 89.41% <100.00%> (+0.04%) ⬆️
eest-develop-gmp 25.98% <23.21%> (+<0.01%) ⬆️
eest-legacy 17.40% <0.00%> (-0.03%) ⬇️
eest-libsecp256k1 28.19% <23.21%> (+0.60%) ⬆️
eest-stable 89.37% <100.00%> (+0.04%) ⬆️
evmone-unittests 92.75% <98.21%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 95.90% <100.00%> (+<0.01%) ⬆️
tooling 90.36% <100.00%> (+0.03%) ⬆️
tests 99.80% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
test/state/authorization.cpp 100.00% <100.00%> (ø)
test/state/state.cpp 99.69% <100.00%> (-0.01%) ⬇️
test/unittests/evmmax_secp256k1_test.cpp 100.00% <ø> (ø)
test/unittests/state_authorization_test.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition_eip7702_test.cpp 100.00% <100.00%> (ø)
test/utils/statetest_export.cpp 72.80% <100.00%> (+0.35%) ⬆️
test/utils/statetest_loader.cpp 92.88% <ø> (-0.05%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast
chfast force-pushed the state/authority-recovery branch 2 times, most recently from 0316b22 to a64ed66 Compare July 26, 2026 14:24
@chfast
chfast requested a review from Copilot July 26, 2026 14:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the state-test harness’ EIP-7702 set-code authorization handling to recover the authority address from the secp256k1 signature (strict / non-malleable mode), removing reliance on the artificial JSON "signer" field and tightening edge-case validation to match consensus rules.

Changes:

  • Remove JSON "signer" import/export for authorization tuples and stop storing Authorization::signer.
  • Add state::recover_authority() with EIP-7702 signing-hash computation and strict secp256k1 recovery; wire it into authorization list processing.
  • Expand unit/state-transition coverage for invalid y_parity, unrecoverable signatures, and additional secp256k1 recovery edge cases.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/utils/statetest_loader.cpp Stops reading the optional JSON "signer" field when loading authorization tuples.
test/utils/statetest_export.cpp Stops emitting "signer" and serializes authorization tuples directly from struct fields.
test/unittests/state_transition.hpp Adds a second fixture signing identity (Authority) for EIP-7702-related tests.
test/unittests/state_transition_eip7702_test.cpp Reworks tests to use literal signed authorizations (no "signer"), adds invalid/unrecoverable signature coverage.
test/unittests/state_authorization_test.cpp Adds direct unit tests for state::recover_authority() and y_parity rejection.
test/unittests/evmmax_secp256k1_test.cpp Adds a recovery test case where r is in-range but not a valid curve x-coordinate.
test/unittests/CMakeLists.txt Registers the new state_authorization_test.cpp unit test.
test/state/state.cpp Replaces prior partial validation + "signer" usage with strict signature recovery via recover_authority().
test/state/CMakeLists.txt Adds the new authorization.cpp implementation file to the test-state target.
test/state/authorization.hpp Removes signer field, documents strict recovery semantics, declares recover_authority().
test/state/authorization.cpp Implements EIP-7702 signing-hash + strict secp256k1 authority recovery.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chfast
chfast force-pushed the state/authority-recovery branch 2 times, most recently from 26049ef to eacee86 Compare July 26, 2026 15:25
@chfast
chfast requested a review from Copilot July 26, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread test/state/state.cpp
Comment thread test/unittests/state_transition.hpp
process_authorization_list took the authority from the non-standard
"signer" JSON field and only checked the signature's shape: y_parity in
{0, 1} and s <= secp256k1n/2. The signature itself was never verified, so
a t8n input could name any address as the signer of a garbage signature
and get a delegation designator installed on it, diverging from geth's
state root.

Recover the authority with strict (non-malleable) ecrecover instead. This
folds the three shape checks into one call and lets the signer field go;
every fixture already carries r, s and v.

The unit tests can no longer name an authority, so they carry signed
tuples as literals.

Closes #1483.
@chfast
chfast force-pushed the state/authority-recovery branch from eacee86 to 6cee007 Compare July 26, 2026 15:47
@chfast chfast changed the title state: Add full support for 7702 authorization signer recovery state: Recover the EIP-7702 authorization authority from the signature Jul 26, 2026
@chfast
chfast requested a review from Copilot July 26, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread test/unittests/state_transition_eip7702_test.cpp
Comment thread test/state/authorization.cpp
@chfast
chfast merged commit 0b7069a into master Jul 26, 2026
24 checks passed
@chfast
chfast deleted the state/authority-recovery branch July 26, 2026 16:36
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.

t8n: forged authorizationList signer is trusted over EIP-7702 signature recovery

2 participants