Skip to content

Refine address mapping for delegations and rebinds#3499

Draft
masih wants to merge 8 commits into
mainfrom
masih/clean-up-decoding
Draft

Refine address mapping for delegations and rebinds#3499
masih wants to merge 8 commits into
mainfrom
masih/clean-up-decoding

Conversation

@masih
Copy link
Copy Markdown
Collaborator

@masih masih commented May 22, 2026

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.

masih added 2 commits May 22, 2026 16:20
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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 27, 2026, 1:17 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.01%. Comparing base (3936ac9) to head (cf2deda).

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
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 Δ
giga/deps/xevm/keeper/address.go 84.21% <ø> (-2.68%) ⬇️
giga/deps/xevm/keeper/code.go 82.35% <ø> (+1.79%) ⬆️
giga/deps/xevm/state/code.go 84.21% <ø> (-2.75%) ⬇️
giga/deps/xevm/state/journal.go 89.90% <ø> (ø)
x/evm/keeper/address.go 97.36% <ø> (+0.64%) ⬆️
x/evm/keeper/code.go 100.00% <ø> (+5.55%) ⬆️
x/evm/module.go 26.27% <ø> (-0.54%) ⬇️

... and 110 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.

@masih
Copy link
Copy Markdown
Collaborator Author

masih commented May 29, 2026

@codex review this

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread x/evm/keeper/code.go
Comment on lines +65 to 66
if _, alreadyMapped := k.GetSeiAddress(ctx, addr); !alreadyMapped {
k.SetAddressMapping(ctx, k.GetSeiAddressOrDefault(ctx, addr), addr)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant