Skip to content

Commit 555d520

Browse files
authored
fix(giga): bail on wrong nonce as v2 does (#2963)
## Describe your changes and provide context Reopening #2877 against main fixes mismatch of [this block](https://seiscan.io/txs?block=193119398). there are 2 txs (don't show up on seiscan) that have invalid nonces: ``` V2's log: "nonce too high: address 0x6a9dE37D180C56b7E9362d7688ACa8B7acEb425C, tx: 23213 state: 23211" V2's log: "nonce too high: address 0x4A7d9e41340d1dba4d157fdE37Ed1697E42CBC7b, tx: 7423188 state: 7423187" ``` In this case we just bail WITHOUT bumping the nonce. ## Testing performed to validate your change tests pass, get us past the block in question.
1 parent c06d478 commit 555d520

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

app/app.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,24 @@ func (app *App) executeEVMTxWithGigaExecutor(ctx sdk.Context, msg *evmtypes.MsgE
17461746

17471747
_, isAssociated := app.GigaEvmKeeper.GetEVMAddress(ctx, seiAddr)
17481748

1749+
// ============================================================================
1750+
// Nonce validation (mirrors V2's ante handler check in x/evm/ante/sig.go)
1751+
// V2 rejects with ErrWrongSequence if txNonce != expectedNonce, with NO state changes.
1752+
// ============================================================================
1753+
expectedNonce := app.GigaEvmKeeper.GetNonce(ctx, sender)
1754+
txNonce := ethTx.Nonce()
1755+
if txNonce != expectedNonce {
1756+
nonceDirection := "too high"
1757+
if txNonce < expectedNonce {
1758+
nonceDirection = "too low"
1759+
}
1760+
return &abci.ExecTxResult{
1761+
Code: sdkerrors.ErrWrongSequence.ABCICode(),
1762+
GasWanted: int64(ethTx.Gas()), //nolint:gosec
1763+
Log: fmt.Sprintf("nonce %s: address %s, tx: %d state: %d: %s", nonceDirection, sender.Hex(), txNonce, expectedNonce, sdkerrors.ErrWrongSequence.Error()),
1764+
}, nil
1765+
}
1766+
17491767
// ============================================================================
17501768
// Fee validation (mirrors V2's ante handler checks in evm_checktx.go)
17511769
// NOTE: In V2, failed transactions still increment nonce and charge gas.

0 commit comments

Comments
 (0)