Skip to content

Commit bd41f01

Browse files
authored
chore(circuits): Add some comments for rollup circuits (#17837)
Add some comments
2 parents f92db72 + 166e67e commit bd41f01

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

noir-projects/noir-protocol-circuits/crates/rollup-lib/src/abis/root_rollup_public_inputs.nr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ use types::{
55
};
66

77
pub struct RootRollupPublicInputs {
8-
// Snapshot of archive tree before/after this rollup has been processed
8+
// Root of archive tree before/after this rollup has been processed
9+
// We don't submit the nextAvailableLeafIndex to L1, it's validated by the circuits themselves:
10+
// During an epoch, we assert that the previous archive is the new archive from the next rollup merged in.
11+
// However, to validate the very first previous archive of an epoch, the validation is more succinct:
12+
// - If you try to set a higher nextAvailableLeafIndex (skip), you won't be able to provide a valid preimage to `validate_previous_block_header_in_archive`
13+
// - If you try to set a lower nextAvailableLeafIndex (overwrite), you'll fail the zero leaf check in the tree insertion code
914
pub previous_archive_root: Field,
1015
pub new_archive_root: Field,
1116
pub checkpoint_header_hashes: [Field; AZTEC_MAX_EPOCH_DURATION],

noir-projects/noir-protocol-circuits/crates/rollup-lib/src/checkpoint_merge/utils/merge_checkpoint_rollups.nr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ pub fn merge_checkpoint_rollups(
1818
right.checkpoint_header_hashes,
1919
);
2020

21-
// TODO(Miranda): combine fees with same recipient depending on rollup structure
22-
// Assuming that the final rollup tree (block root -> block merge -> root) has max 32 leaves (TODO: constrain in root), then
23-
// in the worst case, we would be checking the left 16 values (left_len = 16) against the right 16 (right_len = 16).
21+
// We can't merge fees for the same recipient since the l1 contract iterates per checkpoint.
2422
let fees = array_merge(left.fees, right.fees);
2523

2624
CheckpointRollupPublicInputs {

noir-projects/noir-protocol-circuits/crates/types/src/abis/checkpoint_header.nr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub struct CheckpointHeader {
1616
// The timestamp of the slot. All blocks in the checkpoint must have a timestamp less than or equal to this value.
1717
pub timestamp: u64,
1818
pub coinbase: EthAddress,
19+
// This field is an optional arbitrary l2 address set by the block builder. It's unchecked, and allows
20+
// off chain functionality between builders and tx submitters.
1921
pub fee_recipient: AztecAddress,
2022
pub gas_fees: GasFees,
2123
pub total_mana_used: Field,

0 commit comments

Comments
 (0)