feat(sequencer): get correct witnesses for base rollup #155
Conversation
f7f645b to
e28a09c
Compare
e28a09c to
9c704bf
Compare
| }, | ||
| "dependencies": { | ||
| "@aztec/foundation": "workspace:^", | ||
| "@aztec/merkle-tree": "workspace:^", |
There was a problem hiding this comment.
What's this new dependency for?
There was a problem hiding this comment.
Good spot, it can be removed. In shared.ts 'fromBufferArray' was previously 'fromSiblingPath' which used SiblingPath from merkle tree.
I refactored last second to prevent dependency spread
| * WARNING: This function has side effects, it will insert values into the tree. | ||
| * | ||
| * Assumptions: | ||
| * 1. There are 8 nullifiers provided and they are all unique |
There was a problem hiding this comment.
This is excluding empty nullifiers, right?
There was a problem hiding this comment.
Yes! I will update the comment
| this.validateTree(rollupOutput, MerkleTreeId.DATA_TREE, 'PrivateData'), | ||
| // TODO: Wait for new implementation of nullifier tree to avoid mismatches here | ||
| // this.validateTree(rollupOutput, MerkleTreeId.NULLIFIER_TREE, 'Nullifier'), | ||
| this.validateTree(rollupOutput, MerkleTreeId.NULLIFIER_TREE, 'Nullifier'), |
| }, | ||
| "dependencies": { | ||
| "@aztec/foundation": "workspace:^", | ||
| "@aztec/merkle-tree": "workspace:^", |
There was a problem hiding this comment.
Make sure to run yarn prepare in the root of yarn-projects if you change dependencies, so these get reflected in the build manifest
|
|
||
| // For each calculated new leaf, we insert it into the tree at the next position | ||
| for (let i = 0; i < insertionSubtree.length; i++) { | ||
| // We can skip inserting empty leaves |
| nextIndex: BigInt(insertionSubtree[i].nextIndex), | ||
| }; | ||
|
|
||
| await this.db.updateLeaf(MerkleTreeId.NULLIFIER_TREE, asLeafData, startInsertionIndex + BigInt(i)); |
There was a problem hiding this comment.
Can we use appendLeaf here instead? Not too important, I see updateLeaf updates the size anyway.
There was a problem hiding this comment.
unfortunately we cant, appending a leaf will fail as we have already forcefully updated pointers underneath in the previous step
| * The tree must be initially padded as the pre-populated 0 index prevents efficient subtree insertion. | ||
| * Padding with some values solves this issue. | ||
| */ | ||
| export const INITIAL_NULLIFIER_TREE_SIZE = 8; |
There was a problem hiding this comment.
Just to be sure. Is this taking us down a road of fixed size rollups?
There was a problem hiding this comment.
I don't think it will have that effect long term, it will just need to be the size of a nullifier tree sub tree insertion
* build: dont always clean * Update bootstrap.sh * Update bootstrap.sh
* build: dont always clean * Update bootstrap.sh * Update bootstrap.sh
* build: dont always clean * Update bootstrap.sh * Update bootstrap.sh
Description
Depends on AztecProtocol/aztec3-circuits#131
Updates the sequencer to get the witnesses for insertion in an alternative way compatible with the base rollup.
See a description of the insertion algorithm over at https://colab.research.google.com/drive/1A0gizduSi4FIiIJZ8OylwIpO9-OTqV-R
Please provide a paragraph or two giving a summary of the change, including relevant motivation and context.
TODO:
Checklist: