From 6610c2b3cc7c6c94b4b567db9e241af1250d6393 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 17 Oct 2025 13:39:44 +0800 Subject: [PATCH] fix errors from rebase --- core/tracing/journal.go | 12 ------------ core/types/bal/bal.go | 5 ++--- core/vm/operations_acl.go | 32 -------------------------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/core/tracing/journal.go b/core/tracing/journal.go index b7ee8f23e2..87d1d2ad7d 100644 --- a/core/tracing/journal.go +++ b/core/tracing/journal.go @@ -152,18 +152,6 @@ func (j *journal) OnExit(depth int, output []byte, gasUsed uint64, err error, re } } -func (j *journal) OnColdStorageLoad(address common.Address, key common.Hash) { - if j.hooks.OnColdStorageRead != nil { - j.hooks.OnColdStorageRead(address, key) - } -} - -func (j *journal) OnColdAccountLoad(address common.Address) { - if j.hooks.OnColdAccountRead != nil { - j.hooks.OnColdAccountRead(address) - } -} - func (j *journal) OnBalanceChange(addr common.Address, prev, new *big.Int, reason BalanceChangeReason) { j.entries = append(j.entries, balanceChange{ addr: addr, diff --git a/core/types/bal/bal.go b/core/types/bal/bal.go index 93e7804de7..fa1f26f590 100644 --- a/core/types/bal/bal.go +++ b/core/types/bal/bal.go @@ -449,10 +449,9 @@ func (c *constructionAccountAccess) StorageRead(key common.Hash) { if c.storageReads == nil { c.storageReads = make(map[common.Hash]struct{}) } - if _, ok := c.storageMutations[key]; ok { - panic("FUCK") + if _, ok := c.storageMutations[key]; !ok { + c.storageReads[key] = struct{}{} } - c.storageReads[key] = struct{}{} } func (c *constructionAccountAccess) StorageWrite(key, prevVal, newVal common.Hash) { diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index df1b5c9b8f..669c8b2a34 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -43,12 +43,6 @@ func makeGasSStoreFunc(clearingRefund uint64) gasFunc { cost = params.ColdSloadCostEIP2929 // If the caller cannot afford the cost, this change will be rolled back evm.StateDB.AddSlotToAccessList(contract.Address(), slot) - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdStorageRead != nil { - // TODO: should these only be called if the cold storage read didn't go OOG? - // it's harder to implement, but I lean towards "yes". - // need to clarify this in the spec. - evm.Config.Tracer.OnColdStorageRead(contract.Address(), slot) - } } value := common.Hash(y.Bytes32()) @@ -108,12 +102,6 @@ func gasSLoadEIP2929(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me // If the caller cannot afford the cost, this change will be rolled back // If he does afford it, we can skip checking the same thing later on, during execution evm.StateDB.AddSlotToAccessList(contract.Address(), slot) - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdStorageRead != nil { - // TODO: should these only be called if the cold storage read didn't go OOG? - // it's harder to implement, but I lean towards "yes". - // need to clarify this in the spec. - evm.Config.Tracer.OnColdStorageRead(contract.Address(), slot) - } return params.ColdSloadCostEIP2929, nil } return params.WarmStorageReadCostEIP2929, nil @@ -135,11 +123,6 @@ func gasExtCodeCopyEIP2929(evm *EVM, contract *Contract, stack *Stack, mem *Memo if !evm.StateDB.AddressInAccessList(addr) { evm.StateDB.AddAddressToAccessList(addr) - // TODO: same issue as OnColdSStorageRead. See the TODO above near OnColdStorageRead - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(addr) - } - var overflow bool // We charge (cold-warm), since 'warm' is already charged as constantGas if gas, overflow = math.SafeAdd(gas, params.ColdAccountAccessCostEIP2929-params.WarmStorageReadCostEIP2929); overflow { @@ -161,9 +144,6 @@ func gasEip2929AccountCheck(evm *EVM, contract *Contract, stack *Stack, mem *Mem addr := common.Address(stack.peek().Bytes20()) // Check slot presence in the access list if !evm.StateDB.AddressInAccessList(addr) { - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(addr) - } // If the caller cannot afford the cost, this change will be rolled back evm.StateDB.AddAddressToAccessList(addr) // The warm storage read cost is already charged as constantGas @@ -181,9 +161,6 @@ func makeCallVariantGasCallEIP2929(oldCalculator gasFunc, addressPosition int) g // the cost to charge for cold access, if any, is Cold - Warm coldCost := params.ColdAccountAccessCostEIP2929 - params.WarmStorageReadCostEIP2929 if !warmAccess { - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(addr) - } evm.StateDB.AddAddressToAccessList(addr) // Charge the remaining difference here already, to correctly calculate available // gas for call @@ -250,9 +227,6 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { address = common.Address(stack.peek().Bytes20()) ) if !evm.StateDB.AddressInAccessList(address) { - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(address) - } // If the caller cannot afford the cost, this change will be rolled back evm.StateDB.AddAddressToAccessList(address) gas = params.ColdAccountAccessCostEIP2929 @@ -285,9 +259,6 @@ func makeCallVariantGasCallEIP7702(oldCalculator gasFunc) gasFunc { // Check slot presence in the access list if !evm.StateDB.AddressInAccessList(addr) { - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(addr) - } evm.StateDB.AddAddressToAccessList(addr) // The WarmStorageReadCostEIP2929 (100) is already deducted in the form of a constant cost, so // the cost to charge for cold access, if any, is Cold - Warm @@ -306,9 +277,6 @@ func makeCallVariantGasCallEIP7702(oldCalculator gasFunc) gasFunc { if evm.StateDB.AddressInAccessList(target) { cost = params.WarmStorageReadCostEIP2929 } else { - if evm.Config.Tracer != nil && evm.Config.Tracer.OnColdAccountRead != nil { - evm.Config.Tracer.OnColdAccountRead(target) - } evm.StateDB.AddAddressToAccessList(target) cost = params.ColdAccountAccessCostEIP2929 }