Skip to content

Commit

Permalink
fix(exec:zk): propagate fork env for transact
Browse files Browse the repository at this point in the history
  • Loading branch information
Karrq committed Jul 12, 2024
1 parent 8295746 commit 7c5ac73
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions crates/evm/evm/src/executors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,17 @@ impl Executor {
let mut db = FuzzBackendWrapper::new(&self.backend);

let result = match &self.zk_tx {
Some(zk_tx) => db.inspect_ref_zk(
&mut env,
&mut self.zk_persisted_factory_deps.clone(),
Some(zk_tx.factory_deps.clone()),
)?,
Some(zk_tx) => {
//apply fork-related env instead of cheatcode handler
// since it won't be run inside zkvm
env.block = self.env.block.clone();
env.tx.gas_price = self.env.tx.gas_price;
db.inspect_ref_zk(
&mut env,
&mut self.zk_persisted_factory_deps.clone(),
Some(zk_tx.factory_deps.clone()),
)?
}
None => db.inspect_ref(&mut env, &mut inspector)?,
};

Expand All @@ -360,11 +366,17 @@ impl Executor {
let mut inspector = self.inspector.clone();

let result = match &self.zk_tx {
Some(zk_tx) => self.backend.inspect_ref_zk(
&mut env,
&mut self.zk_persisted_factory_deps.clone(),
Some(zk_tx.factory_deps.clone()),
)?,
Some(zk_tx) => {
//apply fork-related env instead of cheatcode handler
// since it won't be run inside zkvm
env.block = self.env.block.clone();
env.tx.gas_price = self.env.tx.gas_price;
self.backend.inspect_ref_zk(
&mut env,
&mut self.zk_persisted_factory_deps.clone(),
Some(zk_tx.factory_deps.clone()),
)?
}
None => self.backend.inspect_ref(&mut env, &mut inspector)?,
};

Expand Down

0 comments on commit 7c5ac73

Please sign in to comment.