Skip to content

Commit

Permalink
feat(avm): ephemeral avm tree (#9798)
Browse files Browse the repository at this point in the history
This adds forkable trees so that we can use them in the avm to handle
context changes.

The existing native trees are missing the ability to arbitrarily fork
from uncommitted state. This is a requirement for our one-tx processing
as we need to be able to fork-rollback-fork when encountering a change
in the avm context (e.g. in a nested call).

These trees store the difference between the initial tx state (stored in
the native world state db) and the current ephmeral state during
transaction processing. Queries are either handled by the ephemeral tree
or proxied to the db.

Currently there are definitely some room for performance improvements.
Namely:
- Storage of a sparse, value-sorted data structure for the indexed tree
leaf updates.
- This would allow for fast low nullifier lookup (which will be the
bottleneck for indexed tree operations)
- Copy-on-write when forking
- Some nested calls may not perform any operations on the trees (or
perhaps a subset of tree). Forking all the information may unnecessarily
consume memory for deeper nested contexts.
  • Loading branch information
IlyasRidhuan authored Nov 18, 2024
1 parent fc88517 commit 41743d0
Show file tree
Hide file tree
Showing 5 changed files with 1,283 additions and 0 deletions.
2 changes: 2 additions & 0 deletions yarn-project/simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@noir-lang/noirc_abi": "portal:../../noir/packages/noirc_abi",
"@noir-lang/types": "portal:../../noir/packages/types",
"levelup": "^5.1.1",
"lodash.clonedeep": "^4.5.0",
"memdown": "^6.1.1",
"tslib": "^2.4.0"
},
Expand All @@ -81,6 +82,7 @@
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"@types/levelup": "^5.1.3",
"@types/lodash.clonedeep": "^4.5.7",
"@types/lodash.merge": "^4.6.9",
"@types/memdown": "^3.0.2",
"@types/node": "^18.7.23",
Expand Down
Loading

0 comments on commit 41743d0

Please sign in to comment.