Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preserve nonce when setting predeployed code #20

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evm_tester/src/test/case/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ impl Case {
vm.set_nonce(address, state.nonce);

if state.code.0.len() > 0 {
vm.set_predeployed_evm_contract(address, state.code.0);
vm.set_predeployed_evm_contract(address, state.code.0, state.nonce);
}

state
Expand Down
2 changes: 2 additions & 0 deletions evm_tester/src/vm/zk_ee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ impl ZkOS {
&mut self,
address: web3::types::Address,
bytecode: Vec<u8>,
nonce: U256,
) {
let address = address_to_b160(address);

Expand All @@ -376,6 +377,7 @@ impl ZkOS {
),
bytecode.to_vec(),
);
account_data.nonce = nonce.try_into().expect("nonce overflow");

// Now we have to do 2 things:
// * mark that this account has this bytecode hash deployed
Expand Down
19 changes: 10 additions & 9 deletions indexes/zk_ee/ethereum-general-state-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2032,9 +2032,8 @@ entries:
enabled: true
RevertInCreateInInitCreate2Paris.json:
hash: '0x7b7ce35ea7761107883e6738f57d05d7'
enabled: true
# Disabled for Emulator
# comment: "TODO: We do not check for storage collisions"
enabled: false
comment: "We do not check for storage collisions"
RevertOpcodeCreate.json:
hash: '0x40a2c8d4c1db079c3531106f3dfbc907'
enabled: true
Expand Down Expand Up @@ -5683,12 +5682,14 @@ entries:
enabled: true
LoopCallsDepthThenRevert2.json:
hash: '0x848d97ffc9cf1afdaac1287ac469330d'
enabled: true
enabled: false
comment: 'Overflows u64 used to store ergs'
# Disabled for Emulator
# comment: "TODO: out-of-ergs due to infinite loop"
LoopCallsDepthThenRevert3.json:
hash: '0x9d49ccfff72b7600c9cd522a3701fcf3'
enabled: true
enabled: false
comment: 'Overflows u64 used to store ergs'
# Disabled for Emulator
# comment: "TODO: out-of-ergs due to infinite loop"
LoopCallsThenRevert.json:
Expand Down Expand Up @@ -5717,9 +5718,8 @@ entries:
enabled: true
RevertInCreateInInit_Paris.json:
hash: '0x0d98daa483736b05fbd72e7f6a4c533a'
enabled: true
# Disabled for Emulator
# comment: "TODO: expects revert due to storage collision"
enabled: false
comment: "Expects revert due to storage collision"
RevertInDelegateCall.json:
hash: '0x6cb258d0c84b1807e2fd33b30e370d21'
enabled: true
Expand Down Expand Up @@ -5836,7 +5836,8 @@ entries:
enabled: true
InitCollisionParis.json:
hash: '0xd58e2cdc4e84e14db5cc52caf9998ea6'
enabled: true
enabled: false
comment: "We do not check for storage collision"
# Disabled for Emulator
# comment: "TODO: we do not destroy storage during contract creation"
SstoreCallToSelfSubRefundBelowZero.json:
Expand Down