Skip to content

Commit

Permalink
fix(evm): pass constructor arguments to REVM
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Dec 4, 2024
1 parent 40ea623 commit 63ecc8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions compiler_tester/src/test/case/input/deploy_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,15 @@ impl DeployEVM {
contract_identifier: self.identifier.clone(),
},
);

let size = self.deploy_code.len();
let calldata = self.calldata.inner.clone();
let mut code = self.deploy_code;
code.extend(self.calldata.inner);

let vm = vm.update_deploy_balance(&self.caller);
let mut vm =
vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, self.deploy_code);
vm.fill_deploy_new_transaction(self.caller, self.value, evm_version, code);

let result = match vm.state.transact_commit() {
Ok(res) => res,
Expand Down Expand Up @@ -175,7 +179,7 @@ impl DeployEVM {
} else if let Some(error) = error {
Summary::invalid(summary, test, format!("{error:?}"));
} else {
Summary::failed(summary, test, self.expected, output, self.calldata.inner);
Summary::failed(summary, test, self.expected, output, calldata);
}

vm
Expand Down
4 changes: 2 additions & 2 deletions compiler_tester/src/vm/revm/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<'a> Revm<'a> {
caller: web3::types::Address,
value: Option<u128>,
evm_version: Option<EVMVersion>,
deploy_code: Vec<u8>,
code: Vec<u8>,
) -> Self {
let vm = self
.state
Expand All @@ -146,7 +146,7 @@ impl<'a> Revm<'a> {
env.tx.gas_limit = evm_context.block_gas_limit;
env.tx.access_list = vec![];
env.tx.caller = web3_address_to_revm_address(&caller);
env.tx.data = revm::primitives::Bytes::from(deploy_code);
env.tx.data = revm::primitives::Bytes::from(code);
env.tx.value = revm::primitives::U256::from(value.unwrap_or_default());
env.tx.transact_to = TxKind::Create;
})
Expand Down

0 comments on commit 63ecc8e

Please sign in to comment.