mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
core: force add new delegation to accesslist
This commit is contained in:
parent
75a43aed6c
commit
183e7b702a
3 changed files with 11 additions and 5 deletions
|
|
@ -1409,10 +1409,12 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
|
|||
al.AddAddress(sender)
|
||||
if dst != nil {
|
||||
al.AddAddress(*dst)
|
||||
// TODO: is this right?
|
||||
if rules.IsPrague {
|
||||
// Add delegation target
|
||||
if addr, ok := types.ParseDelegation(s.GetCode(*dst)); ok {
|
||||
al.AddAddress(addr)
|
||||
}
|
||||
}
|
||||
// If it's a create-tx, the destination will be added inside evm.create
|
||||
}
|
||||
for _, addr := range precompiles {
|
||||
|
|
|
|||
|
|
@ -495,6 +495,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
|||
if exists := st.state.Exist(authority); exists {
|
||||
st.state.AddRefund(params.CallNewAccountGas - params.TxAuthTupleGas)
|
||||
}
|
||||
// Special case, when msg.To is to an authority being set in the tx, we
|
||||
// need to add it to the access list. Usually this happens in StateDB
|
||||
// Prepare(..).
|
||||
if st.msg.To != nil && *st.msg.To == authority {
|
||||
st.state.AddAddressToAccessList(auth.Address)
|
||||
}
|
||||
st.state.SetNonce(authority, auth.Nonce+1)
|
||||
st.state.SetCode(authority, types.AddressToDelegation(auth.Address))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,12 +328,10 @@ func gasEip7702CodeCheck(evm *EVM, contract *Contract, stack *Stack, mem *Memory
|
|||
if evm.StateDB.AddressInAccessList(addr) {
|
||||
cost += params.WarmStorageReadCostEIP2929
|
||||
} else {
|
||||
// fmt.Println("adding ", addr, "to acl")
|
||||
evm.StateDB.AddAddressToAccessList(addr)
|
||||
cost += params.ColdAccountAccessCostEIP2929
|
||||
}
|
||||
}
|
||||
// fmt.Println("cost is", cost)
|
||||
return cost, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue