Test replay protection in a native ZKsync smart account

A native smart account can verify a signature correctly and still fail the transaction validation pipeline. The protocol checks that the chosen nonce is consumed during the account’s validation phase.

Exercise the precheck and postcheck

On a local EraVM-compatible test environment, submit a signed request for unused nonce N through the account flow. Inspect validation and the NonceHolder interaction. Marking a private contract mapping alone need not satisfy the system nonce check.

before validation: nonce N unused
validateTransaction: authenticate request and mark N used
post-validation check: nonce N must be used

Test a valid request, a repeated request and an invalid signature separately. After successful acceptance the replay must fail. If a separately invoked validation function returns success, that alone has not exercised the bootloader’s surrounding nonce checks.

Match the account’s supported nonce policy

Use the documented system-call mechanism and actual account nonce policy. Protocol capabilities and mempool ordering support can differ. Keep deployment nonce accounting separate from replay protection for submitted account transactions. docs.zksync.io ZKsync documentation