Skip to content

Commit 183e7b7

Browse files
committed
core: force add new delegation to accesslist
1 parent 75a43ae commit 183e7b7

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

core/state/statedb.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,9 +1409,11 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
14091409
al.AddAddress(sender)
14101410
if dst != nil {
14111411
al.AddAddress(*dst)
1412-
// TODO: is this right?
1413-
if addr, ok := types.ParseDelegation(s.GetCode(*dst)); ok {
1414-
al.AddAddress(addr)
1412+
if rules.IsPrague {
1413+
// Add delegation target
1414+
if addr, ok := types.ParseDelegation(s.GetCode(*dst)); ok {
1415+
al.AddAddress(addr)
1416+
}
14151417
}
14161418
// If it's a create-tx, the destination will be added inside evm.create
14171419
}

core/state_transition.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
495495
if exists := st.state.Exist(authority); exists {
496496
st.state.AddRefund(params.CallNewAccountGas - params.TxAuthTupleGas)
497497
}
498+
// Special case, when msg.To is to an authority being set in the tx, we
499+
// need to add it to the access list. Usually this happens in StateDB
500+
// Prepare(..).
501+
if st.msg.To != nil && *st.msg.To == authority {
502+
st.state.AddAddressToAccessList(auth.Address)
503+
}
498504
st.state.SetNonce(authority, auth.Nonce+1)
499505
st.state.SetCode(authority, types.AddressToDelegation(auth.Address))
500506
}

core/vm/operations_acl.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,10 @@ func gasEip7702CodeCheck(evm *EVM, contract *Contract, stack *Stack, mem *Memory
328328
if evm.StateDB.AddressInAccessList(addr) {
329329
cost += params.WarmStorageReadCostEIP2929
330330
} else {
331-
// fmt.Println("adding ", addr, "to acl")
332331
evm.StateDB.AddAddressToAccessList(addr)
333332
cost += params.ColdAccountAccessCostEIP2929
334333
}
335334
}
336-
// fmt.Println("cost is", cost)
337335
return cost, nil
338336
}
339337

0 commit comments

Comments
 (0)