Skip to content

Commit

Permalink
fix: warm storage cost for basic data and code hash
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Sep 25, 2024
1 parent 2ef884e commit 8550917
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/state/access_witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ func (aw *AccessWitness) TouchCodeChunksRangeAndChargeGas(contractAddr []byte, s
}

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

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

0 comments on commit 8550917

Please sign in to comment.