Skip to content

Commit

Permalink
fix(trie): take earliest value in HashedStorage::from_reverts (#10475)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk authored Aug 23, 2024
1 parent accd051 commit 3e3f332
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/trie/db/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::hash_map;

use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory};
use reth_db::{cursor::DbCursorRO, models::BlockNumberAddress, tables, DatabaseError};
use reth_db_api::transaction::DbTx;
Expand Down Expand Up @@ -84,7 +86,9 @@ impl<TX: DbTx> DatabaseHashedStorage<TX> for HashedStorage {
let (BlockNumberAddress((_, storage_address)), storage_change) = entry?;
if storage_address == address {
let hashed_slot = keccak256(storage_change.key);
storage.storage.insert(hashed_slot, storage_change.value);
if let hash_map::Entry::Vacant(entry) = storage.storage.entry(hashed_slot) {
entry.insert(storage_change.value);
}
}
}
Ok(storage)
Expand Down

0 comments on commit 3e3f332

Please sign in to comment.