@@ -126,14 +126,15 @@ class ChildRollupData {
126
126
ChildRollupData *-- BaseOrMergeRollupPublicInputs: public_inputs
127
127
128
128
class RootRollupInputs {
129
- l1_to_l2_msgs_tree: Snapshot
130
129
l1_to_l2_msgs: List~Fr~
131
130
l1_to_l2_msgs_sibling_path: List~Fr~
132
-
131
+ parent: Header,
132
+ parent_sibling_path: List~Fr~
133
133
archive_sibling_path: List~Fr~
134
134
left: ChildRollupData
135
135
right: ChildRollupData
136
136
}
137
+ RootRollupInputs *-- Header : parent
137
138
RootRollupInputs *-- ChildRollupData: left
138
139
RootRollupInputs *-- ChildRollupData: right
139
140
@@ -149,29 +150,33 @@ RootRollupPublicInputs *--Header : header
149
150
150
151
``` python
151
152
def RootRollupCircuit (
152
- left : ChildRollupData,
153
- right : ChildRollupData,
154
153
l1_to_l2_msgs : List[Fr],
155
154
l1_to_l2_msgs_sibling_path : List[Fr],
156
155
parent : Header,
157
156
parent_sibling_path : List[Fr],
158
157
archive_sibling_path : List[Fr],
158
+ left : ChildRollupData,
159
+ right : ChildRollupData,
159
160
) -> 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
162
168
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
167
170
171
+ # Check that the parent is a valid parent
168
172
assert merkle_inclusion(
169
173
parent.hash(),
170
174
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
173
177
)
174
178
179
+ # Update the l1 to l2 msg tree
175
180
l1_to_l2_msg_subtree = MerkleTree(l1_to_l2_msgs)
176
181
l1_to_l2_msg_tree = merkle_insertion(
177
182
parent.state.l1_to_l2_message_tree,
@@ -181,17 +186,17 @@ def RootRollupCircuit(
181
186
L1_To_L2_HEIGHT
182
187
)
183
188
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)
186
191
187
192
header = Header(
188
- last_archive = left.inputs .constants.last_archive,
193
+ last_archive = left.public_inputs .constants.last_archive,
189
194
body_hash = SHA256(txs_hash | out_hash | SHA256(l1_to_l2_msgs)),
190
195
state = StateReference(
191
196
l1_to_l2_message_tree = l1_to_l2_msg_tree,
192
- partial = right.inputs .end,
197
+ partial = right.public_inputs .end,
193
198
),
194
- global_variables = left.inputs .constants.global_variables,
199
+ global_variables = left.public_inputs .constants.global_variables,
195
200
)
196
201
197
202
archive = merkle_insertion(
@@ -203,7 +208,9 @@ def RootRollupCircuit(
203
208
)
204
209
205
210
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,
207
214
archive = archive,
208
215
header: Header,
209
216
)
0 commit comments