Skip to content

Commit

Permalink
Merge pull request ethereum#32 from OffchainLabs/hostio-code
Browse files Browse the repository at this point in the history
Add code load parameter to WasmAccountTouchCost
  • Loading branch information
rachel-bousfield authored Jan 30, 2024
2 parents 991e082 + 098f174 commit 2e1774e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions core/types/arbitrum_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var ArbSysAddress = common.HexToAddress("0x64")
var ArbGasInfoAddress = common.HexToAddress("0x6c")
var ArbRetryableTxAddress = common.HexToAddress("0x6e")
var ArbosTestAddress = common.HexToAddress("0x69")
var ArbOwnerPublicAddress = common.HexToAddress("0x6b")
var ArbOwnerAddress = common.HexToAddress("0x70")
var ArbWasmAddress = common.HexToAddress("0x71")
var NodeInterfaceAddress = common.HexToAddress("0xc8")
Expand Down
13 changes: 2 additions & 11 deletions core/vm/interpreter_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

package vm

import (
"github.com/ethereum/go-ethereum/common"
)

func (in *EVMInterpreter) Config() *Config {
return &in.evm.Config
}
Expand All @@ -36,13 +32,8 @@ func (in *EVMInterpreter) ReadOnly() bool {
return in.readOnly
}

func (in *EVMInterpreter) GetReturnData(offset int, size int) []byte {
if offset >= len(in.returnData) {
return []byte{}
}
data := in.returnData[offset:]

return data[:common.MinInt(size, len(data))]
func (in *EVMInterpreter) GetReturnData() []byte {
return in.returnData
}

func (in *EVMInterpreter) SetReturnData(data []byte) {
Expand Down
11 changes: 8 additions & 3 deletions core/vm/operations_acl_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ func WasmCallCost(db StateDB, contract common.Address, value *big.Int, budget ui

// Computes the cost of touching an account in wasm
// Note: the code here is adapted from gasEip2929AccountCheck with the most recent parameters as of The Merge
func WasmAccountTouchCost(db StateDB, addr common.Address) uint64 {
func WasmAccountTouchCost(db StateDB, addr common.Address, withCode bool) uint64 {
cost := uint64(0)
if withCode {
cost = params.MaxCodeSize / 24576 * params.ExtcodeSizeGasEIP150
}

if !db.AddressInAccessList(addr) {
db.AddAddressToAccessList(addr)
return params.ColdAccountAccessCostEIP2929
return cost + params.ColdAccountAccessCostEIP2929
}
return params.WarmStorageReadCostEIP2929
return cost + params.WarmStorageReadCostEIP2929
}

0 comments on commit 2e1774e

Please sign in to comment.