Repository navigation
refactor(circuits)!: fold three node proofs per nodes_fold step #2531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e98c250
8dea255
1754fcb
b73ba86
6de7c62
445953b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
| // | ||
| // This file is provided WITHOUT ANY WARRANTY; | ||
| // without even the implied warranty of MERCHANTABILITY | ||
| // or FITNESS FOR A PARTICULAR PURPOSE. | ||
|
|
||
| //! Multi-leaf placement shared by `nodes_fold_kernel` and `nodes_fold`. | ||
| //! | ||
| //! A step verifies [`NODES_FOLD_LEAVES`] `node_fold` proofs, so each node costs a share of one | ||
| //! larger proof instead of a whole step. A step with fewer nodes repeats one of them under the | ||
| //! sentinel slot `H`, which writes nothing. The DKG aggregator binds every row to a selected party, | ||
| //! so a chain cannot end with a row left empty. | ||
|
|
||
| /// `node_fold` proofs one kernel or fold step verifies. Each statement carries every party's rows, | ||
| /// so a fourth node would take a step past 2^22 (4.28M gates at n = 39); three keep it within 2^22. | ||
| pub global NODES_FOLD_LEAVES: u32 = 3; | ||
|
|
||
| /// Writes each node's statement into its row. A row must be all zero before it is written; the | ||
| /// sentinel slot `H` writes nothing. | ||
| pub fn place_nodes<let LEN: u32, let H: u32, let K: u32>( | ||
| rows: [[Field; LEN]; H], | ||
| nodes: [[Field; LEN]; K], | ||
| slot_indices: [u32; K], | ||
| ) -> [[Field; LEN]; H] { | ||
| let mut rows = rows; | ||
| for k in 0..K { | ||
| let slot = slot_indices[k]; | ||
| assert(slot <= H, "slot index out of range"); | ||
| for i in 0..H { | ||
| if slot == i { | ||
| for j in 0..LEN { | ||
| assert(rows[i][j] == 0, "slot already filled"); | ||
| } | ||
| rows[i] = nodes[k]; | ||
| } | ||
| } | ||
| } | ||
| rows | ||
| } | ||
|
|
||
| #[test] | ||
| fn nodes_land_in_their_rows_and_the_sentinel_writes_nothing() { | ||
| let rows = place_nodes::<2, 3, 3>([[0; 2]; 3], [[1, 2], [3, 4], [1, 2]], [2, 0, 3]); | ||
| assert(rows == [[3, 4], [0, 0], [1, 2]]); | ||
| } | ||
|
|
||
| #[test(should_fail_with = "slot already filled")] | ||
| fn a_node_cannot_overwrite_a_filled_row() { | ||
| let _ = place_nodes::<2, 2, 1>([[0, 0], [0, 5]], [[1, 2]], [1]); | ||
| } | ||
|
|
||
| #[test(should_fail_with = "slot index out of range")] | ||
| fn a_node_slot_past_the_sentinel_is_rejected() { | ||
| let _ = place_nodes::<2, 2, 1>([[0; 2]; 2], [[1, 2]], [3]); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,12 +85,12 @@ pub struct NodeDkgFoldRequest { | |
| /// Single step of the streaming cross-node nodes_fold accumulation. | ||
| #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] | ||
| pub struct NodesFoldStepRequest { | ||
| /// The `node_fold` proof for this slot. | ||
| pub inner_proof: Proof, | ||
| /// The `node_fold` proofs this step folds, at most `nodes_fold`'s leaf count. | ||
| pub inner_proofs: Vec<Proof>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regenerate the event layout lock with the request change.
Include the regenerated fixture in the integrated change. Record the storage cutover separately; a new fixture does not make old journals readable. As per coding guidelines, “Durable payload changes need schema/wire review beyond a Rust compile or updated layout fixture.” Also applies to: 93-93
|
||
| /// The prior accumulator proof, or `None` for the first step. | ||
| pub prior_accumulator: Option<Proof>, | ||
| /// Slot index for this honest party (position in ascending `party_id` order). | ||
| pub slot_index: u32, | ||
| /// Slot index of each proof (its party's position in ascending `party_id` order). | ||
| pub slot_indices: Vec<u32>, | ||
| /// Total honest-party count H. | ||
| pub total_slots: usize, | ||
| /// E3 identifier used for job namespacing. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complete the matching artifact refresh with this interface change.
The prefix grows from five fields to seven fields. The leaf witness also changes from one proof to three proofs. The PR states that the matching VK catalogue, Solidity verifier and BFV bindings remain deferred, and that their checks currently fail. Existing artifacts therefore do not support the new proof flow.
Regenerate the source-matched artifacts and bindings before merging this interface. Then validate a padded minimum-committee chain and its final contract acceptance. Do not restamp old artifacts.
As per coding guidelines, “Statement/aggregation changes also need the prepared Rust real-proof and contract acceptance paths.”
Source: Coding guidelines