Skip to content

fix(ante): address association parity across EVM ante paths#3793

Open
codchen wants to merge 1 commit into
mainfrom
claude/evm-ante-address-association-fb60c4
Open

fix(ante): address association parity across EVM ante paths#3793
codchen wants to merge 1 commit into
mainfrom
claude/evm-ante-address-association-fb60c4

Conversation

@codchen

@codchen codchen commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #3716, aligning EVM address-association handling between the two ante paths:

  • The EVMPreprocessDecorator path already pre-associates EIP-7702 SetCode authorization authorities (not just the tx sender) before execution.
  • The legacyabci path (EvmDeliverTxAnte / EvmCheckTxAnte) previously associated only the sender.

This adds ante.AssociateAuthorizationAuthorities, invoked from EvmDeliverTxAnte (after sender association, before fee-charging / execution) and mirrored in EvmCheckTxAnte. It reuses the existing helpers.AuthorityToPreAssociate validation, so both paths associate an identical set of addresses.

Notes

  • State-machine-breaking: the two ante paths must behave identically, so this should be released together with Fix address distro bug #3716 in the same coordinated upgrade.
  • EvmCheckTxAnte runs on a throwaway cache and does not apply authorizations — its call is purely for mempool-state consistency with the deliver path.

Testing

  • GOWORK=off go test ./app/ -run 'TestAssociateAuthorizationAuthorities|TestSetCodeTxRequiresAuthorityAssociation' — pass
  • GOWORK=off go test -race ./app/ante/... — pass
  • Added TestAssociateAuthorizationAuthorities (matching-chain authority associated; foreign-chain authority skipped).

🤖 Generated with Claude Code

Follow-up to #3716. The authorization-authority address association added
there landed in the EVMPreprocessDecorator ante path but not in the
legacyabci ante path (EvmDeliverTxAnte / EvmCheckTxAnte), which associated
only the tx sender. Add ante.AssociateAuthorizationAuthorities and invoke it
from the deliver-tx path (mirrored in check-tx for mempool consistency) so
both paths associate the same addresses before EVM execution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 23, 2026, 3:54 AM

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.24%. Comparing base (96fa55d) to head (e932f96).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/ante/evm_checktx.go 92.30% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3793      +/-   ##
==========================================
- Coverage   60.20%   59.24%   -0.97%     
==========================================
  Files        2328     2236      -92     
  Lines      194502   184016   -10486     
==========================================
- Hits       117104   109024    -8080     
+ Misses      66849    65296    -1553     
+ Partials    10549     9696     -853     
Flag Coverage Δ
sei-chain-pr 49.34% <92.85%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

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

Files with missing lines Coverage Δ
app/ante/evm_delivertx.go 68.25% <100.00%> (+0.51%) ⬆️
app/ante/evm_checktx.go 43.56% <92.30%> (+3.35%) ⬆️

... and 92 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codchen
codchen marked this pull request as ready for review July 23, 2026 11:43
@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR Summary

High Risk
State-machine and association semantics change for EIP-7702 txs on the legacy ante path; intended to ship coordinated with #3716 to avoid divergent behavior and chain-halt class bugs.

Overview
Aligns legacyabci EVM ante (EvmDeliverTxAnte / EvmCheckTxAnte) with the EVMPreprocessDecorator path by pre-associating EIP-7702 SetCode authorization authorities (not just the tx sender) before fee charging and execution.

Adds AssociateAuthorizationAuthorities, which walks SetCode authorizations, uses helpers.AuthorityToPreAssociate (same chain/nonce/code rules as geth), and best-effort associates each applicable authority to its pubkey-derived Sei address in isolated cache contexts—failures never reject the tx. Deliver runs this before execution so delegation cannot leave a remappable direct-cast mapping that could orphan staking/distribution state; CheckTx calls the same helper only for mempool consistency on a throwaway cache.

Adds TestAssociateAuthorizationAuthorities for on-chain matching vs foreign-chain authorizations.

Reviewed by Cursor Bugbot for commit e932f96. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e932f96. Configure here.

Comment thread app/ante/evm_checktx.go
write()
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicated authority association logic

Low Severity

AssociateAuthorizationAuthorities reimplements the same AuthorityToPreAssociate + cache-context association loop already in EVMPreprocessDecorator.associateAuthorizationAuthorities. app/ante already reuses other x/evm/ante helpers, and this path is state-machine-critical, so a second copy raises divergence risk if one side is fixed later.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e932f96. Configure here.

@seidroid seidroid Bot 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.

The PR adds ante.AssociateAuthorizationAuthorities to the legacyabci ante paths (EvmDeliverTxAnte/EvmCheckTxAnte), bringing EIP-7702 authorization-authority pre-association to parity with the existing EVMPreprocessDecorator. The change is a faithful, well-documented mirror of the existing logic, reuses the same validated helper, and is covered by a new test; no blocking issues found.

Findings: 0 blocking | 3 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • Cursor's second-opinion review file (cursor-review.md) was empty — that pass produced no output. Codex reported no material issues.
  • Consider a follow-up refactor to share a single implementation of the authority pre-association loop between app/ante and x/evm/ante (the two now-duplicated bodies must stay in lockstep since the PR's own note stresses the paths must behave identically); the shared helpers.AuthorityToPreAssociate already covers the validation, but the cache-context/write loop is duplicated.
  • The added test exercises AssociateAuthorizationAuthorities directly but not via the full EvmDeliverTxAnte/EvmCheckTxAnte entry points; an end-to-end assertion that CheckTx's association is not committed (matching the mempool-only intent) would strengthen coverage.

@claude claude Bot 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.

No bugs found in my review, but given this is app-hash-breaking, consensus-critical ante-handler code that must ship in lockstep with #3716, I'd like a human to confirm the coordinated-release plan before merge.

Extended reasoning...

Overview

The PR adds ante.AssociateAuthorizationAuthorities and calls it from both EvmDeliverTxAnte and EvmCheckTxAnte in app/ante/, so the legacyabci ante path pre-associates EIP-7702 SetCode authorization authorities the same way x/evm/ante.EVMPreprocessDecorator already does. I compared the new function line-by-line against EVMPreprocessDecorator.associateAuthorizationAuthorities (x/evm/ante/preprocess.go) and it is a faithful mirror: same use of helpers.AuthorityToPreAssociate for the chain-id/nonce/code checks, same per-authority cache-context isolation so a single failing authority can't affect others or reject the tx, and the same call ordering relative to sender association. helpers.AuthorityToPreAssociate itself already guards against replay of a foreign-chain authorization and against re-mapping an already-associated authority.

Security risks

This is squarely address-association / consensus-state code: a bug here can misassign an EVM<->Sei address mapping, which the PR's own commit message notes can eventually orphan staking/distribution state and halt the chain. I didn't find a defect in this diff, but the blast radius of a mistake in this area is a chain halt, not a contained bug.

Level of scrutiny

The PR is labeled app-hash-breaking and the description explicitly states it must be released in the same coordinated upgrade as #3716 because the two ante paths need to behave identically. That coordination requirement is an operational/release-process concern that isn't something I can verify from the diff alone (e.g., whether #3716 is scheduled for the same upgrade, whether both PRs land before the same tag is cut). Combined with the app-hash-breaking label, this warrants a human sign-off even though the code change itself looks correct and well-tested.

Other factors

Test coverage is solid: TestAssociateAuthorizationAuthorities exercises both the matching-chain-association and foreign-chain-skip cases, mirroring the existing x/evm/ante tests for the same behavior. The bug-hunting pass found nothing, and my own read didn't surface a logic issue in the new code or its integration points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant