Skip to content

Commit

Permalink
update for testing transient storage
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Sakharov <[email protected]>
  • Loading branch information
joonazan and montekki committed May 21, 2024
1 parent 642b7ff commit 54e8a96
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ members = [
"fuzzer"
]
resolver = "2"

[patch."https://github.com/matter-labs/vm2"]
vm2 = {path = "../vm2"}
20 changes: 18 additions & 2 deletions compiler_tester/src/vm/eravm/vm2_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ pub fn run_vm(

storage_changes = vm
.world
.get_storage_changes()
.get_storage_state()
.iter()
.map(|(&(address, key), value)| {
(StorageKey { address, key }, H256::from_uint(value))
})
.collect::<HashMap<_, _>>();
deployed_contracts = vm
.world
.get_storage_changes()
.get_storage_state()
.iter()
.filter_map(|((address, key), value)| {
if *address == *zkevm_assembly::zkevm_opcode_defs::system_params::DEPLOYER_SYSTEM_CONTRACT_ADDRESS {
Expand Down Expand Up @@ -211,6 +211,22 @@ impl World for TestWorld {
.map(|h| h.into_uint())
.unwrap_or(U256::zero())
}

fn cost_of_writing_storage(
&mut self,
contract: web3::types::H160,
key: U256,
new_value: U256,
) -> u32 {
0
}

fn is_free_storage_slot(&self, contract: &web3::types::H160, key: &U256) -> bool {
self.storage.contains_key(&StorageKey {
address: *contract,
key: *key,
})
}
}

fn chunk_return_data(bytes: &[u8]) -> Vec<Value> {
Expand Down

0 comments on commit 54e8a96

Please sign in to comment.