Root Rollup circuit
Circuit Description
This circuit rolls up other rollup proofs.
It is defined by a parameter rollup_num
, of inner rollups. Let's also denote rollup_num
for convenience.
Circuit Inputs: Summary
The inputs for the root rollup circuit are:
As previously, the field is from the BN254 specification.
Public Inputs
The root rollup circuit contains 17
public inputs.
The first pubic input is a SHA256 hash (reduced modulo the BN254 group order) of the following parameters:
rollup_id
(The location wherenew_root_M
will be inserted in the roots tree)rollup_size
data_start_index
old_data_root
new_data_root
old_null_root
new_null_root
old_root_root
new_root_root
old_defi_root
new_defi_root
bridge_call_datas
(size isNUM_BRIDGE_CALLS_PER_BLOCK
)defi_deposit_sums
(size isNUM_BRIDGE_CALLS_PER_BLOCK
)encrypted_defi_interaction_notes
(size isNUM_BRIDGE_CALLS_PER_BLOCK
)previous_defi_interaction_hash
rollup_benficiary
- For
- The
public_inputs_hash
of the rollup
- The
The remaining 16 public inputs are 68-bit limbs of two BN254 elements. Each element is split into two elements, which is in turn split into 4 68-bit limbs.
The two elements, , represent the recursive_proof_output
- group elements that must satisfy the following pairing check in order for the set of recursive proofs in the root rollup circuit to be valid:
, where is the element produced by the Ignition trusted setup ceremony.
Broadcasted Inputs
In addition to the public inputs, the preimage to the above SHA256 hash is also broadcasted with the proof.
The purpose of the SHA256 compression is not to hide information, it is solely to reduce the number of public inputs to the circuit.
This is because, for a verifier smart contract on the Ethereum blockchain network, the computational cost of processing a public input is ~160 gas. The computational cost of including a 32-byte value in a SHA256 hash is 6 gas. Therefore reducing the public inputs via SHA256 hashing represents a significant gas saving, lowering the cost of processing a rollup block.
The rollup_benficiary
is just added to the circuit to ensure the proof constructor can pay who they intend.
Private Inputs
- The recursive proof output of each inner rollup proof (4 elements represented as 16 elements, see above)
- The remaining public inputs of each rollup proof
Circuit Logic (Pseudocode)
- For , check that
- For , check that
new_data_root
=old_data_root
. - Validate
Update(old_data_roots_root, new_data_roots_root, rollup_id, new_data_root_M)
- Validate that the
new_defi_root
of each real inner rollup proof is equal to the inputnew_defi_root
to the root rollup - Validate that the
bridge_call_datas
in each real inner rollup proof match the inputbridge_call_datas
to the root rollup - Accumulate defi deposits across inner rollup proofs
- Add the input
defi_interaction_notes
in thedefi_tree
and computeprevious_defi_interaction_hash := Hash(defi_interaction_notes)
- Range constrain that
rollup_beneficiary
is an ethereum address,
where is the verification key of the rollup circuit.