-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces a new circuit that outputs the same as block root but representing an empty block. To be used for padding epochs with only zero or one blocks.
- Loading branch information
1 parent
c78b2cb
commit 20a0a9e
Showing
7 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
noir-projects/noir-protocol-circuits/crates/rollup-block-root-empty/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "rollup_block_root_empty" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.18.0" | ||
|
||
[dependencies] | ||
rollup_lib = { path = "../rollup-lib" } | ||
types = { path = "../types" } |
6 changes: 6 additions & 0 deletions
6
noir-projects/noir-protocol-circuits/crates/rollup-block-root-empty/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use rollup_lib::block_root::{EmptyBlockRootRollupInputs, BlockRootOrBlockMergePublicInputs}; | ||
|
||
#[recursive] | ||
fn main(inputs: EmptyBlockRootRollupInputs) -> pub BlockRootOrBlockMergePublicInputs { | ||
inputs.empty_block_root_rollup_circuit() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...noir-protocol-circuits/crates/rollup-lib/src/block_root/empty_block_root_rollup_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::abis::block_root_or_block_merge_public_inputs::BlockRootOrBlockMergePublicInputs; | ||
use types::{abis::{append_only_tree_snapshot::AppendOnlyTreeSnapshot, global_variables::GlobalVariables}}; | ||
use crate::abis::block_root_or_block_merge_public_inputs::FeeRecipient; | ||
|
||
pub struct EmptyBlockRootRollupInputs { | ||
archive: AppendOnlyTreeSnapshot, | ||
block_hash: Field, | ||
global_variables: GlobalVariables, | ||
out_hash: Field, | ||
vk_tree_root: Field, | ||
// TODO(#7346): Temporarily added prover_id while we verify block-root proofs on L1 | ||
prover_id: Field, | ||
} | ||
|
||
impl EmptyBlockRootRollupInputs { | ||
pub fn empty_block_root_rollup_circuit(self) -> BlockRootOrBlockMergePublicInputs { | ||
BlockRootOrBlockMergePublicInputs { | ||
previous_archive: self.archive, | ||
new_archive: self.archive, | ||
previous_block_hash: self.block_hash, | ||
end_block_hash: self.block_hash, | ||
start_global_variables: self.global_variables, | ||
end_global_variables: self.global_variables, | ||
out_hash: self.out_hash, | ||
fees: [FeeRecipient::empty(); 32], | ||
vk_tree_root: self.vk_tree_root, | ||
prover_id: self.prover_id | ||
} | ||
} | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
noir-projects/noir-protocol-circuits/crates/rollup-lib/src/block_root/mod.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters