-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Summary
The MinimalEvm uses separate HashMaps for balances, nonces, and code. Consider consolidating into a unified AccountState structure for better cache locality and simpler logic.
Location
mini/src/evm.zig:80-84
Current Code
balances: std.AutoHashMap(primitives.Address, u256),
nonces: std.AutoHashMap(primitives.Address, u64),
code: std.AutoHashMap(primitives.Address, []const u8),
code_hashes: std.AutoHashMap(primitives.Address, [32]u8),Suggestion
const AccountState = struct {
balance: u256,
nonce: u64,
code: []const u8,
code_hash: [32]u8,
};
accounts: std.AutoHashMap(primitives.Address, AccountState),Benefits
- Single lookup for all account data
- Better cache locality
- Simpler account existence checks
- Matches Ethereum state trie structure
Tradeoffs
- Slightly more memory for accounts with only balance
- Need to handle partial updates carefully
Note: This issue was created by Claude AI assistant during code review, not @roninjin10 or @fucory
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels