Skip to content

Commit

Permalink
fix sstore
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Jan 17, 2025
1 parent af82004 commit a64ea58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cairo/ethereum/cancun/vm/instructions/storage.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ func sstore{
let poseidon_ptr = cast([ap - 2], PoseidonBuiltin*);
let dict_ptr = cast([ap - 1], DictAccess*);

let new_dict_ptr = cast(dict_ptr, SetTupleAddressBytes32DictAccess*);
tempvar new_accessed_storage_keys = SetTupleAddressBytes32(
new SetTupleAddressBytes32Struct(
evm.value.accessed_storage_keys.value.dict_ptr_start, new_dict_ptr
),
);

// Calculate storage gas cost
tempvar zero_u256 = U256(new U256Struct(0, 0));
let is_original_eq_current = U256__eq__(original_value, current_value);
Expand Down Expand Up @@ -229,6 +236,7 @@ func sstore{
EvmImpl.set_env(env);
EvmImpl.set_pc_stack(Uint(evm.value.pc.value + 1), stack);
EvmImpl.set_refund_counter(refund_counter);
EvmImpl.set_accessed_storage_keys(new_accessed_storage_keys);
let ok = cast(0, ExceptionalHalt*);
return ok;
}
Expand Down
2 changes: 1 addition & 1 deletion cairo/tests/ethereum/cancun/vm/instructions/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
prev_randao,
timestamp,
)
from tests.utils.args_gen import Environment, Evm, State, TransientStorage
from tests.utils.args_gen import Environment, Evm, TransientStorage
from tests.utils.errors import assert_raises_exactly
from tests.utils.evm_builder import EvmBuilder, address_zero
from tests.utils.strategies import (
Expand Down

0 comments on commit a64ea58

Please sign in to comment.