Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,28 @@ func (app *App) executeEVMTxWithGigaExecutor(ctx sdk.Context, msg *evmtypes.MsgE
}
}

// ============================================================================
// Nonce validation (mirrors V2's ante handler check in x/evm/ante/sig.go)
// V2 rejects with ErrWrongSequence if txNonce != expectedNonce, with NO state changes.
// ============================================================================
expectedNonce := app.GigaEvmKeeper.GetNonce(ctx, sender)
txNonce := ethTx.Nonce()
if txNonce != expectedNonce {
// Calculate intrinsic gas for reporting (V2 reports this as gasUsed)
intrinsicGas, _ := core.IntrinsicGas(ethTx.Data(), ethTx.AccessList(), ethTx.SetCodeAuthorizations(), ethTx.To() == nil, true, true, true)

nonceDirection := "too high"
if txNonce < expectedNonce {
nonceDirection = "too low"
}
return &abci.ExecTxResult{
Code: sdkerrors.ErrWrongSequence.ABCICode(),
GasUsed: int64(intrinsicGas), //nolint:gosec
GasWanted: int64(ethTx.Gas()), //nolint:gosec
Log: fmt.Sprintf("nonce %s: address %s, tx: %d state: %d: %s", nonceDirection, sender.Hex(), txNonce, expectedNonce, sdkerrors.ErrWrongSequence.Error()),
}, nil
}

// ============================================================================
// Fee validation (mirrors V2's ante handler checks in evm_checktx.go)
// NOTE: In V2, failed transactions still increment nonce and charge gas.
Expand Down
Loading