diff --git a/yellow-paper/docs/rollup-circuits/index.md b/yellow-paper/docs/rollup-circuits/index.md index c9554c7e0e68..36bb88132e5d 100644 --- a/yellow-paper/docs/rollup-circuits/index.md +++ b/yellow-paper/docs/rollup-circuits/index.md @@ -8,27 +8,29 @@ Together with the [validating light node](../l1-smart-contracts/index.md), the r To support this, we construct a single proof for the entire block, which is then verified by the validating light node. This single proof consist of three main components: -It has **two** sub-trees for transactions, and **one** tree for L1 to L2 messages. +It has **two** sub-trees for transactions, and **one** tree for L1 to L2 messages. The two transaction trees are then merged into a single proof and combined with the roots of the message tree to form the final proof and output. Each of these trees are built by recursively combining proofs from a lower level of the tree. This structure allows us to keep the workload of each individual proof small, while making it very parallelizable. This works very well for the case where we want many actors to be able to participate in the proof generation. -Note that we have two different types of "merger" circuits, depending on what they are combining. +Note that we have two different types of "merger" circuits, depending on what they are combining. For transactions we have: + - The `merge` rollup - Merges two `base` rollup proofs OR two `merge` rollup proofs - The `root` rollup - Merges two `merge` rollup proofs And for the message parity we have: + - The `root_parity` circuit - Merges `N` `root` or `base_parity` proofs - The `base_parity` circuit - - Merges `N` l1 to l2 messages in a subtree + - Merges `N` l1 to l2 messages in a subtree -In the diagram the size of the tree is limited for demonstration purposes, but a larger tree would have more layers of merge rollups proofs. +In the diagram the size of the tree is limited for demonstration purposes, but a larger tree would have more layers of merge rollups proofs. Circles mark the different types of proofs, while squares mark the different circuit types. ```mermaid @@ -138,7 +140,7 @@ graph BT To understand what the circuits are doing and what checks they need to apply it is useful to understand what data is going into the circuits and what data is coming out. -Below is a figure of the data structures thrown around for the block proof creation. +Below is a figure of the data structures thrown around for the block proof creation. Note that the diagram does not include much of the operations for kernels, but mainly the data structures that are used for the rollup circuits. @@ -147,7 +149,6 @@ Note that the diagram does not include much of the operations for kernels, but m - ```mermaid classDiagram direction TB @@ -155,7 +156,6 @@ direction TB class PartialStateReference { note_hash_tree: Snapshot nullifier_tree: Snapshot - contract_tree: Snapshot public_data_tree: Snapshot } @@ -192,12 +192,6 @@ Header *-- ContentCommitment: content_commitment Header *-- StateReference : state Header *-- GlobalVariables : global_variables -class ContractData { - leaf: Fr - address: Address - portal: EthAddress -} - class Logs { private: EncryptedLogs public: UnencryptedLogs @@ -212,11 +206,9 @@ class TxEffect { note_hashes: List~Fr~ nullifiers: List~Fr~ l2_to_l1_msgs: List~Fr~ - contracts: List~ContractData~ public_writes: List~PublicDataWrite~ logs: Logs } -TxEffect *-- "m" ContractData: contracts TxEffect *-- "m" PublicDataWrite: public_writes TxEffect *-- Logs : logs @@ -253,12 +245,6 @@ class PublicDataRead { value: Fr } -class NewContractData { - function_tree_root: Fr - address: Address - portal: EthAddress -} - class CombinedAccumulatedData { aggregation_object: AggregationObject read_requests: List~Fr~ @@ -268,7 +254,6 @@ class CombinedAccumulatedData { nullified_note_hashes: List~Fr~ l2_to_l1_messages: List~Fr~ - contracts: List~NewContractData~ public_update_requests: List~PublicDataUpdateRequest~ public_reads: List~PublicDataRead~ logs: Logs @@ -278,28 +263,15 @@ class CombinedAccumulatedData { start_public_data_root: Fr end_public_data_root: Fr } -CombinedAccumulatedData *-- "m" NewContractData: contracts CombinedAccumulatedData *-- "m" PublicDataUpdateRequest: public_update_requests CombinedAccumulatedData *-- "m" PublicDataRead: public_reads CombinedAccumulatedData *-- Logs : logs -class ContractDeploymentData { - deployer_public_key: Point - constructor_vk_hash: Fr - constructor_args_hash: Fr - function_tree_root: Fr - salt: Fr - portal_address: Fr -} - class TxContext { fee_context: FeeContext - is_contract_deployment: bool chain_id: Fr version: Fr - contract_deployment_data: ContractDeploymentData } -TxContext *-- ContractDeploymentData: contract_deployment_data class CombinedConstantData { historical_header: Header @@ -329,7 +301,6 @@ class StateDiffHints { sorted_nullifier_indexes: List~Fr~ note_hash_subtree_sibling_path: List~Fr~, nullifier_subtree_sibling_path: List~Fr~, - contract_subtree_sibling_path: List~Fr~, public_data_sibling_path: List~Fr~, } @@ -415,26 +386,22 @@ RootRollupPublicInputs *--Header : header ``` :::info CombinedAccumulatedData -Note that the `CombinedAccumulatedData` contains elements that we won't be using throughout the rollup circuits. +Note that the `CombinedAccumulatedData` contains elements that we won't be using throughout the rollup circuits. However, as the data is used for the kernel proofs (when it is build recursively), we will include it here anyway. ::: -:::warning TODO -Reconsider `ContractDeploymentData` in light of the newer (still being finalised) contract deployment flow -::: - Since the diagram can be quite overwhelming, we will go through the different data structures and what they are used for along with the three (3) different rollup circuits. ### Higher-level tasks -Before looking at the circuits individually, it can however be a good idea to recall the reason we had them in the first place. +Before looking at the circuits individually, it can however be a good idea to recall the reason we had them in the first place. For this, we are especially interested in the tasks that span multiple circuits and proofs. #### State consistency -While the individual kernels are validated on their own, they might rely on state changes earlier in the block. -For the block to be correctly validated, this means that when validating kernel $n$, it must be executed on top of the state after all kernels $ B3 ``` -While the `TxsHash` merely require the data to be published and known to L1, the `InHash` and `OutHash` needs to be computable on L1 as well. +While the `TxsHash` merely require the data to be published and known to L1, the `InHash` and `OutHash` needs to be computable on L1 as well. This reason require them to be efficiently computable on L1 while still being non-horrible inside a snark - leading us to rely on SHA256. ## Next Steps diff --git a/yellow-paper/docs/rollup-circuits/root-rollup.md b/yellow-paper/docs/rollup-circuits/root-rollup.md index 3cdfa06d6737..e4cdf8804be4 100644 --- a/yellow-paper/docs/rollup-circuits/root-rollup.md +++ b/yellow-paper/docs/rollup-circuits/root-rollup.md @@ -16,7 +16,7 @@ This might practically happen through a series of "squisher" circuits that will ::: ## Overview - + ```mermaid classDiagram direction TB @@ -24,7 +24,6 @@ direction TB class PartialStateReference { note_hash_tree: Snapshot nullifier_tree: Snapshot - contract_tree: Snapshot public_data_tree: Snapshot } @@ -61,12 +60,6 @@ Header *-- ContentCommitment: content_commitment Header *-- StateReference : state Header *-- GlobalVariables : global_variables -class ContractData { - leaf: Fr - address: Address - portal: EthAddress -} - class Logs { private: EncryptedLogs public: UnencryptedLogs @@ -81,11 +74,9 @@ class TxEffect { note_hashes: List~Fr~ nullifiers: List~Fr~ l2_to_l1_msgs: List~Fr~ - contracts: List~ContractData~ public_writes: List~PublicDataWrite~ logs: Logs } -TxEffect *-- "m" ContractData: contracts TxEffect *-- "m" PublicDataWrite: public_writes TxEffect *-- Logs : logs diff --git a/yellow-paper/docs/state/index.md b/yellow-paper/docs/state/index.md index b37e2a4e214c..c927444bd887 100644 --- a/yellow-paper/docs/state/index.md +++ b/yellow-paper/docs/state/index.md @@ -63,7 +63,7 @@ A side-effect of this also means that if multiple users are "sharing" their note ## State Categories - - - ```mermaid classDiagram direction TB @@ -93,7 +90,6 @@ direction TB class PartialStateReference { note_hash_tree: Snapshot nullifier_tree: Snapshot - contract_tree: Snapshot public_data_tree: Snapshot } @@ -140,21 +136,13 @@ class PublicDataWrite { value: Fr } -class ContractData { - leaf: Fr - address: Address - portal: EthAddress -} - class TxEffect { note_hashes: List~Fr~ nullifiers: List~Fr~ l2_to_l1_msgs: List~Fr~ - contracts: List~ContractData~ public_writes: List~PublicDataWrite~ logs: Logs } -TxEffect *-- "m" ContractData: contracts TxEffect *-- "m" PublicDataWrite: public_writes TxEffect *-- Logs : logs @@ -221,4 +209,4 @@ State *-- PublicDataTree : public_data_tree import DocCardList from '@theme/DocCardList'; - \ No newline at end of file +