Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement state root calculation for ChainState #325

Open
hai-rise opened this issue Sep 4, 2024 · 0 comments
Open

Implement state root calculation for ChainState #325

hai-rise opened this issue Sep 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@hai-rise
Copy link
Contributor

hai-rise commented Sep 4, 2024

pevm/tests/ethereum/main.rs

Lines 214 to 228 in 24266be

// TODO: Implement our own state root calculation function to remove
// this conversion to [PlainAccount]
let plain_chain_state = chain_state.into_iter().map(|(address, account)| {
(address, PlainAccount {
info: AccountInfo {
balance: account.balance,
nonce: account.nonce,
code_hash: account.code_hash.unwrap_or(KECCAK_EMPTY),
code: account.code.map(Bytecode::from),
},
storage: account.storage.into_iter().collect(),
})}).collect::<Vec<_>>();
let state_root =
state_merkle_trie_root(plain_chain_state.iter().map(|(address, account)| (*address, account)));
assert_eq!(state_root, test.hash, "Mismatched state root for {path:?}");

Low priority.

@hai-rise hai-rise added the enhancement New feature or request label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant