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_Mwill be inserted in the roots tree)rollup_sizedata_start_indexold_data_rootnew_data_rootold_null_rootnew_null_rootold_root_rootnew_root_rootold_defi_rootnew_defi_rootbridge_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_hashrollup_benficiary- For
- The
public_inputs_hashof 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_rootof each real inner rollup proof is equal to the inputnew_defi_rootto the root rollup - Validate that the
bridge_call_datasin each real inner rollup proof match the inputbridge_call_datasto the root rollup - Accumulate defi deposits across inner rollup proofs
- Add the input
defi_interaction_notesin thedefi_treeand computeprevious_defi_interaction_hash := Hash(defi_interaction_notes) - Range constrain that
rollup_beneficiaryis an ethereum address,
where is the verification key of the rollup circuit.