Skip to content

Commit

Permalink
core: more comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Dec 2, 2024
1 parent 0f1a4e5 commit cdf9e53
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,13 @@ func (st *stateTransition) applyAuthorization(msg *Message, auth *types.Authoriz
// Otherwise install delegation to auth.Address.
st.state.SetCode(authority, types.AddressToDelegation(auth.Address))

// Usually the delegation target is added to the access list in statedb.Prepare(..).
// However if the destination address of the transaction is an EOA, and the EOA gains
// a new delegation in the same transaction, we need to explicitly add the delegation
// address here since Prepare has already happened.
// If an account has a code delegation to another account, that account will be added to
// the access list in statedb.Prepare(..).
//
// However if the destination address of the transaction (msg) gains a new delegation
// in this same transaction, we need to explicitly warm the delegation address here,
// since Prepare has already happened. The intention here is to behave as if the
// delegation was already present before calling Prepare.
if *msg.To == authority {
st.state.AddAddressToAccessList(auth.Address)
}
Expand Down

0 comments on commit cdf9e53

Please sign in to comment.