Skip to content

fix(evm): seed the genesis account only if genesis block is not committed - #1524

Open
oXtxNt9U wants to merge 3 commits into
developfrom
fix/evm/genesis-account-seeding
Open

oXtxNt9U wants to merge 3 commits into
developfrom
fix/evm/genesis-account-seeding

Conversation

@oXtxNt9U

@oXtxNt9U oXtxNt9U commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Problem

set_genesis_info writes the genesis account to storage whenever it is missing, outside any commit, on every boot and every proposal.

When the genesis leaves that account empty (snapshot genesis, or a premine of 0), the genesis block deletes it. Afterwards only nodes that restarted or proposed have it again, so the next transaction that touches it without adding value (e.g. a 0-value transfer) produces a different state root on nodes without the account. They reject the block with InvalidStateRoot, leaving relays stuck and stalling validators. Anyone can trigger it for the cost of a transfer.

Solution

Only write the genesis account while the genesis block is not yet committed. The genesis info is still loaded into memory every time. Genesis state roots are unchanged.

Tests

  • Rust: the account is not re-created after the genesis commit, including on a new instance, which still loads the genesis info.
  • evm-service: a node that re-initializes the genesis after the genesis commit computes the same state root as one that didn't.

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.66%. Comparing base (c39bb16) to head (c60faee).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1524      +/-   ##
===========================================
+ Coverage    80.31%   80.66%   +0.35%     
===========================================
  Files          952      963      +11     
  Lines        17162    17656     +494     
  Branches      2599     2674      +75     
===========================================
+ Hits         13784    14243     +459     
- Misses        3373     3405      +32     
- Partials         5        8       +3     
Flag Coverage Δ
contracts 91.95% <ø> (?)
packages 80.38% <100.00%> (+0.06%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

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