Skip to content

fix(execution): support empty account before and after SPURIOUS_DRAGON fork#91

Merged
AshinGau merged 1 commit intoGalxe:mainfrom
AshinGau:empty_account
Nov 4, 2025
Merged

fix(execution): support empty account before and after SPURIOUS_DRAGON fork#91
AshinGau merged 1 commit intoGalxe:mainfrom
AshinGau:empty_account

Conversation

@AshinGau
Copy link
Collaborator

@AshinGau AshinGau commented Nov 4, 2025

Fix Empty Account Handling and Precompile Configuration

Summary

This PR fixes two critical issues:

  1. Incorrect handling of empty accounts before and after the SPURIOUS_DRAGON hardfork, which caused incorrect gas fee calculations and state inconsistencies
  2. Missing precompile configuration in EVM initialization, which led to incorrect account states

Background

Empty Accounts Before SPURIOUS_DRAGON

Before the SPURIOUS_DRAGON upgrade, empty accounts were persisted in the database. This vulnerability was exploited to create numerous "dust accounts" (empty accounts), which bloated Ethereum's state tree and increased the burden on node synchronization and operation.

In the pre-SPURIOUS_DRAGON era, calling an address would create an empty account at that address. Subsequent accesses to this account would charge reduced gas fees. A typical example is block 1124576 (view on Etherscan), where both tx1 and tx3 called the empty account 0x0ae06d5934fd75d214951eb96633fbd7f9262a7c. In this case, tx3's call should charge reduced gas fees.

The Bug in grevm

In grevm's implementation, empty accounts and non-existent accounts were treated as equal, which caused:

  • The account update to be missing from tx1's write set
  • tx3 to incorrectly read from storage instead of using the cached empty account state
  • tx3 to be overcharged for gas fees
  • Incorrect final execution results

Empty Accounts After SPURIOUS_DRAGON

After the SPURIOUS_DRAGON upgrade, calling an empty account triggers account cleanup, as specified in EIP-161. A typical example is block 2675119 (view on Etherscan), where tx2 calls a contract that loops through addresses from 0x0 to 0x2bb, triggering cleanup of empty accounts in this range.

Precompile Configuration Issue

The previously created EVM instance did not pass the correct precompile contracts configuration, leading to incorrect account states.

Changes

  • Fixed empty account handling to properly distinguish between empty accounts and non-existent accounts before SPURIOUS_DRAGON
  • Corrected gas fee calculation for empty account accesses in pre-SPURIOUS_DRAGON blocks
  • Added proper precompile configuration in EVM initialization (see scheduler.rs:469)
  • Ensured EIP-161 state clearing behavior is correctly implemented for post-SPURIOUS_DRAGON blocks

@AshinGau AshinGau merged commit cc11862 into Galxe:main Nov 4, 2025
1 of 2 checks passed
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