Skip to content

Commit

Permalink
fix: in CALL, touch callee instead of caller
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed May 7, 2024
1 parent 7cae5e3 commit 7f35839
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions 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()
address := stack.Back(1).Bytes20()
if _, isPrecompile := evm.precompile(address); isPrecompile {
return 0, nil
}
Expand All @@ -74,14 +74,15 @@ func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,

func makeCallVariantGasEIP4762(oldCalculator gasFunc) gasFunc {
return func(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
address := stack.peek().Bytes20()
gas, err := oldCalculator(evm, contract, stack, mem, memorySize)
if err != nil {
return 0, err
}
if _, isPrecompile := evm.precompile(contract.Address()); isPrecompile {
if _, isPrecompile := evm.precompile(address); isPrecompile {
return gas, nil
}
wgas := evm.Accesses.TouchAndChargeMessageCall(contract.Address().Bytes())
wgas := evm.Accesses.TouchAndChargeMessageCall(address[:])
if wgas == 0 {
wgas = params.WarmStorageReadCostEIP2929
}
Expand Down

0 comments on commit 7f35839

Please sign in to comment.