Skip to content

fix(p2p): avoid 32-bit overflow in attestation pool block position key#22412

Merged
ludamad merged 1 commit into
merge-train/spartanfrom
spy/a-760-attestation-pool-bit-shift-overflow
Apr 9, 2026
Merged

fix(p2p): avoid 32-bit overflow in attestation pool block position key#22412
ludamad merged 1 commit into
merge-train/spartanfrom
spy/a-760-attestation-pool-bit-shift-overflow

Conversation

@spypsy

@spypsy spypsy commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace bit-shift (<<) with multiplication in AttestationPool.getBlockPositionKey to prevent 32-bit signed integer overflow on large slot numbers. JavaScript's << converts operands to signed 32-bit ints, which overflows after slot ~2^21. Using multiplication keeps values in float64 range (safe up to 2^53).

Fixes A-760

Replace bit-shift with multiplication in getBlockPositionKey to prevent
32-bit signed integer overflow on large slot numbers.

Made-with: Cursor
@ludamad ludamad merged commit 6b698ee into merge-train/spartan Apr 9, 2026
14 checks passed
@ludamad ludamad deleted the spy/a-760-attestation-pool-bit-shift-overflow branch April 9, 2026 23:12
github-merge-queue Bot pushed a commit that referenced this pull request Apr 10, 2026
BEGIN_COMMIT_OVERRIDE
fix(stdlib): use bigint arithmetic in GasFees.mul() for non-integer
scalars (#22383)
fix(node-lib): reuse existing fileStore in snapshot sync instead of
recreating (#22375)
fix: gate req/resp data protocols for unauthenticated peers (#22406)
fix(p2p): use per-batch ops array in AztecDatastore.batch() (#22357)
chore(pipeline): spartan config (#21285)
chore: add claude skill to send txs (#22439)
feat(pipeline): minimize deadzone w cross slot attesting (#21435)
fix(p2p): avoid 32-bit overflow in attestation pool block position key
(#22412)
fix(prover-client): increment retry count on timeout re-enqueue to
prevent infinite loop (#22355)
fix: remove redundant p2pClient.start() call (#22438)
chore: add kubectl binary to spartan .gitignore (#22454)
END_COMMIT_OVERRIDE
critesjosh pushed a commit that referenced this pull request Apr 14, 2026
#22412)

## Summary
- Replace bit-shift (`<<`) with multiplication in
`AttestationPool.getBlockPositionKey` to prevent 32-bit signed integer
overflow on large slot numbers. JavaScript's `<<` converts operands to
signed 32-bit ints, which overflows after slot ~2^21. Using
multiplication keeps values in float64 range (safe up to 2^53).

Fixes
[A-760](https://linear.app/aztec-labs/issue/A-760/audit-91-attestationpoolgetblockpositionkey-bit-shift-overflow-after)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants