From 8550917875bc2bf2c623cf002402915dceaa8493 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Wed, 25 Sep 2024 20:46:17 +0200 Subject: [PATCH] fix: warm storage cost for basic data and code hash --- core/state/access_witness.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/state/access_witness.go b/core/state/access_witness.go index 9261f1ea0272..bbcae5148b90 100644 --- a/core/state/access_witness.go +++ b/core/state/access_witness.go @@ -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 } @@ -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 }