Refine address mapping for delegations and rebinds#3499
Conversation
Simplify the address-mapping and code-storage helpers in x/evm/keeper and the parallel giga/deps/xevm/keeper package. Comments document the non-obvious invariants (the three-way GetCodeHash semantics, the bidirectional index contract, the cast-address receive rule), magic constants are named, and a few stale branches in SetCode and SetAddressMapping are simplified along the way. Expand the keeper test suites on both sides to cover behaviours that were previously implicit: SetCode with delegation-shaped input, SetAddressMapping when either side is rebound to a new partner, and GetCodeHash for accounts with a nonce but no balance. The two keeper packages share underlying storage via GigaEvmKeeper.UseRegularStore=true, so coverage is mirrored to keep them from drifting. Mirror both fixes into giga/deps/xevm/keeper.
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3499 +/- ##
==========================================
- Coverage 59.04% 59.01% -0.03%
==========================================
Files 2199 2187 -12
Lines 182096 181206 -890
==========================================
- Hits 107513 106939 -574
+ Misses 64933 64652 -281
+ Partials 9650 9615 -35
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf2deda99b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, alreadyMapped := k.GetSeiAddress(ctx, addr); !alreadyMapped { | ||
| k.SetAddressMapping(ctx, k.GetSeiAddressOrDefault(ctx, addr), addr) |
There was a problem hiding this comment.
Avoid recreating cast mappings when clearing 7702 code
When an EIP-7702 authorization delegates to the zero address, the go-ethereum state transition clears the authority by calling SetCode(authority, nil). For an authority that has no explicit Sei mapping, this falls through the delegation check and auto-creates a direct-cast mapping, reintroducing the same empty-code cast mapping that the new migration removes. This makes GetSeiAddress/associated-address queries report the cleared authority as explicitly associated to its cast address until a later cleanup; empty code should skip or remove the cast mapping just like delegation code.
Useful? React with 👍 / 👎.
Simplify the address-mapping and code-storage helpers in x/evm/keeper and the parallel giga/deps/xevm/keeper package. Comments document the non-obvious invariants (the three-way GetCodeHash semantics, the bidirectional index contract, the cast-address receive rule), magic constants are named, and a few stale branches in SetCode and SetAddressMapping are simplified along the way.
Expand the keeper test suites on both sides to cover behaviours that were previously implicit: SetCode with delegation-shaped input, SetAddressMapping when either side is rebound to a new partner, and GetCodeHash for accounts with a nonce but no balance. The two keeper packages share underlying storage via GigaEvmKeeper.UseRegularStore=true, so coverage is mirrored to keep them from drifting.
Mirror both fixes into giga/deps/xevm/keeper.