Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Oct 31, 2024
1 parent 9352299 commit 40b6684
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions integration/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ pub fn deploy_and_call(deployment_code: Vec<u8>, calldata: Vec<u8>) -> Result<u6
data: deployment_code.into(),
..Default::default()
};
let mut db = InMemoryDB::default();
let mut evm = Evm::builder()
.with_spec_id(SpecId::CANCUN)
.with_db(InMemoryDB::default())
.with_db(&mut db)
.with_env(env.clone())
.build();
let result = evm.transact_commit().unwrap();
Expand All @@ -31,11 +32,12 @@ pub fn deploy_and_call(deployment_code: Vec<u8>, calldata: Vec<u8>) -> Result<u6
))
}
ExecutionResult::Halt { reason, gas_used } => return Err(format!(
"Contract deployment transaction halts unexpectedly with gas_used {gas_used} and reason {:?}",
reason
)),
"Contract deployment transaction halts unexpectedly with gas_used {gas_used} and reason {:?}",
reason
)),
_ => unreachable!(),
};
drop(evm);

env.tx = TxEnv {
gas_limit: u64::MAX,
Expand All @@ -45,7 +47,7 @@ pub fn deploy_and_call(deployment_code: Vec<u8>, calldata: Vec<u8>) -> Result<u6
};
let mut evm = Evm::builder()
.with_spec_id(SpecId::CANCUN)
.with_db(InMemoryDB::default())
.with_db(&mut db)
.with_env(env)
.build();
let result = evm.transact_commit().unwrap();
Expand Down

0 comments on commit 40b6684

Please sign in to comment.