# Signatures for the first batch will be rejected by VerifyVoteExtensionHandler

Off-by-one in VerifyVoteExtensionHandler's first-batch check causes validator batch signatures for batch 1 to be rejected, blocking first batch signing.

- Payout: Audit contest
- Severity: medium
- Program: Seda Protocol
- Found by: zxriptor
- Disclosed: 2024-12-20
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/188
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-12-seda-protocol%3AM-5
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:go technique:source-review vuln:business-logic

**Target:** seda-chain ABCI VerifyVoteExtensionHandler / batching keeper
**Root cause:** Batch numbering starts at collections.DefaultSequenceStart+1, but the cold-start branch checks batchNum == collections.DefaultSequenceStart, so the first batch falls into the else branch and looks up a nonexistent previous validator tree entry.
**Steps:**
1. Observe batching endblock sets newBatchNum = collections.DefaultSequenceStart + 1 for the first batch.
2. In verifyBatchSignatures, the cold-start branch is guarded by `if batchNum == collections.DefaultSequenceStart`.
3. For batch 1, condition is false, so code calls GetValidatorTreeEntry(ctx, batchNum-1, valOper) which returns ErrNotFound.
4. With non-empty voteExtension, returns ErrUnexpectedBatchSignature, rejecting the first batch's signatures.
**How found:** Code reading of the batch numbering in endblock.go versus the cold-start condition in handlers.go revealed the off-by-one mismatch.
**Insight:** When a sequence has a special first-element case, cross-check the sentinel/start constant against where the sequence is actually initialized; off-by-one between DefaultSequenceStart and DefaultSequenceStart+1 silently disables cold-start branches.

