Skip to content

feat: miner aggregation support #131

Open
ethan-crypto wants to merge 4 commits into
mainfrom
miner-aggr
Open

feat: miner aggregation support #131
ethan-crypto wants to merge 4 commits into
mainfrom
miner-aggr

Conversation

@ethan-crypto

@ethan-crypto ethan-crypto commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Modifies layer-1 aggregation circuit constraints and public-input parsing, which can invalidate existing proofs/fixtures if the layout or invariants are wrong. Changes are well-scoped with added negative/ABI regression tests, but affect proof compatibility.

Overview
Adds first-class support for layer-1 aggregated proof public inputs: introduces Layer1AggregatedPublicCircuitInputs with an explicit header/slot/nullifier layout, robust shape validation, and comprehensive parser regression/negative tests.

Tightens the layer-1 aggregation circuit by enforcing block number consistency (in addition to block hash) across all child layer-0 proofs, plus a new negative test for mismatched block numbers.

Adds a generate_l1_fixture example that takes a full batch of L0 proof hex files, produces an L1 aggregate proof (.hex + .bin), and writes an expected_bundle.json derived from parsed L1 public inputs; verifier crate now re-exports layout versions and provides parse_layer1_aggregated_public_inputs.

Reviewed by Cursor Bugbot for commit 22c6fd0. Bugbot is set up for automated code reviews on this repo. Configure here.

Fixes aggregation to reject proofs that share a block hash but disagree on block number, preventing mixed-block batches from being accepted.

Adds a structured parser for layer-1 aggregated public inputs, documents the layout with version constants, and exposes the new parsing path through the verifier.

Improves test coverage around malformed inputs and block-number mismatches to make the aggregation boundary safer to evolve.
@ethan-crypto

Copy link
Copy Markdown
Collaborator Author

Note

Medium Risk Updates layer-1 aggregation circuit constraints and public-input parsing/shape validation; mistakes could cause valid proofs to fail verification or incorrect PI decoding across components.

Overview Strengthens layer-1 aggregation correctness by additionally constraining all child layer-0 proofs to share the same block_number (not just block_hash), with a new negative test that proves mismatched block numbers fail.

Adds first-class layer-1 aggregated public-input support in qp-wormhole-inputs: introduces Layer1AggregatedPublicCircuitInputs, defines the layer-1 PI layout/index constants (including header/slot/nullifier sizing), and implements a robust try_from_u64_slice parser with thorough shape/length tests.

qp-wormhole-verifier is extended to re-export the new types/layout-version constants and to provide parse_layer1_aggregated_public_inputs for decoding layer-1 aggregated proofs.

Reviewed by Cursor Bugbot for commit b0896a7. Bugbot is set up for automated code reviews on this repo. Configure here.

The medium risk finding isn't valid since the verifier is not yet connected to the chain for layer-1.

*Helps produce reproducible test fixtures from existing proof inputs and generated binaries, so integration tests can rely on consistent aggregate outputs.

*Accepts command-line inputs, validates the expected proof count, verifies the generated aggregate, and exports both proof artifacts and a JSON bundle of expected public data for downstream test use.
*Writes fixture outputs only after aggregation succeeds and adds a binary aggregate artifact, which avoids leaving partial output behind and makes the proof easier to consume in downstream tooling.

*Adds regression and validation coverage for aggregated public inputs so ABI layout drift and malformed payload shapes fail fast with clearer guarantees.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 20317a9. Configure here.


let err = Layer1AggregatedPublicCircuitInputs::try_from_u64_slice(&pis).unwrap_err();
assert!(err.to_string().contains("inconsistent shape"));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate test masks unreachable cursor-mismatch check

Low Severity

layer1_public_inputs_reject_cursor_shape_mismatch is identical to layer1_public_inputs_reject_too_long_vector — same input construction, same assertion. The name suggests it was meant to test the "cursor mismatch" check at line 624, but that check is actually unreachable dead code: after the remaining % 4 == 0 and nullifier_count * 2 == total_exit_slots validations pass, cursor is guaranteed to equal pis.len(). The test instead hits the earlier "inconsistent shape" error, duplicating the other test.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 20317a9. Configure here.

pub account_data: Vec<PublicInputsByAccount>,
/// Forwarded nullifiers from all child layer-0 proofs.
pub nullifiers: Vec<BytesDigest>,
/// Reserved for the future constrained bundle-root public input.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these "reserved" fields?

@illuzen illuzen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally fine, looks like some unused fields in the struct, bugbot found a duplicate test

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