Skip to content

Commit 6ae3afd

Browse files
committed
feat(fast-inbox): single variable-size InboxParity proof per checkpoint (A-1427)
Replaces the parity base (×4) + parity root fan-in with **one variable-size `InboxParity<S>` proof per checkpoint**, S ∈ {64, 256, 1024} (one VK per size; the prover proves the smallest rung ≥ the checkpoint's message count). The parity-root circuit is deleted; the checkpoint root keeps a single parity verification, now accepting the 3-rung VK ladder. Net **+1 VK**. Stacked on #24612 (`spl/a-1375-msgs-only-block`). - **`in_hash` unconstrained pass-through.** The circuit no longer builds the sha256 frontier tree. `in_hash` stays in the parity public inputs as an unconstrained hint — the orchestrator supplies the true frontier root via `computeInHashFromL1ToL2Messages`, the circuit echoes it out, and the checkpoint root copies it into the header. L1's `require(header.inHash == inbox.consume())` still passes, so **no L1 changes** (`ConstantsGen.sol` regenerates byte-identical to the base). - **Sponge real-count decoupling.** Block roots absorb the message sponge at the real count while the L1-to-L2 tree insert stays a padded fixed subtree, via a new `L1ToL2MessageBundle { messages, num_msgs, num_real_msgs }` struct so the real count can be dropped later with minimal change. `num_msgs` is not otherwise pinned in-circuit — documented as a dev-mode gap backstopped by the L1 pending-chain header hash, parallel to `in_hash`. Threads the single sized proof through the orchestrator, bb-prover, proving broker, and TS bindings — collapsing `getBaseParityProof`/`getRootParityProof` into `getInboxParityProof` and `PARITY_BASE`/`PARITY_ROOT` into one `INBOX_PARITY` request type. The UltraHonk parity benchmark and bb.js debug test move to `InboxParity256`. - `rollup_lib` nargo suite: 387/387 passing. - Reviewed by a second model (Fable) and codex sol; their build-break and consistency findings are folded in. - Full `yarn build`, VK/artifact regen, real proofs, and e2e run in CI (blocked locally by a `bb write_vk` memory-arena OOM on the unchanged `rollup_root` circuit). `inbox_rolling_hash.nr`'s doc comment claims the sha256 chain "matches the L1 Inbox," but `Inbox.sol` accumulates `bytes16(keccak256(...))`. Harmless today (the rolling hash isn't validated on L1), but the comment should be corrected on the base branch. The oldest-epoch-first proving-broker scheduling fix that previously headed this branch has been moved down to #24603 (A-1374), where it is required to keep `long_proving_time` green on the intermediate stack. The stack top is unchanged — only the commit's position changed. Replaces #24759.
1 parent d042fd3 commit 6ae3afd

107 files changed

Lines changed: 6503 additions & 7033 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

noir-projects/fnd/noir-protocol-circuits/Nargo.template.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ members = [
88
"crates/types",
99
"crates/protocol-test-utils",
1010
"crates/blob",
11-
"crates/parity-base",
12-
"crates/parity-root",
11+
"crates/inbox-parity-64",
12+
"crates/inbox-parity-256",
13+
"crates/inbox-parity-1024",
1314
"crates/private-kernel-lib",
1415
"crates/private-kernel-init",
1516
"crates/private-kernel-init-2",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "inbox_parity_1024"
3+
type = "bin"
4+
authors = [""]
5+
compiler_version = ">=0.18.0"
6+
7+
[dependencies]
8+
rollup_lib = { path = "../rollup-lib" }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use rollup_lib::parity::{inbox_parity, InboxParityPrivateInputs, ParityPublicInputs};
2+
3+
fn main(inputs: InboxParityPrivateInputs<1024>) -> pub ParityPublicInputs {
4+
inbox_parity::execute(inputs)
5+
}

noir-projects/fnd/noir-protocol-circuits/crates/parity-root/Nargo.toml renamed to noir-projects/fnd/noir-protocol-circuits/crates/inbox-parity-256/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "parity_root"
2+
name = "inbox_parity_256"
33
type = "bin"
44
authors = [""]
55
compiler_version = ">=0.18.0"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use rollup_lib::parity::{inbox_parity, InboxParityPrivateInputs, ParityPublicInputs};
2+
3+
fn main(inputs: InboxParityPrivateInputs<256>) -> pub ParityPublicInputs {
4+
inbox_parity::execute(inputs)
5+
}

noir-projects/fnd/noir-protocol-circuits/crates/parity-base/Nargo.toml renamed to noir-projects/fnd/noir-protocol-circuits/crates/inbox-parity-64/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "parity_base"
2+
name = "inbox_parity_64"
33
type = "bin"
44
authors = [""]
55
compiler_version = ">=0.18.0"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use rollup_lib::parity::{inbox_parity, InboxParityPrivateInputs, ParityPublicInputs};
2+
3+
fn main(inputs: InboxParityPrivateInputs<64>) -> pub ParityPublicInputs {
4+
inbox_parity::execute(inputs)
5+
}

noir-projects/fnd/noir-protocol-circuits/crates/parity-base/src/main.nr

Lines changed: 0 additions & 5 deletions
This file was deleted.

noir-projects/fnd/noir-protocol-circuits/crates/parity-root/src/main.nr

Lines changed: 0 additions & 5 deletions
This file was deleted.

noir-projects/fnd/noir-protocol-circuits/crates/protocol-test-utils/src/fixtures/vk_tree.nr

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use crate::utils::pad_end;
22
use types::{
33
constants::{
44
BLOCK_ROOT_MSGS_ONLY_ROLLUP_VK_INDEX, HIDING_KERNEL_TO_PUBLIC_VK_INDEX,
5-
MEGA_KERNEL_VK_LENGTH_IN_FIELDS, PARITY_BASE_VK_INDEX, PARITY_ROOT_VK_INDEX,
6-
PRIVATE_KERNEL_INIT_2_VK_INDEX, PRIVATE_KERNEL_INIT_3_VK_INDEX,
5+
INBOX_PARITY_1024_VK_INDEX, INBOX_PARITY_256_VK_INDEX, INBOX_PARITY_64_VK_INDEX,
6+
MEGA_KERNEL_VK_LENGTH_IN_FIELDS, PRIVATE_KERNEL_INIT_2_VK_INDEX,
7+
PRIVATE_KERNEL_INIT_3_VK_INDEX,
78
PRIVATE_KERNEL_INIT_4_VK_INDEX, PRIVATE_KERNEL_INIT_5_VK_INDEX,
89
PRIVATE_KERNEL_INNER_2_VK_INDEX, PRIVATE_KERNEL_INNER_3_VK_INDEX,
910
PRIVATE_KERNEL_INNER_4_VK_INDEX, PRIVATE_KERNEL_INNER_5_VK_INDEX,
@@ -80,9 +81,12 @@ pub global VK_MERKLE_TREE: MerkleTree<VK_TREE_WIDTH> = {
8081
}
8182

8283
// Honk
83-
// Override some of the above with Honk Vks.
84-
leaves[PARITY_BASE_VK_INDEX] = generate_fake_honk_vk_for_index(PARITY_BASE_VK_INDEX).hash;
85-
leaves[PARITY_ROOT_VK_INDEX] = generate_fake_honk_vk_for_index(PARITY_ROOT_VK_INDEX).hash;
84+
// The inbox parity ladder circuits are plain UltraHonk (not rollup-honk) and live past the reset range.
85+
leaves[INBOX_PARITY_64_VK_INDEX] = generate_fake_honk_vk_for_index(INBOX_PARITY_64_VK_INDEX).hash;
86+
leaves[INBOX_PARITY_256_VK_INDEX] =
87+
generate_fake_honk_vk_for_index(INBOX_PARITY_256_VK_INDEX).hash;
88+
leaves[INBOX_PARITY_1024_VK_INDEX] =
89+
generate_fake_honk_vk_for_index(INBOX_PARITY_1024_VK_INDEX).hash;
8690
leaves[ROOT_ROLLUP_VK_INDEX] = generate_fake_honk_vk_for_index(ROOT_ROLLUP_VK_INDEX).hash;
8791

8892
MerkleTree::new(leaves)

0 commit comments

Comments
 (0)