Skip to content

Commit 7dbea81

Browse files
authored
fix(sim): use previous block number for creating alloy db in simulator (#119)
# fix(sim): use previous block number for creating alloy db in simulator PR #116 introduced a logic change that reused the block number from the `block_env` to fetch the state for the alloy DB instance, which results in querying for state of a block number that doesn't exist. This commit reduces that number by 1 to correctly create the AlloyDB state from the previous block instead of the in-progress block.
1 parent b30b12a commit 7dbea81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tasks/block/sim.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ impl Simulator {
102102
debug!(block_number = block_env.number, tx_count = sim_items.len(), "starting block build",);
103103
let concurrency_limit = self.config.concurrency_limit();
104104

105-
let db = self.create_db(block_env.number).unwrap();
105+
// NB: Build AlloyDB from the previous block number's state, since block_env maps to the in-progress block
106+
let db = self.create_db(block_env.number - 1).unwrap();
106107

107108
let block_build: BlockBuild<_, NoOpInspector> = BlockBuild::new(
108109
db,

0 commit comments

Comments
 (0)