-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert public data tree to an indexed merkle tree #501
Labels
T-optimisation
Type: Optimisation. Making something faster / cheaper / smaller
Comments
ludamad
pushed a commit
that referenced
this issue
Jul 14, 2023
Gets rid of the composers class that wrapped a circuit constructor and a composer helper. This entailed various improvements such as a refactor of the stdlib verifier tests. Cleanup such a renaming of classes and moving of files will come in another PR. Corresponding PR in the core circuits library is #895.
4 tasks
sirasistant
added a commit
that referenced
this issue
Dec 14, 2023
Resolves #501 This PR changes the Public Data tree to an indexed tree of height 40. This optimizes insertions at the base rollup, reducing hashing and allowing batch insertion. In order to do this: - Now blocks use a snapshot for the public data tree, not just a root - Now indexed leaves have an updateTo method that allows updates. Nullifiers disallow updates. - The standard indexed tree realizes when a low leaf is an exact match and updates the low leaf instead. - The base rollup does indexed tree insertions for the public data tree, applying the update logic. - When fetching a slot from the public data tree, we get the low leaf for the given slot. If the low leaf is not an exact match, the value hasn't been inserted and the stored value is zero. If it's an exact match, the latest value is contained in the leaf.
michaelelliot
pushed a commit
to Swoir/noir_rs
that referenced
this issue
Feb 28, 2024
Resolves AztecProtocol#501 This PR changes the Public Data tree to an indexed tree of height 40. This optimizes insertions at the base rollup, reducing hashing and allowing batch insertion. In order to do this: - Now blocks use a snapshot for the public data tree, not just a root - Now indexed leaves have an updateTo method that allows updates. Nullifiers disallow updates. - The standard indexed tree realizes when a low leaf is an exact match and updates the low leaf instead. - The base rollup does indexed tree insertions for the public data tree, applying the update logic. - When fetching a slot from the public data tree, we get the low leaf for the given slot. If the low leaf is not an exact match, the value hasn't been inserted and the stored value is zero. If it's an exact match, the latest value is contained in the leaf.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zac made a good point. We can copy the optimisation we made to the nullifier tree (converting it from a sparse tree to an indexed tree) with the public data tree.
Note a difference:
The nullifier tree has leaves of the form:
The public data tree's leaf will also need to contain a 'key' field. In its sparse version, the key is the leaf_index, but when we migrate to an indexed tree, the leaf_index loses such a meaning, so the key needs to become part of the leaf's preimage. Note, we don't include a key in a nullifier tree leaf's preimage, because in the sparse version of the nullifier tree, the key and the value were always equal!
Note: this will be fiddly to do, and since it's only an optimisation (which only really 'bites' when we're generating actual proofs), I'd be in favour of deferring this task until after we've built out other features for the local developer testnet.
The text was updated successfully, but these errors were encountered: