Skip to content

Commit

Permalink
fix(zkvm:create): fetch all factory deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Karrq committed Apr 11, 2024
1 parent 75f82b8 commit 36f32f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/cheatcodes/src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ impl<DB: DatabaseExt + Send> Inspector<DB> for Cheatcodes {
if let Ok(result) = foundry_zksync_core::vm::create::<_, DatabaseError>(
call,
zk_contract,
&self.dual_compiled_contracts,
data.env,
data.db,
&mut data.journaled_state,
Expand Down
6 changes: 4 additions & 2 deletions crates/zksync/core/src/vm/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use foundry_common::{
console::HARDHAT_CONSOLE_ADDRESS, fmt::ConsoleFmt, patch_hh_console_selector, Console,
HardhatConsole,
};
use foundry_zksync_compiler::DualCompiledContract;
use foundry_zksync_compiler::{DualCompiledContract, FindContract};
use std::{collections::HashMap, fmt::Debug, str::FromStr, sync::Arc};

use crate::{fix_l2_gas_limit, fix_l2_gas_price};
Expand Down Expand Up @@ -164,6 +164,7 @@ where
pub fn create<'a, DB, E>(
call: &CreateInputs,
contract: &DualCompiledContract,
dual_compiled_contracts: &[DualCompiledContract],
env: &'a mut Env,
db: &'a mut DB,
journaled_state: &'a mut JournaledState,
Expand All @@ -177,7 +178,8 @@ where
let constructor_input = call.init_code[contract.evm_bytecode.len()..].to_vec();
let caller = env.tx.caller;
let calldata = encode_create_params(&call.scheme, contract.zk_bytecode_hash, constructor_input);
let factory_deps = vec![contract.zk_deployed_bytecode.clone()];
let factory_deps =
dual_compiled_contracts.fetch_all_factory_deps(&contract).into_iter().collect();
let nonce = ZKVMData::new(db, journaled_state).get_tx_nonce(caller);

let (gas_limit, max_fee_per_gas) = gas_params(env, db, journaled_state, caller);
Expand Down

0 comments on commit 36f32f7

Please sign in to comment.