mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-01 07:35:58 +00:00
fix errors from rebase
This commit is contained in:
parent
dfd2e44701
commit
6610c2b3cc
3 changed files with 2 additions and 47 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue