Skip to content

Commit 6c66c64

Browse files
committed
core/accesswitness: keep original order & fixes
Signed-off-by: Ignacio Hagopian <[email protected]>
1 parent e149dcb commit 6c66c64

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/state/access_witness.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ func (aw *AccessWitness) TouchAndChargeContractCreateInit(addr []byte, createSen
131131
func (aw *AccessWitness) TouchAndChargeContractCreateCompleted(addr []byte, withValue bool) uint64 { // TODO(jsign): withValue not used?
132132
var gas uint64
133133
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.VersionLeafKey)
134-
gas += aw.TouchAddressOnReadAndComputeGas(addr, zeroTreeIndex, utils.CodeSizeLeafKey)
135-
gas += aw.TouchAddressOnReadAndComputeGas(addr, zeroTreeIndex, utils.CodeKeccakLeafKey)
136-
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.NonceLeafKey)
137134
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.BalanceLeafKey)
135+
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.CodeSizeLeafKey)
136+
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.CodeKeccakLeafKey)
137+
gas += aw.TouchAddressOnWriteAndComputeGas(addr, zeroTreeIndex, utils.NonceLeafKey)
138138
return gas
139139
}
140140

@@ -220,7 +220,7 @@ func (aw *AccessWitness) touchAddress(addr []byte, treeIndex uint256.Int, subInd
220220
chunkValue := aw.chunks[chunkKey]
221221
if (chunkValue & AccessWitnessWriteFlag) == 0 {
222222
chunkWrite = true
223-
aw.chunks[chunkKey] |= chunkValue
223+
aw.chunks[chunkKey] |= AccessWitnessWriteFlag
224224
}
225225

226226
// TODO: charge chunk filling costs if the leaf was previously empty in the state

0 commit comments

Comments
 (0)