Skip to content

Commit 9bbd70a

Browse files
authored
chore: cleaning inconsistency (AztecProtocol#3851)
- Fixing an inconsistency in the diagram/validity conditions of the root rollup. - Renaming inputs to public inputs in the validity conditions.
1 parent a3920fb commit 9bbd70a

File tree

3 files changed

+42
-33
lines changed

3 files changed

+42
-33
lines changed

yellow-paper/docs/rollup-circuits/index.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,19 @@ class MergeRollupInputs {
308308
MergeRollupInputs *-- ChildRollupData: left
309309
MergeRollupInputs *-- ChildRollupData: right
310310
311+
311312
class RootRollupInputs {
312-
l1_to_l2_msgs_tree: Snapshot
313313
l1_to_l2_msgs: List~Fr~
314314
l1_to_l2_msgs_sibling_path: List~Fr~
315-
315+
parent: Header,
316+
parent_sibling_path: List~Fr~
316317
archive_sibling_path: List~Fr~
317318
left: ChildRollupData
318319
right: ChildRollupData
319320
}
320321
RootRollupInputs *-- ChildRollupData: left
321322
RootRollupInputs *-- ChildRollupData: right
323+
RootRollupInputs *-- Header : parent
322324
323325
324326
class RootRollupPublicInputs {
@@ -428,7 +430,7 @@ graph BT
428430
K2[l2_to_l1_msgs 1.0]
429431
K3[l2_to_l1_msgs 1.1]
430432
K4[l2_to_l1_msgs 2.0]
431-
K5[TxEffect 2.1]
433+
K5[l2_to_l1_msgs 2.1]
432434
K6[l2_to_l1_msgs 3.0]
433435
K7[l2_to_l1_msgs 3.1]
434436

yellow-paper/docs/rollup-circuits/merge_rollup.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,22 @@ def MergeRollupCircuit(
7676
left: ChildRollupData,
7777
right: ChildRollupData
7878
) -> BaseOrMergeRollupPublicInputs:
79-
assert left.proof.is_valid(left.inputs)
80-
assert right.proof.is_valid(right.inputs)
79+
assert left.proof.is_valid(left.public_inputs)
80+
assert right.proof.is_valid(right.public_inputs)
8181

82-
assert left.inputs.constants == right.inputs.constants
83-
assert right.inputs.start == left.inputs.end
84-
assert left.inputs.type == right.inputs.type
85-
assert left.inputs.height_in_block_tree == right.inputs.height_in_block_tree
82+
assert left.public_inputs.constants == right.public_inputs.constants
83+
assert left.public_inputs.end == right.public_inputs.start
84+
assert left.public_inputs.type == right.public_inputs.type
85+
assert left.public_inputs.height_in_block_tree == right.public_inputs.height_in_block_tree
8686

8787
return BaseOrMergeRollupPublicInputs(
8888
type=1,
89-
height_in_block_tree=left.inputs.height_in_block_tree + 1,
89+
height_in_block_tree=left.public_inputs.height_in_block_tree + 1,
9090
aggregation_object=AggregationObject(left.proof, right.proof),
91-
txs_hash=SHA256(left.inputs.txs_hash | right.inputs.txs_hash),
92-
out_hash=SHA256(left.inputs.out_hash | right.inputs.out_hash),
93-
start=left.inputs.start,
94-
end=right.inputs.end,
95-
constants=left.inputs.constants
91+
txs_hash=SHA256(left.public_inputs.txs_hash | right.public_inputs.txs_hash),
92+
out_hash=SHA256(left.public_inputs.out_hash | right.public_inputs.out_hash),
93+
start=left.public_inputs.start,
94+
end=right.public_inputs.end,
95+
constants=left.public_inputs.constants
9696
)
9797
```

yellow-paper/docs/rollup-circuits/root_rollup.md

+25-18
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,15 @@ class ChildRollupData {
126126
ChildRollupData *-- BaseOrMergeRollupPublicInputs: public_inputs
127127
128128
class RootRollupInputs {
129-
l1_to_l2_msgs_tree: Snapshot
130129
l1_to_l2_msgs: List~Fr~
131130
l1_to_l2_msgs_sibling_path: List~Fr~
132-
131+
parent: Header,
132+
parent_sibling_path: List~Fr~
133133
archive_sibling_path: List~Fr~
134134
left: ChildRollupData
135135
right: ChildRollupData
136136
}
137+
RootRollupInputs *-- Header : parent
137138
RootRollupInputs *-- ChildRollupData: left
138139
RootRollupInputs *-- ChildRollupData: right
139140
@@ -149,29 +150,33 @@ RootRollupPublicInputs *--Header : header
149150

150151
```python
151152
def RootRollupCircuit(
152-
left: ChildRollupData,
153-
right: ChildRollupData,
154153
l1_to_l2_msgs: List[Fr],
155154
l1_to_l2_msgs_sibling_path: List[Fr],
156155
parent: Header,
157156
parent_sibling_path: List[Fr],
158157
archive_sibling_path: List[Fr],
158+
left: ChildRollupData,
159+
right: ChildRollupData,
159160
) -> RootRollupPublicInputs:
160-
assert left.proof.is_valid(left.inputs)
161-
assert right.proof.is_valid(right.inputs)
161+
assert left.proof.is_valid(left.public_inputs)
162+
assert right.proof.is_valid(right.public_inputs)
163+
164+
assert left.public_inputs.constants == right.public_inputs.constants
165+
assert left.public_inputs.end == right.public_inputs.start
166+
assert left.public_inputs.type == right.public_inputs.type
167+
assert left.public_inputs.height_in_block_tree == right.public_inputs.height_in_block_tree
162168

163-
assert left.inputs.constants == right.inputs.constants
164-
assert right.inputs.start == left.inputs.end
165-
assert left.inputs.type == right.inputs.type
166-
assert left.inputs.height_in_block_tree == right.inputs.height_in_block_tree
169+
assert parent.state.partial == left.public_inputs.start
167170

171+
# Check that the parent is a valid parent
168172
assert merkle_inclusion(
169173
parent.hash(),
170174
parent_sibling_path,
171-
left.inputs.constants.global_variables.block_number,
172-
left.inputs.constants.last_archive.root
175+
left.public_inputs.constants.global_variables.block_number,
176+
left.public_inputs.constants.last_archive.root
173177
)
174178

179+
# Update the l1 to l2 msg tree
175180
l1_to_l2_msg_subtree = MerkleTree(l1_to_l2_msgs)
176181
l1_to_l2_msg_tree = merkle_insertion(
177182
parent.state.l1_to_l2_message_tree,
@@ -181,17 +186,17 @@ def RootRollupCircuit(
181186
L1_To_L2_HEIGHT
182187
)
183188

184-
txs_hash = SHA256(left.inputs.txs_hash | right.inputs.txs_hash)
185-
out_hash = SHA256(left.inputs.txs_hash | right.inputs.out_hash)
189+
txs_hash = SHA256(left.public_inputs.txs_hash | right.public_inputs.txs_hash)
190+
out_hash = SHA256(left.public_inputs.txs_hash | right.public_inputs.out_hash)
186191

187192
header = Header(
188-
last_archive = left.inputs.constants.last_archive,
193+
last_archive = left.public_inputs.constants.last_archive,
189194
body_hash = SHA256(txs_hash | out_hash | SHA256(l1_to_l2_msgs)),
190195
state = StateReference(
191196
l1_to_l2_message_tree = l1_to_l2_msg_tree,
192-
partial = right.inputs.end,
197+
partial = right.public_inputs.end,
193198
),
194-
global_variables = left.inputs.constants.global_variables,
199+
global_variables = left.public_inputs.constants.global_variables,
195200
)
196201

197202
archive = merkle_insertion(
@@ -203,7 +208,9 @@ def RootRollupCircuit(
203208
)
204209

205210
return RootRollupPublicInputs(
206-
aggregation_object = left.inputs.aggregation_object + right.inputs.aggregation_object,
211+
aggregation_object =
212+
left.public_inputs.aggregation_object +
213+
right.public_inputs.aggregation_object,
207214
archive = archive,
208215
header: Header,
209216
)

0 commit comments

Comments
 (0)