feat(archiver): add getL2ToL1MembershipWitness node RPC#23646
Merged
Conversation
2b25c4c to
70aed7d
Compare
3dc43b8 to
c1f2f13
Compare
PhilWindle
reviewed
Jun 1, 2026
| */ | ||
| export class OutboxTreesResolver { | ||
| /** In-memory cache of per-epoch Outbox roots, keyed by epoch number. */ | ||
| #cache: Map<number, CachedRoots> = new Map(); |
Collaborator
There was a problem hiding this comment.
Could use a branded type for the key?
PhilWindle
approved these changes
Jun 1, 2026
c1f2f13 to
2219238
Compare
2219238 to
e580e59
Compare
Adds a node RPC returning the L2-to-L1 message membership witness for a message in a tx, built by the archiver against the smallest partial-proof Outbox root covering the tx's checkpoint. Outbox roots are fetched lazily and cached in memory, pinned to the node's synced L1 block and re-fetched once it advances. The witness receipt (epoch / block / txIndex) is derived from getTxEffect.
e580e59 to
581464f
Compare
danielntmd
pushed a commit
to danielntmd/aztec-packages
that referenced
this pull request
Jun 4, 2026
BEGIN_COMMIT_OVERRIDE chore: deploy next-net and reuse contracts (AztecProtocol#23761) chore: turn on autoscaling (AztecProtocol#23706) chore: rename staging-public to staging (AztecProtocol#23767) chore(p2p): use sync hash for tx validation hashing (AztecProtocol#23768) test(e2e): wait warmup slots in slashing tests (AztecProtocol#23719) feat(api)!: make getTxReceipt the single tx-lookup API (AztecProtocol#23660) fix: cap cloned n_tps fees within sponsored FPC balance (AztecProtocol#23770) fix: protect HA validator Postgres from cluster scale-down (AztecProtocol#23772) refactor: remove non-pipelining sequencer code path (AztecProtocol#23665) feat(archiver): add getL2ToL1MembershipWitness node RPC (AztecProtocol#23646) fix(p2p)!: revamp BLOCK_TXS validations (AztecProtocol#23778) chore: name the bots (AztecProtocol#23795) fix(e2e): ensure BBSync init (AztecProtocol#23793) fix(p2p)!: fix BLOCK_TXS response under proposer equivocation (AztecProtocol#23786) fix: reconnect L1 port-forward after epoch-boundary sleep in n_tps_prove (AztecProtocol#23800) chore: add empty vscode settings for yarn-project (AztecProtocol#23808) fix(sequencer): only warn about missing proposed checkpoint once overdue (AztecProtocol#23807) fix: refresh n_tps fee quotes during sustained benchmark (AztecProtocol#23797) fix(sequencer): enforce build-frame deadlines and align attestation/publish windows (AztecProtocol#23776) END_COMMIT_OVERRIDE
spalladino
added a commit
that referenced
this pull request
Jun 4, 2026
## Motivation `v5-next` was cut from `next` at cbc99df (Jun 1), so PRs merged to `merge-train/spartan` after the cut never flowed into it. This backports all of them (authored by @spalladino and @fcarreiro) to keep v5-next current with the spartan train. ## Approach Each PR is cherry-picked from its squashed merge commit on `merge-train/spartan`, in merge order, preserving the original commit message and PR number — one commit per backported PR. All 11 applied cleanly with no conflicts; patches are identical to the originals (verified via `git patch-id`), and `bootstrap.sh build yarn-project` passes on the result. Labeled `ci-no-squash` to preserve the per-PR commits. ## Backported PRs - #23768 — chore(p2p): use sync hash for tx validation hashing - #23719 — test(e2e): wait warmup slots in slashing tests - #23660 — feat(api)!: make getTxReceipt the single tx-lookup API - #23665 — refactor: remove non-pipelining sequencer code path - #23646 — feat(archiver): add getL2ToL1MembershipWitness node RPC - #23778 — fix(p2p)!: revamp BLOCK_TXS validations - #23786 — fix(p2p)!: fix BLOCK_TXS response under proposer equivocation - #23808 — chore: add empty vscode settings for yarn-project - #23807 — fix(sequencer): only warn about missing proposed checkpoint once overdue - #23776 — fix(sequencer): enforce build-frame deadlines and align attestation/publish windows - #23818 — chore(p2p): BlockTxsRequest comment Note #23660, #23778, and #23786 are breaking changes (node RPC + tx-effect db format, and p2p wire format respectively), as they were on `next`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Building an L2-to-L1 message membership witness is currently a client-side responsibility: callers hand
computeL2ToL1MembershipWitnessanOutboxRootsReaderplus a node, and the helper reads the L1 Outbox and rebuilds the full four-level message tree on every call, which involves sending all messages for an entire epoch to the client. This adds a node JSON-RPC method that does the work centrally, behind a cache.As of this PR, the cache only caches reads to the Outbox and for a single L1 slot, but the intent is to eventually cache the individual L2-to-L1 trees so we don't have to recompute them on every request, as well as permanently cache data for an epoch once it's finalized.
Fixes A-653
Approach
A new
OutboxTreesResolverin the archiver resolves witness requests. Roots are fetched lazily on request and re-fetched only when the node's synced L1 block has advanced. The four tree levels are rebuilt per request by delegating to the existing, unchangedcomputeL2ToL1MembershipWitnesshelper with the cached roots array, so there is no second cache to keep consistent. The resolver is exposed through the archiver (the node's block source) and surfaced asAztecNode.getL2ToL1MembershipWitness.Changes
OutboxTreesResolver(lazy roots cache, single-flight de-duplication, witness assembly).getL2ToL1MembershipWitnessto theAztecNode/L2BlockSource/ archiver interfaces and schemas; exportL2ToL1MembershipWitnessSchema. ThecomputeL2ToL1MembershipWitnesshelper is unchanged.AztecNodeService.getL2ToL1MembershipWitnesspassthrough to the block source.OutboxContract.getRootsgains an optional{ blockNumber }read option so reads can be pinned to the node's synced L1 block.computeL2ToL1MembershipWitnesscall sites to the new RPC, wrapped inretryUntilfor the cache's eventual consistency. The synthetic-roots case inepochs_partial_proof_multi_rootkeeps using the helper directly.outbox_trees_resolver.test.tscovering the lazy cache (refresh-on-advance, seal/finalize permanence, not-synced handling), single-flight, witness correctness across partial-proof depths and block-level compression, and transient-vs-genuine root mismatch handling.