Skip to content
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

chore: Faster getLeafOrLowLeafInfo in AVM ephemeral trees #10943

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

spalladino
Copy link
Collaborator

The implementation of _getLeafOrLowLeafInfo would search for the low leaf info in both the ephemeral indexed updates and on the actual db. If it didn't get an exact hit for the leaf, it would start from the hit on the indexed updates, and then linearly walk through the underlying nullifier tree until it got to the low leaf.

This PR changes it so queries low leaf from both indexed and external, and picks the closest one.

I tested this using the builds blocks with multiple public fns after multiple nullifier insertions e2e (flagged as skipped) which first inserts 128 nullifiers and then runs 128 public functions that write to storage. The number of total calls to GET_LEAF_PREIMAGE in world-state went from 20403 to 915.

The implementation of `_getLeafOrLowLeafInfo` would search for the low
leaf info in both the ephemeral indexed updates and on the actual db. If
it didn't get an exact hit for the leaf, it would start from the hit on
the indexed updates, and then linearly walk through the underlying
nullifier tree until it got to the low leaf.

This PR changes it so queries low leaf from both indexed and external,
and picks the closest one.
@spalladino spalladino added e2e-all CI: Enables this CI job. network-all Run this CI job. labels Dec 23, 2024
Copy link
Contributor

Changes to public function bytecode sizes

Generated at commit: 48621353d400e01b7b78e263dca61f9021b602de, compared to commit: d340f0b0c2c97b59d2a8830bdae452d85945322c

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AvmTest::public_dispatch -1,349 ✅ -2.06%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AvmTest::public_dispatch 64,063 (-1,349) -2.06%

Copy link
Collaborator

@dbanks12 dbanks12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@spalladino spalladino enabled auto-merge (squash) December 23, 2024 18:44
@spalladino spalladino merged commit d4d92ef into master Dec 23, 2024
94 of 126 checks passed
@spalladino spalladino deleted the palla/avm-tree-get-low-leaf branch December 23, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-all CI: Enables this CI job. network-all Run this CI job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants