Skip to content

Commit

Permalink
vm: spec fixes (#493)
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign authored Sep 11, 2024
1 parent 568ea84 commit e920a82
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) {
return p, ok
}

func (evm *EVM) isSystemContract(addr common.Address) bool {
return addr == params.HistoryStorageAddress
}

// BlockContext provides the EVM with auxiliary information. Once provided
// it shouldn't be modified.
type BlockContext struct {
Expand Down
6 changes: 5 additions & 1 deletion core/vm/operations_verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func gasExtCodeSize4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,

func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
address := stack.peek().Bytes20()
if _, isPrecompile := evm.precompile(address); isPrecompile {
if _, isPrecompile := evm.precompile(address); isPrecompile || evm.isSystemContract(address) {
return 0, nil
}
codehashgas := evm.Accesses.TouchCodeHash(address[:], false)
Expand Down Expand Up @@ -132,6 +132,10 @@ func gasExtCodeCopyEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Memo
return 0, err
}
addr := common.Address(stack.peek().Bytes20())

if _, isPrecompile := evm.precompile(addr); isPrecompile {
return gas, nil
}
wgas := evm.Accesses.TouchBasicData(addr[:], false)
if wgas == 0 {
wgas = params.WarmStorageReadCostEIP2929
Expand Down

0 comments on commit e920a82

Please sign in to comment.