@@ -89,38 +89,38 @@ func (aw *AccessWitness) Copy() *AccessWitness {
89
89
return naw
90
90
}
91
91
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
93
93
// 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 {
95
95
var gas uint64
96
96
for i := utils .VersionLeafKey ; i <= utils .CodeSizeLeafKey ; i ++ {
97
97
gas += aw .touchAddressAndChargeGas (addr , zeroTreeIndex , byte (i ), isWrite )
98
98
}
99
99
return gas
100
100
}
101
101
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
103
103
// cold member fields of an account, that need to be touched when making a message
104
104
// call to that account.
105
- func (aw * AccessWitness ) TouchAndChargeMessageCall (destination []byte ) uint64 {
105
+ func (aw * AccessWitness ) MessageCallGas (destination []byte ) uint64 {
106
106
var gas uint64
107
107
gas += aw .touchAddressAndChargeGas (destination , zeroTreeIndex , utils .VersionLeafKey , false )
108
108
gas += aw .touchAddressAndChargeGas (destination , zeroTreeIndex , utils .CodeSizeLeafKey , false )
109
109
return gas
110
110
}
111
111
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
113
113
// 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 {
115
115
var gas uint64
116
116
gas += aw .touchAddressAndChargeGas (callerAddr , zeroTreeIndex , utils .BalanceLeafKey , true )
117
117
gas += aw .touchAddressAndChargeGas (targetAddr , zeroTreeIndex , utils .BalanceLeafKey , true )
118
118
return gas
119
119
}
120
120
121
- // TouchAndChargeContractCreateInit returns the access gas costs for the initialization of
121
+ // ContractCreateInitGas returns the access gas costs for the initialization of
122
122
// a contract creation.
123
- func (aw * AccessWitness ) TouchAndChargeContractCreateInit (addr []byte , createSendsValue bool ) uint64 {
123
+ func (aw * AccessWitness ) ContractCreateInitGas (addr []byte , createSendsValue bool ) uint64 {
124
124
var gas uint64
125
125
gas += aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .VersionLeafKey , true )
126
126
gas += aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .NonceLeafKey , true )
@@ -130,24 +130,24 @@ func (aw *AccessWitness) TouchAndChargeContractCreateInit(addr []byte, createSen
130
130
return gas
131
131
}
132
132
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,
134
134
// 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 ) {
136
136
for i := utils .VersionLeafKey ; i <= utils .CodeSizeLeafKey ; i ++ {
137
137
aw .touchAddressAndChargeGas (originAddr , zeroTreeIndex , byte (i ), i == utils .BalanceLeafKey || i == utils .NonceLeafKey )
138
138
}
139
139
}
140
140
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,
142
142
// 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 ) {
144
144
for i := utils .VersionLeafKey ; i <= utils .CodeSizeLeafKey ; i ++ {
145
145
aw .touchAddressAndChargeGas (targetAddr , zeroTreeIndex , byte (i ), i == utils .VersionLeafKey && sendsValue )
146
146
}
147
147
}
148
148
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 {
151
151
treeIndex , subIndex := utils .StorageIndex (slot .Bytes ())
152
152
return aw .touchAddressAndChargeGas (addr , * treeIndex , subIndex , isWrite )
153
153
}
@@ -238,7 +238,7 @@ func newChunkAccessKey(branchKey branchAccessKey, leafKey byte) chunkAccessKey {
238
238
}
239
239
240
240
// 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 {
242
242
// note that in the case where the copied code is outside the range of the
243
243
// contract code but touches the last leaf with contract code in it,
244
244
// we don't include the last leaf of code in the AccessWitness. The
@@ -272,22 +272,22 @@ func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, s
272
272
return statelessGasCharged
273
273
}
274
274
275
- func (aw * AccessWitness ) TouchVersion (addr []byte , isWrite bool ) uint64 {
275
+ func (aw * AccessWitness ) VersionGas (addr []byte , isWrite bool ) uint64 {
276
276
return aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .VersionLeafKey , isWrite )
277
277
}
278
278
279
- func (aw * AccessWitness ) TouchBalance (addr []byte , isWrite bool ) uint64 {
279
+ func (aw * AccessWitness ) BalanceGas (addr []byte , isWrite bool ) uint64 {
280
280
return aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .BalanceLeafKey , isWrite )
281
281
}
282
282
283
- func (aw * AccessWitness ) TouchNonce (addr []byte , isWrite bool ) uint64 {
283
+ func (aw * AccessWitness ) NonceGas (addr []byte , isWrite bool ) uint64 {
284
284
return aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .NonceLeafKey , isWrite )
285
285
}
286
286
287
- func (aw * AccessWitness ) TouchCodeSize (addr []byte , isWrite bool ) uint64 {
287
+ func (aw * AccessWitness ) CodeSizeGas (addr []byte , isWrite bool ) uint64 {
288
288
return aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .CodeSizeLeafKey , isWrite )
289
289
}
290
290
291
- func (aw * AccessWitness ) TouchCodeHash (addr []byte , isWrite bool ) uint64 {
291
+ func (aw * AccessWitness ) CodeHashGas (addr []byte , isWrite bool ) uint64 {
292
292
return aw .touchAddressAndChargeGas (addr , zeroTreeIndex , utils .CodeKeccakLeafKey , isWrite )
293
293
}
0 commit comments