Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Sep 20, 2024
1 parent 48d1ca6 commit b8c73a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/core/types/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl RLPDecode for AccountState {
pub fn compute_storage_root(storage: &HashMap<H256, U256>) -> H256 {
let iter = storage.iter().filter_map(|(k, v)| {
(!v.is_zero()).then_some((
Keccak256::new_with_prefix(k).finalize().to_vec(),
Keccak256::digest(k).to_vec(),
v.encode_to_vec(),
))
});
Expand Down
4 changes: 1 addition & 3 deletions crates/core/types/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ impl Genesis {
pub fn compute_state_root(&self) -> H256 {
let iter = self.alloc.iter().map(|(addr, account)| {
(
Keccak256::new_with_prefix(addr.to_fixed_bytes())
.finalize()
.to_vec(),
Keccak256::digest(addr).to_vec(),
AccountState::from(account).encode_to_vec(),
)
});
Expand Down

0 comments on commit b8c73a8

Please sign in to comment.