core/tracing: add InvalidEoF hook

This commit is contained in:
Marius van der Wijden 2025-02-07 09:28:50 +01:00
parent d227a8d086
commit 1846cc9ef4
2 changed files with 5 additions and 1 deletions

View file

@ -491,7 +491,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
// gas for initcode execution is not consumed.
// Only intrinsic creation transaction costs are charged.
if errors.Is(vmerr, vm.ErrInvalidEOFInitcode) {
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1)
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1, tracing.NonceChangeInvalidEOF)
}
} else {
// Increment the nonce for the next transaction.

View file

@ -367,4 +367,8 @@ const (
// NonceChangeRevert is emitted when the nonce is reverted back to a previous value due to call failure.
// It is only emitted when the tracer has opted in to use the journaling wrapper (WrapWithJournal).
NonceChangeRevert NonceChangeReason = 6
// NonceChangeInvalidEOF is emitted when the nonce is changed when a new contract is created,
// but the creation fails because of an EOF error.
NonceChangeInvalidEOF NonceChangeReason = 6
)