Skip to content

Commit

Permalink
Use the state of the database before the benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
xgreenx committed Feb 20, 2025
1 parent 2471df6 commit a2d5410
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
let interpreter_params = InterpreterParams::new(gas_price, &params);
let memory = memory.unwrap_or_else(MemoryInstance::new);

let original_db = db.clone();
let mut txtor = Transactor::new(memory, db, interpreter_params);

txtor.transact(tx);
Expand Down Expand Up @@ -556,6 +557,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
diff += storage_diff;
let diff: diff::Diff<diff::InitialVmState> = diff.into();
vm.reset_vm_state(&diff);
*vm.as_mut() = original_db;
assert_eq!(vm_before_first_instruction, vm);

Ok(Self {
Expand Down

0 comments on commit a2d5410

Please sign in to comment.