Skip to main content

EXPIRING_NONCE_GAS

Constant EXPIRING_NONCE_GAS 

Source
pub const EXPIRING_NONCE_GAS: u64 = _; // 13_000u64
Expand description

Gas cost for expiring nonce transactions (replay check + insert).

See TIP-1009 for full specification.

Operations charged:

  • 2 cold SLOADs: seen[tx_hash], ring[idx] (unique slots per tx)
  • 1 warm SLOAD: seen[old_hash] (warm because we just read ring[idx] which points to it)
  • 3 SSTOREs at RESET price: seen[old_hash]=0, ring[idx]=tx_hash, seen[tx_hash]=valid_before

Excluded from gas calculation:

  • ring_ptr SLOAD/SSTORE: Accessed by almost every expiring nonce tx in a block, so amortized cost approaches ~200 gas. May be moved out of EVM storage in the future.

Why SSTORE_RESET (2,900) instead of SSTORE_SET (20,000) for seen[tx_hash]:

  • SSTORE_SET cost exists to penalize permanent state growth
  • Expiring nonce data is ephemeral: evicted within 30 seconds, fixed-size buffer (300k)
  • No permanent state growth, so the 20k penalty doesn’t apply

Total: 22100 + 100 + 32900 = 13,000 gas