Skip to content

feat(circuits): add InboxParity variants for size 4 and 16 - #25463

Open
spalladino wants to merge 2 commits into
spl/fi2-b3-inbox-endpoint-preflightfrom
spl/fi2-b4-inbox-parity-rungs
Open

feat(circuits): add InboxParity variants for size 4 and 16#25463
spalladino wants to merge 2 commits into
spl/fi2-b3-inbox-endpoint-preflightfrom
spl/fi2-b4-inbox-parity-rungs

Conversation

@spalladino

Copy link
Copy Markdown
Contributor

The InboxParity size ladder starts at 64 messages, and that rung costs 578k
gates. One parity proof is produced per checkpoint, and the prover picks the
smallest rung that fits the checkpoint's real message count, so a checkpoint
carrying a handful of messages currently pays for 64 lanes it never fills. The
two rungs below 64 are far cheaper.

Measured with bb gates --scheme ultra_honk:

rung ACIR opcodes circuit size
4 4,596 39,297
16 17,700 147,161
64 70,116 578,633

This adds crates for sizes 4 and 16. Each is the same one-line
inbox_parity::execute wrapper the existing rungs use, just instantiated at a
smaller S, so there is no new circuit logic. They take VK indices 77 and 78,
which means the ladder is now allocated append-only and the indices no longer
follow the sizes; the comment in constants.nr says so. The checkpoint root's
allowed VK-index set widens from three entries to five, and the checkpoint-root
parity tests cover the two new indices against the fake VK tree.

The node side rides the foundation patch queue as labs-patches/0017:
INBOX_PARITY_SIZES grows to five entries (ascending, so pickInboxParitySize
keeps picking the smallest that fits with no further change), the two artifacts
join the server artifact union, the size-to-artifact map, the VK index map and
the plain-UltraHonk list in the bb-prover, and the codegen script emits their
input types.

The second commit, authored by Leila Wang and taken from #25422, drops a
redundant assertion in the block-root composer: append_leaves_to_snapshot
already rejects a message bundle with a non-zero lane past num_msgs and
bounds num_msgs by the array length, so asserting it again only added
constraints. It sits here rather than in the follow-up cleanup PR because
removing a constraint moves the block-root VK, and this PR already moves the VK
tree root. The PR carries ci-no-squash so that authorship survives the merge.

Adding protocol constants moves barretenberg's own build hash, so every
protocol-circuit VK is regenerated by this change. The committed Prover.toml
fixtures still solve as they are — each one carries its own vk_tree_root and
matching membership hints, so a moved tree root does not invalidate them — and
nargo execute was verified against rollup-block-root,
rollup-block-root-no-txs, rollup-checkpoint-root and
rollup-checkpoint-root-single-block.

Fixes A-1989

spalladino and others added 2 commits September 10, 2026 16:22
The InboxParity size ladder started at 64 messages, which costs 578k gates.
Most checkpoints carry far fewer messages than that, and the rungs below 64
are much cheaper: size 4 is 39k gates and size 16 is 147k. Adding them lets a
small checkpoint prove a circuit sized for its message count instead of paying
for 64 lanes it never fills.

The two new crates are the same one-line `inbox_parity::execute` wrapper the
existing rungs use, instantiated at sizes 4 and 16. They take VK indices 77
and 78: the ladder is allocated append-only, so from now on the indices no
longer follow the sizes. The checkpoint root's allowed VK-index set widens
from three entries to five, and the checkpoint-root parity tests cover the two
new indices.

The node side follows in `labs-patches/0017`: the ladder in
`INBOX_PARITY_SIZES`, the two artifacts in the server artifact union, the
size-to-artifact and VK-index maps, and the plain-UltraHonk list in the
bb-prover.

Gate counts from `bb gates --scheme ultra_honk`: 39,297 for size 4 and
147,161 for size 16, against 578,633 for size 64.
The block-root composer asserted the message bundle's padding lanes were zero
before appending them, but `append_leaves_to_snapshot` already rejects a
bundle with a non-zero lane past `num_msgs` (see its
`append_non_zero_padding_lane_fails` test) and bounds `num_msgs` by the array
length. Asserting it again only adds constraints.
@spalladino
spalladino force-pushed the spl/fi2-b4-inbox-parity-rungs branch from fb8a3ad to e78983a Compare September 10, 2026 19:38
@spalladino
spalladino added this pull request to stack #25470 September 10, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants