Skip to content

Commit

Permalink
fix: return wanted in TouchBasicData gas functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Sep 25, 2024
1 parent 8550917 commit 0ab43bc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/state/access_witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,23 +284,23 @@ func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, s
}

func (aw *AccessWitness) TouchBasicData(addr []byte, isWrite bool, availableGas uint64, warmCostCharging bool) uint64 {
chargedGas, wanted := aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, isWrite, availableGas)
_, wanted := aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.BasicDataLeafKey, isWrite, availableGas)
if wanted == 0 && warmCostCharging {
if availableGas < params.WarmStorageReadCostEIP2929 {
return availableGas
}
chargedGas = params.WarmStorageReadCostEIP2929
wanted = params.WarmStorageReadCostEIP2929
}
return chargedGas
return wanted
}

func (aw *AccessWitness) TouchCodeHash(addr []byte, isWrite bool, availableGas uint64) uint64 {
chargedGas, wanted := aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeHashLeafKey, isWrite, availableGas)
_, wanted := aw.touchAddressAndChargeGas(addr, zeroTreeIndex, utils.CodeHashLeafKey, isWrite, availableGas)
if wanted == 0 {
if availableGas < params.WarmStorageReadCostEIP2929 {
return availableGas
}
chargedGas = params.WarmStorageReadCostEIP2929
wanted = params.WarmStorageReadCostEIP2929
}
return chargedGas
return wanted
}

0 comments on commit 0ab43bc

Please sign in to comment.