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

core/vm: witness write event for SSTORE #80

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
1 change: 0 additions & 1 deletion core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by

if interpreter.evm.chainConfig.IsCancun(interpreter.evm.Context.BlockNumber) {
index := trieUtils.GetTreeKeyStorageSlot(scope.Contract.Address().Bytes(), loc)
// TODO SSTORE write events
interpreter.evm.Accesses.SetLeafValue(index, val.Bytes())
}
return nil, nil
Expand Down
6 changes: 6 additions & 0 deletions core/vm/operations_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func makeGasSStoreFunc(clearingRefund uint64) gasFunc {
}
value := common.Hash(y.Bytes32())

if evm.chainConfig.IsCancun(evm.Context.BlockNumber) {
addr := contract.Address()
index := trieUtils.GetTreeKeyStorageSlot(addr[:], x)
cost += evm.Accesses.TouchAddressOnWriteAndComputeGas(index)
}

if current == value { // noop (1)
// EIP 2200 original clause:
// return params.SloadGasEIP2200, nil
Expand Down