mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
core: refactor non-create processing flow
This commit is contained in:
parent
9ee0d10421
commit
f4b5798ba3
1 changed files with 21 additions and 26 deletions
|
|
@ -464,32 +464,6 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
// - reset transient storage(eip 1153)
|
// - reset transient storage(eip 1153)
|
||||||
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)
|
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)
|
||||||
|
|
||||||
if !contractCreation {
|
|
||||||
// Increment the nonce for the next transaction.
|
|
||||||
// Note: EIP-7702 authorizations can also modify the nonce. We perform
|
|
||||||
// this update first to ensure correct validation of authorization nonces.
|
|
||||||
st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply EIP-7702 authorizations.
|
|
||||||
if msg.AuthList != nil {
|
|
||||||
for _, auth := range msg.AuthList {
|
|
||||||
// Note errors are ignored, we simply skip invalid authorizations here.
|
|
||||||
st.applyAuthorization(msg, &auth)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !contractCreation {
|
|
||||||
if addr, ok := types.ParseDelegation(st.state.GetCode(*msg.To)); ok {
|
|
||||||
// Perform convenience warming of sender's delegation target. Although the
|
|
||||||
// sender is already warmed in Prepare(..), it's possible a delegation to
|
|
||||||
// the account was deployed during this transaction. To handle correctly,
|
|
||||||
// wait until the final state of delegations is determined before
|
|
||||||
// performing the resolution and warming.
|
|
||||||
st.state.AddAddressToAccessList(addr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ret []byte
|
ret []byte
|
||||||
vmerr error // vm errors do not effect consensus and are therefore not assigned to err
|
vmerr error // vm errors do not effect consensus and are therefore not assigned to err
|
||||||
|
|
@ -497,6 +471,27 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
if contractCreation {
|
if contractCreation {
|
||||||
ret, _, st.gasRemaining, vmerr = st.evm.Create(sender, msg.Data, st.gasRemaining, value)
|
ret, _, st.gasRemaining, vmerr = st.evm.Create(sender, msg.Data, st.gasRemaining, value)
|
||||||
} else {
|
} else {
|
||||||
|
// Increment the nonce for the next transaction.
|
||||||
|
st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1)
|
||||||
|
|
||||||
|
// Apply EIP-7702 authorizations.
|
||||||
|
if msg.AuthList != nil {
|
||||||
|
for _, auth := range msg.AuthList {
|
||||||
|
// Note errors are ignored, we simply skip invalid authorizations here.
|
||||||
|
st.applyAuthorization(msg, &auth)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform convenience warming of sender's delegation target. Although the
|
||||||
|
// sender is already warmed in Prepare(..), it's possible a delegation to
|
||||||
|
// the account was deployed during this transaction. To handle correctly,
|
||||||
|
// simply wait until the final state of delegations is determined before
|
||||||
|
// performing the resolution and warming.
|
||||||
|
if addr, ok := types.ParseDelegation(st.state.GetCode(*msg.To)); ok {
|
||||||
|
st.state.AddAddressToAccessList(addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the transaction's call.
|
||||||
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, value)
|
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue