-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Wonky Rollups See full write up [here](https://hackmd.io/@aztec-network/ByROkLKIC). This PR eliminates the need to pad empty transactions in a rollup, so we can run the fewest rollup circuits required for a block. Main changes are: - Implementing a greedy-filled wonky tree in `sol` (`computeUnbalancedRoot`) and `ts` (`unbalanced_tree.ts`, and `getTxsEffectHash`) - thanks to @alexghr for the idea and help on this! - Using this tree to calculate `txsEffectHash`, `outHash`, and gather membership paths for consuming messages in the `outHash` tree - `ContentCommitment.txTreeHeight` -> `.numTxs` as we have variable height (`numTxs` may also not be required, as we gather the number from the txs effect calculation anyway) - Merge rollups can now take in one base and one merge rollup as input - `orchestrator.ts` now forms a wonky tree (`proving-state.ts -> findMergeLevel`) instead of a balanced tree with padding when constructing the rollup circuits and enqueuing proofs - We *only* pad blocks if we have less than 2 transactions, since a root rollup still needs 2 inputs --- The tree greedy fills txs from L to R in a rollup structure e.g. 5 txs looks like: ``` // root // / \ // merge base // / \ // merge merge // / \ / \ // base base base base ``` ...and 7 txs looks like: ``` // root // / \ // merge3 merge5 // / \ / \ // merge1 merge2 merge4 base // / \ / \ / \ // base base base base base base ``` Eliminates the need to use padding txs and circuits. E.g. previously, 5txs would have: ``` // // root // / \ // merge merge // / \ / \ // merge merge merge merge // / \ / \ / \ / \ // base base base base base <pad> <pad> <pad> ``` Processing 3 extra txs and => base circuits, and 3 extra merge circuits. To recalulate a wonky tree from the number of txs in a block, simply decompose it into powers of 2 to find the subtree sizes. Calculate the roots of these subtrees and hash from right to left. A full example in the write up.
- Loading branch information
1 parent
3e6d88e
commit 1de3746
Showing
48 changed files
with
1,543 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.