vielite's blog

QA-06: Unchecked Subtraction in Emptying Transaction Threshold Can Underflow

March 28, 2026
0 min read
Table of Contents
monad-qa-06-unchecked-subtraction

Summary

The emptying-transaction threshold subtracts 1 from execution_delay without guarding the case where execution_delay == 0.

Vulnerability details

2025-09-monad/bft/monad-eth-block-policy/src/lib.rs
let blocks_since_latest_txn = SeqNum(
block_seq_num_of_curr_txn
.0
.saturating_sub(balance_state.block_seqnum_of_latest_txn.0),
);
!balance_state.is_delegated && blocks_since_latest_txn > execution_delay - SeqNum(1)

Impact

Because SeqNum subtraction panics on underflow, a zero execution delay can crash the path on an otherwise valid block.

Recommendation

Rewrite the comparison so it does not rely on execution_delay - 1, or clamp the minimum allowed delay at construction time.