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

Set on update storage at the beginning of sstore #288

Merged
merged 1 commit into from
May 17, 2023
Merged
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
12 changes: 7 additions & 5 deletions main/opcodes/storage-memory.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,17 @@ opSSTORE:

; check stack underflow
SP - 2 => SP :JMPN(stackUnderflow)
; check out-of-gas
GAS - %SSTORE_ENTRY_EIP_2200_GAS - 1 :JMPN(outOfGas)
; check is static call
$ => A :MLOAD(isStaticCall), JMPNZ(invalidStaticTx)

$ => C :MLOAD(SP+1) ; [key => C]
C :MSTORE(tmpVarCsstore)
$ => D :MLOAD(SP) ; [value => D]

$${eventLog(onUpdateStorage(C, D))}

; check out-of-gas
GAS - %SSTORE_ENTRY_EIP_2200_GAS - 1 :JMPN(outOfGas)
; check is static call
$ => A :MLOAD(isStaticCall), JMPNZ(invalidStaticTx)
; check if is a create call
$ => A :MLOAD(isCreateContract), JMPNZ(deploymentSSTORE)
; load current storage address
Expand Down Expand Up @@ -307,5 +310,4 @@ opSSTOREsr:
; set key for smt storage query
%SMT_KEY_SC_STORAGE => B
$ => C :MLOAD(tmpVarCsstore); key => C
$${eventLog(onUpdateStorage(C, D))}
$ => SR :SSTORE, JMP(readCode)