mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12: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,9 +1409,11 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
|
||||||
al.AddAddress(sender)
|
al.AddAddress(sender)
|
||||||
if dst != nil {
|
if dst != nil {
|
||||||
al.AddAddress(*dst)
|
al.AddAddress(*dst)
|
||||||
// TODO: is this right?
|
if rules.IsPrague {
|
||||||
if addr, ok := types.ParseDelegation(s.GetCode(*dst)); ok {
|
// Add delegation target
|
||||||
al.AddAddress(addr)
|
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
|
// If it's a create-tx, the destination will be added inside evm.create
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
||||||
if exists := st.state.Exist(authority); exists {
|
if exists := st.state.Exist(authority); exists {
|
||||||
st.state.AddRefund(params.CallNewAccountGas - params.TxAuthTupleGas)
|
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.SetNonce(authority, auth.Nonce+1)
|
||||||
st.state.SetCode(authority, types.AddressToDelegation(auth.Address))
|
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) {
|
if evm.StateDB.AddressInAccessList(addr) {
|
||||||
cost += params.WarmStorageReadCostEIP2929
|
cost += params.WarmStorageReadCostEIP2929
|
||||||
} else {
|
} else {
|
||||||
// fmt.Println("adding ", addr, "to acl")
|
|
||||||
evm.StateDB.AddAddressToAccessList(addr)
|
evm.StateDB.AddAddressToAccessList(addr)
|
||||||
cost += params.ColdAccountAccessCostEIP2929
|
cost += params.ColdAccountAccessCostEIP2929
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fmt.Println("cost is", cost)
|
|
||||||
return cost, nil
|
return cost, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue