Skip to content

Commit 2334cb7

Browse files
committed
rename access witness functions
1 parent fea8553 commit 2334cb7

File tree

8 files changed

+52
-52
lines changed

8 files changed

+52
-52
lines changed

consensus/beacon/consensus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
364364
// Add the balance of each withdrawal to the witness, no gas will
365365
// be charged.
366366
if chain.Config().IsEIP4762(header.Number, header.Time) {
367-
state.Witness().TouchBalance(w.Address[:], true)
367+
state.Witness().BalanceGas(w.Address[:], true)
368368
}
369369
}
370370
// No block reward which is issued by consensus layer instead.

core/state/access_witness.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,38 @@ func (aw *AccessWitness) Copy() *AccessWitness {
8989
return naw
9090
}
9191

92-
// TouchFullAccount returns the gas to be charged for each of the currently cold
92+
// AddAccount returns the gas to be charged for each of the currently cold
9393
// member fields of an account.
94-
func (aw *AccessWitness) TouchFullAccount(addr []byte, isWrite bool) uint64 {
94+
func (aw *AccessWitness) AddAccount(addr []byte, isWrite bool) uint64 {
9595
var gas uint64
9696
for i := utils.VersionLeafKey; i <= utils.CodeSizeLeafKey; i++ {
9797
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, byte(i), isWrite)
9898
}
9999
return gas
100100
}
101101

102-
// TouchAndChargeMessageCall returns the gas to be charged for each of the currently
102+
// MessageCallGas returns the gas to be charged for each of the currently
103103
// cold member fields of an account, that need to be touched when making a message
104104
// call to that account.
105-
func (aw *AccessWitness) TouchAndChargeMessageCall(destination []byte) uint64 {
105+
func (aw *AccessWitness) MessageCallGas(destination []byte) uint64 {
106106
var gas uint64
107107
gas += aw.touchAddressAndChargeGas(destination, zeroTreeIndex, utils.VersionLeafKey, false)
108108
gas += aw.touchAddressAndChargeGas(destination, zeroTreeIndex, utils.CodeSizeLeafKey, false)
109109
return gas
110110
}
111111

112-
// TouchAndChargeValueTransfer returns the gas to be charged for each of the currently
112+
// ValueTransferGas returns the gas to be charged for each of the currently
113113
// cold balance member fields of the caller and the callee accounts.
114-
func (aw *AccessWitness) TouchAndChargeValueTransfer(callerAddr, targetAddr []byte) uint64 {
114+
func (aw *AccessWitness) ValueTransferGas(callerAddr, targetAddr []byte) uint64 {
115115
var gas uint64
116116
gas += aw.touchAddressAndChargeGas(callerAddr, zeroTreeIndex, utils.BalanceLeafKey, true)
117117
gas += aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, utils.BalanceLeafKey, true)
118118
return gas
119119
}
120120

121-
// TouchAndChargeContractCreateInit returns the access gas costs for the initialization of
121+
// ContractCreateInitGas returns the access gas costs for the initialization of
122122
// a contract creation.
123-
func (aw *AccessWitness) TouchAndChargeContractCreateInit(addr []byte, createSendsValue bool) uint64 {
123+
func (aw *AccessWitness) ContractCreateInitGas(addr []byte, createSendsValue bool) uint64 {
124124
var gas uint64
125125
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.VersionLeafKey, true)
126126
gas += aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.NonceLeafKey, true)
@@ -130,24 +130,24 @@ func (aw *AccessWitness) TouchAndChargeContractCreateInit(addr []byte, createSen
130130
return gas
131131
}
132132

133-
// TouchTxOrigin adds the member fields of the sender account to the witness,
133+
// AddTxOrigin adds the member fields of the sender account to the witness,
134134
// so that cold accesses are not charged, since they are covered by the 21000 gas.
135-
func (aw *AccessWitness) TouchTxOrigin(originAddr []byte) {
135+
func (aw *AccessWitness) AddTxOrigin(originAddr []byte) {
136136
for i := utils.VersionLeafKey; i <= utils.CodeSizeLeafKey; i++ {
137137
aw.touchAddressAndChargeGas(originAddr, zeroTreeIndex, byte(i), i == utils.BalanceLeafKey || i == utils.NonceLeafKey)
138138
}
139139
}
140140

141-
// TouchTxDestination adds the member fields of the sender account to the witness,
141+
// AddTxDestination adds the member fields of the sender account to the witness,
142142
// so that cold accesses are not charged, since they are covered by the 21000 gas.
143-
func (aw *AccessWitness) TouchTxDestination(targetAddr []byte, sendsValue bool) {
143+
func (aw *AccessWitness) AddTxDestination(targetAddr []byte, sendsValue bool) {
144144
for i := utils.VersionLeafKey; i <= utils.CodeSizeLeafKey; i++ {
145145
aw.touchAddressAndChargeGas(targetAddr, zeroTreeIndex, byte(i), i == utils.VersionLeafKey && sendsValue)
146146
}
147147
}
148148

149-
// TouchSlotAndChargeGas returns the amount of gas to be charged for a cold storage access.
150-
func (aw *AccessWitness) TouchSlotAndChargeGas(addr []byte, slot common.Hash, isWrite bool) uint64 {
149+
// SlotGas returns the amount of gas to be charged for a cold storage access.
150+
func (aw *AccessWitness) SlotGas(addr []byte, slot common.Hash, isWrite bool) uint64 {
151151
treeIndex, subIndex := utils.StorageIndex(slot.Bytes())
152152
return aw.touchAddressAndChargeGas(addr, *treeIndex, subIndex, isWrite)
153153
}
@@ -238,7 +238,7 @@ func newChunkAccessKey(branchKey branchAccessKey, leafKey byte) chunkAccessKey {
238238
}
239239

240240
// touchCodeChunksRangeOnReadAndChargeGas is a helper function to touch every chunk in a code range and charge witness gas costs
241-
func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, startPC, size uint64, codeLen uint64, isWrite bool) uint64 {
241+
func (aw *AccessWitness) CodeChunksRangeGas(contractAddr []byte, startPC, size uint64, codeLen uint64, isWrite bool) uint64 {
242242
// note that in the case where the copied code is outside the range of the
243243
// contract code but touches the last leaf with contract code in it,
244244
// we don't include the last leaf of code in the AccessWitness. The
@@ -272,22 +272,22 @@ func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, s
272272
return statelessGasCharged
273273
}
274274

275-
func (aw *AccessWitness) TouchVersion(addr []byte, isWrite bool) uint64 {
275+
func (aw *AccessWitness) VersionGas(addr []byte, isWrite bool) uint64 {
276276
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.VersionLeafKey, isWrite)
277277
}
278278

279-
func (aw *AccessWitness) TouchBalance(addr []byte, isWrite bool) uint64 {
279+
func (aw *AccessWitness) BalanceGas(addr []byte, isWrite bool) uint64 {
280280
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BalanceLeafKey, isWrite)
281281
}
282282

283-
func (aw *AccessWitness) TouchNonce(addr []byte, isWrite bool) uint64 {
283+
func (aw *AccessWitness) NonceGas(addr []byte, isWrite bool) uint64 {
284284
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.NonceLeafKey, isWrite)
285285
}
286286

287-
func (aw *AccessWitness) TouchCodeSize(addr []byte, isWrite bool) uint64 {
287+
func (aw *AccessWitness) CodeSizeGas(addr []byte, isWrite bool) uint64 {
288288
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeSizeLeafKey, isWrite)
289289
}
290290

291-
func (aw *AccessWitness) TouchCodeHash(addr []byte, isWrite bool) uint64 {
291+
func (aw *AccessWitness) CodeHashGas(addr []byte, isWrite bool) uint64 {
292292
return aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeKeccakLeafKey, isWrite)
293293
}

core/state_transition.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
422422
targetAddr := msg.To
423423
originAddr := msg.From
424424

425-
st.evm.Accesses.TouchTxOrigin(originAddr.Bytes())
425+
st.evm.Accesses.AddTxOrigin(originAddr.Bytes())
426426

427427
if msg.To != nil {
428-
st.evm.Accesses.TouchTxDestination(targetAddr.Bytes(), msg.Value.Sign() != 0)
428+
st.evm.Accesses.AddTxDestination(targetAddr.Bytes(), msg.Value.Sign() != 0)
429429

430430
// ensure the code size ends up in the access witness
431431
st.evm.StateDB.GetCodeSize(*targetAddr)
@@ -488,7 +488,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
488488

489489
// add the coinbase to the witness iff the fee is greater than 0
490490
if rules.IsEIP4762 && fee.Sign() != 0 {
491-
st.evm.Accesses.TouchBalance(st.evm.Context.Coinbase[:], true)
491+
st.evm.Accesses.BalanceGas(st.evm.Context.Coinbase[:], true)
492492
}
493493
}
494494

core/vm/evm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
211211
if !evm.StateDB.Exist(addr) {
212212
if !isPrecompile && evm.chainRules.IsEIP4762 {
213213
// add proof of absence to witness
214-
wgas := evm.Accesses.TouchFullAccount(addr.Bytes(), false)
214+
wgas := evm.Accesses.AddAccount(addr.Bytes(), false)
215215
if gas < wgas {
216216
evm.StateDB.RevertToSnapshot(snapshot)
217217
return nil, 0, ErrOutOfGas
@@ -510,7 +510,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
510510

511511
// Charge the contract creation init gas in verkle mode
512512
if evm.chainRules.IsEIP4762 {
513-
if !contract.UseGas(evm.Accesses.TouchAndChargeContractCreateInit(address.Bytes(), value.Sign() != 0), evm.Config.Tracer, tracing.GasChangeWitnessContractInit) {
513+
if !contract.UseGas(evm.Accesses.ContractCreateInitGas(address.Bytes(), value.Sign() != 0), evm.Config.Tracer, tracing.GasChangeWitnessContractInit) {
514514
err = ErrOutOfGas
515515
}
516516
}
@@ -541,11 +541,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
541541
}
542542
} else {
543543
// Contract creation completed, touch the missing fields in the contract
544-
if !contract.UseGas(evm.Accesses.TouchFullAccount(address.Bytes()[:], true), evm.Config.Tracer, tracing.GasChangeWitnessContractCreation) {
544+
if !contract.UseGas(evm.Accesses.AddAccount(address.Bytes()[:], true), evm.Config.Tracer, tracing.GasChangeWitnessContractCreation) {
545545
err = ErrCodeStoreOutOfGas
546546
}
547547

548-
if err == nil && len(ret) > 0 && !contract.UseGas(evm.Accesses.TouchCodeChunksRangeAndChargeGas(address.Bytes(), 0, uint64(len(ret)), uint64(len(ret)), true), evm.Config.Tracer, tracing.GasChangeWitnessCodeChunk) {
548+
if err == nil && len(ret) > 0 && !contract.UseGas(evm.Accesses.CodeChunksRangeGas(address.Bytes(), 0, uint64(len(ret)), uint64(len(ret)), true), evm.Config.Tracer, tracing.GasChangeWitnessCodeChunk) {
549549
err = ErrCodeStoreOutOfGas
550550
}
551551
}

core/vm/gas_table.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func gasCall(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize
404404
}
405405
if evm.chainRules.IsEIP4762 {
406406
if transfersValue {
407-
gas, overflow = math.SafeAdd(gas, evm.Accesses.TouchAndChargeValueTransfer(contract.Address().Bytes()[:], address.Bytes()[:]))
407+
gas, overflow = math.SafeAdd(gas, evm.Accesses.ValueTransferGas(contract.Address().Bytes()[:], address.Bytes()[:]))
408408
if overflow {
409409
return 0, ErrGasUintOverflow
410410
}
@@ -440,7 +440,7 @@ func gasCallCode(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memory
440440
address := common.Address(stack.Back(1).Bytes20())
441441
transfersValue := !stack.Back(2).IsZero()
442442
if transfersValue {
443-
gas, overflow = math.SafeAdd(gas, evm.Accesses.TouchAndChargeValueTransfer(contract.Address().Bytes()[:], address.Bytes()[:]))
443+
gas, overflow = math.SafeAdd(gas, evm.Accesses.ValueTransferGas(contract.Address().Bytes()[:], address.Bytes()[:]))
444444
if overflow {
445445
return 0, ErrGasUintOverflow
446446
}

core/vm/instructions.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
389389
self: AccountRef(addr),
390390
}
391391
paddedCodeCopy, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(code, uint64CodeOffset, length.Uint64())
392-
statelessGas := interpreter.evm.Accesses.TouchCodeChunksRangeAndChargeGas(addr[:], copyOffset, nonPaddedCopyLength, uint64(len(contract.Code)), false)
392+
statelessGas := interpreter.evm.Accesses.CodeChunksRangeGas(addr[:], copyOffset, nonPaddedCopyLength, uint64(len(contract.Code)), false)
393393
if !scope.Contract.UseGas(statelessGas, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) {
394394
scope.Contract.Gas = 0
395395
return nil, ErrOutOfGas
@@ -606,7 +606,7 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b
606606

607607
if interpreter.evm.chainRules.IsEIP4762 {
608608
contractAddress := crypto.CreateAddress(scope.Contract.Address(), interpreter.evm.StateDB.GetNonce(scope.Contract.Address()))
609-
statelessGas := interpreter.evm.Accesses.TouchAndChargeContractCreateInit(contractAddress.Bytes()[:], value.Sign() != 0)
609+
statelessGas := interpreter.evm.Accesses.ContractCreateInitGas(contractAddress.Bytes()[:], value.Sign() != 0)
610610
if !scope.Contract.UseGas(statelessGas, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) {
611611
return nil, ErrExecutionReverted
612612
}
@@ -655,7 +655,7 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
655655
if interpreter.evm.chainRules.IsEIP4762 {
656656
codeAndHash := &codeAndHash{code: input}
657657
contractAddress := crypto.CreateAddress2(scope.Contract.Address(), salt.Bytes32(), codeAndHash.Hash().Bytes())
658-
statelessGas := interpreter.evm.Accesses.TouchAndChargeContractCreateInit(contractAddress.Bytes()[:], endowment.Sign() != 0)
658+
statelessGas := interpreter.evm.Accesses.ContractCreateInitGas(contractAddress.Bytes()[:], endowment.Sign() != 0)
659659
if !scope.Contract.UseGas(statelessGas, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) {
660660
return nil, ErrExecutionReverted
661661
}
@@ -918,7 +918,7 @@ func opPush1(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
918918
// touch next chunk if PUSH1 is at the boundary. if so, *pc has
919919
// advanced past this boundary.
920920
contractAddr := scope.Contract.Address()
921-
statelessGas := interpreter.evm.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], *pc+1, uint64(1), uint64(len(scope.Contract.Code)), false)
921+
statelessGas := interpreter.evm.Accesses.CodeChunksRangeGas(contractAddr[:], *pc+1, uint64(1), uint64(len(scope.Contract.Code)), false)
922922
if !scope.Contract.UseGas(statelessGas, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) {
923923
scope.Contract.Gas = 0
924924
return nil, ErrOutOfGas
@@ -947,7 +947,7 @@ func makePush(size uint64, pushByteSize int) executionFunc {
947947

948948
if !scope.Contract.IsDeployment && interpreter.evm.chainRules.IsEIP4762 {
949949
contractAddr := scope.Contract.Address()
950-
statelessGas := interpreter.evm.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], uint64(start), uint64(pushByteSize), uint64(len(scope.Contract.Code)), false)
950+
statelessGas := interpreter.evm.Accesses.CodeChunksRangeGas(contractAddr[:], uint64(start), uint64(pushByteSize), uint64(len(scope.Contract.Code)), false)
951951
if !scope.Contract.UseGas(statelessGas, interpreter.evm.Config.Tracer, tracing.GasChangeUnspecified) {
952952
scope.Contract.Gas = 0
953953
return nil, ErrOutOfGas

core/vm/interpreter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
227227
// if the PC ends up in a new "chunk" of verkleized code, charge the
228228
// associated costs.
229229
contractAddr := contract.Address()
230-
contract.Gas -= in.evm.TxContext.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], pc, 1, uint64(len(contract.Code)), false)
230+
contract.Gas -= in.evm.TxContext.Accesses.CodeChunksRangeGas(contractAddr[:], pc, 1, uint64(len(contract.Code)), false)
231231
}
232232

233233
// Get the operation from the jump table and validate the stack to ensure there are

core/vm/operations_verkle.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ import (
2323
)
2424

2525
func gasSStore4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
26-
gas := evm.Accesses.TouchSlotAndChargeGas(contract.Address().Bytes(), common.Hash(stack.peek().Bytes32()), true)
26+
gas := evm.Accesses.SlotGas(contract.Address().Bytes(), common.Hash(stack.peek().Bytes32()), true)
2727
if gas == 0 {
2828
gas = params.WarmStorageReadCostEIP2929
2929
}
3030
return gas, nil
3131
}
3232

3333
func gasSLoad4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
34-
gas := evm.Accesses.TouchSlotAndChargeGas(contract.Address().Bytes(), common.Hash(stack.peek().Bytes32()), false)
34+
gas := evm.Accesses.SlotGas(contract.Address().Bytes(), common.Hash(stack.peek().Bytes32()), false)
3535
if gas == 0 {
3636
gas = params.WarmStorageReadCostEIP2929
3737
}
@@ -40,7 +40,7 @@ func gasSLoad4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memor
4040

4141
func gasBalance4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
4242
address := stack.peek().Bytes20()
43-
gas := evm.Accesses.TouchBalance(address[:], false)
43+
gas := evm.Accesses.BalanceGas(address[:], false)
4444
if gas == 0 {
4545
gas = params.WarmStorageReadCostEIP2929
4646
}
@@ -52,8 +52,8 @@ func gasExtCodeSize4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,
5252
if _, isPrecompile := evm.precompile(address); isPrecompile {
5353
return 0, nil
5454
}
55-
wgas := evm.Accesses.TouchVersion(address[:], false)
56-
wgas += evm.Accesses.TouchCodeSize(address[:], false)
55+
wgas := evm.Accesses.VersionGas(address[:], false)
56+
wgas += evm.Accesses.CodeSizeGas(address[:], false)
5757
if wgas == 0 {
5858
wgas = params.WarmStorageReadCostEIP2929
5959
}
@@ -65,7 +65,7 @@ func gasExtCodeHash4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,
6565
if _, isPrecompile := evm.precompile(address); isPrecompile {
6666
return 0, nil
6767
}
68-
codehashgas := evm.Accesses.TouchCodeHash(address[:], false)
68+
codehashgas := evm.Accesses.CodeHashGas(address[:], false)
6969
if codehashgas == 0 {
7070
codehashgas = params.WarmStorageReadCostEIP2929
7171
}
@@ -81,7 +81,7 @@ func makeCallVariantGasEIP4762(oldCalculator gasFunc) gasFunc {
8181
if _, isPrecompile := evm.precompile(contract.Address()); isPrecompile {
8282
return gas, nil
8383
}
84-
wgas := evm.Accesses.TouchAndChargeMessageCall(contract.Address().Bytes())
84+
wgas := evm.Accesses.MessageCallGas(contract.Address().Bytes())
8585
if wgas == 0 {
8686
wgas = params.WarmStorageReadCostEIP2929
8787
}
@@ -102,17 +102,17 @@ func gasSelfdestructEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Mem
102102
return 0, nil
103103
}
104104
contractAddr := contract.Address()
105-
statelessGas := evm.Accesses.TouchVersion(contractAddr[:], false)
106-
statelessGas += evm.Accesses.TouchCodeSize(contractAddr[:], false)
107-
statelessGas += evm.Accesses.TouchBalance(contractAddr[:], false)
105+
statelessGas := evm.Accesses.VersionGas(contractAddr[:], false)
106+
statelessGas += evm.Accesses.CodeSizeGas(contractAddr[:], false)
107+
statelessGas += evm.Accesses.BalanceGas(contractAddr[:], false)
108108
if contractAddr != beneficiaryAddr {
109-
statelessGas += evm.Accesses.TouchBalance(beneficiaryAddr[:], false)
109+
statelessGas += evm.Accesses.BalanceGas(beneficiaryAddr[:], false)
110110
}
111111
// Charge write costs if it transfers value
112112
if evm.StateDB.GetBalance(contractAddr).Sign() != 0 {
113-
statelessGas += evm.Accesses.TouchBalance(contractAddr[:], true)
113+
statelessGas += evm.Accesses.BalanceGas(contractAddr[:], true)
114114
if contractAddr != beneficiaryAddr {
115-
statelessGas += evm.Accesses.TouchBalance(beneficiaryAddr[:], true)
115+
statelessGas += evm.Accesses.BalanceGas(beneficiaryAddr[:], true)
116116
}
117117
}
118118
return statelessGas, nil
@@ -133,7 +133,7 @@ func gasCodeCopyEip4762(evm *EVM, contract *Contract, stack *Stack, mem *Memory,
133133
}
134134
_, copyOffset, nonPaddedCopyLength := getDataAndAdjustedBounds(contract.Code, uint64CodeOffset, length.Uint64())
135135
if !contract.IsDeployment {
136-
gas += evm.Accesses.TouchCodeChunksRangeAndChargeGas(contract.Address().Bytes(), copyOffset, nonPaddedCopyLength, uint64(len(contract.Code)), false)
136+
gas += evm.Accesses.CodeChunksRangeGas(contract.Address().Bytes(), copyOffset, nonPaddedCopyLength, uint64(len(contract.Code)), false)
137137
}
138138
return gas, nil
139139
}
@@ -145,8 +145,8 @@ func gasExtCodeCopyEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Memo
145145
return 0, err
146146
}
147147
addr := common.Address(stack.peek().Bytes20())
148-
wgas := evm.Accesses.TouchVersion(addr[:], false)
149-
wgas += evm.Accesses.TouchCodeSize(addr[:], false)
148+
wgas := evm.Accesses.VersionGas(addr[:], false)
149+
wgas += evm.Accesses.CodeSizeGas(addr[:], false)
150150
if wgas == 0 {
151151
wgas = params.WarmStorageReadCostEIP2929
152152
}

0 commit comments

Comments
 (0)