Skip to content

refactor(pxe): batch tagged private log queries across all secrets#23048

Merged
nchamo merged 1 commit intomerge-train/fairiesfrom
nchamo/more-rpc-optimizations
May 8, 2026
Merged

refactor(pxe): batch tagged private log queries across all secrets#23048
nchamo merged 1 commit intomerge-train/fairiesfrom
nchamo/more-rpc-optimizations

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented May 7, 2026

Why we are doing this

Previously, LogService.fetchTaggedLogs ran one loadPrivateLogsForSenderRecipientPair call per sender-recipient secret, all in parallel via Promise.all. Each of those calls independently issued RPC requests to fetch logs by tag. With many secrets (many senders), this produced N concurrent RPC round-trips to the node — one per secret per iteration.

Our fix

Replace the per-pair function with syncTaggedPrivateLogs, which accepts all secrets at once and merges their tags into a single flat array before calling getAllPrivateLogsByTags. That function already chunks internally at MAX_RPC_LEN, so the total number of node calls scales with the total number of tags across all secrets rather than the number of secrets.

The sync loop still advances windows per-secret (only secrets whose finalized index moved forward go into the next round), so correctness is unchanged. The two deleted files (load_private_logs_for_sender_recipient_pair.ts and utils/load_logs_for_range.ts) are fully subsumed by the new sync_tagged_private_logs.ts.

@nchamo nchamo self-assigned this May 7, 2026
@AztecBot
Copy link
Copy Markdown
Collaborator

AztecBot commented May 7, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/7a696aa82b91182c�7a696aa82b91182c8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_mbps.pipeline.parallel.test.ts "pipelining builds blocks using slot plus 1 proposer and proves them" (365s) (code: 0) group:e2e-p2p-epoch-flakes

@nchamo nchamo requested a review from mverzilli May 7, 2026 16:34
Copy link
Copy Markdown
Contributor

@Thunkar Thunkar left a comment

Choose a reason for hiding this comment

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

I'd also tag @benesjan since he has the most experience on this code. When I initially implemented note syncing it looked a lot like this, but eventually evolved to the current form. I like this approach a lot, but I'd like to get his input

Copy link
Copy Markdown
Contributor

@mverzilli mverzilli left a comment

Choose a reason for hiding this comment

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

Beautiful!

@nchamo nchamo merged commit c2ad4b1 into merge-train/fairies May 8, 2026
14 checks passed
@nchamo nchamo deleted the nchamo/more-rpc-optimizations branch May 8, 2026 10:22
@AztecBot
Copy link
Copy Markdown
Collaborator

AztecBot commented May 8, 2026

✅ Successfully backported to backport-to-v4-next-staging #23080.

AztecBot added a commit that referenced this pull request May 9, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-up): Aztec installer does not shadow user installed binaries
on PATH (#22902)
fix: include sqlite binary in its npm package (#23039)
chore: backport #23041 (add sendMessagesAs to wallet api schemas) to
v4-next (#23081)
chore: backport DeployMethod refactor (#22985) to v4-next (#23029)
refactor(pxe): deduplicate tx hash lookups in MessageContextService
(#23075)
refactor(pxe): batch tagged private log queries across all secrets
(#23048)
refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088)
feat(aztec-nr): Initial handshake registry contract with non interactive
handshake function (#22854)
fix: add Tag.random() helper required by backported #23088 tests
(#23094)
chore: backport: fix(aztec-up): installer does not shadow user binaries
on PATH (#22902) (#23060)
chore: backport handshake registry contract (#22854) to v4-next (#23063)
feat: deploy method refactor 2 (#23033)
refactor(pxe): skip redundant getBlock RPC when querying at anchor block
(#23100)
port(v4-next): feat(docs): autogenerate node JSON-RPC API reference
(#22543) (#23046)
chore: backport feat: deploy method refactor 2 (#23033) to v4-next
(#23103)
port(v4-next): feat(ci): Snapshots for aztec-nr contract compilation
failures and nargo expand (#23061) (#23104)
feat(txe): allow authorizing cross-contract utility calls in nr tests
(#23064)
END_COMMIT_OVERRIDE
github-merge-queue Bot pushed a commit that referenced this pull request May 10, 2026
BEGIN_COMMIT_OVERRIDE
fix: include sqlite binary in its npm package (#23039)
fix: add sendMessagesAs to wallet api schemas (#23041)
refactor(pxe): deduplicate tx hash lookups in MessageContextService
(#23075)
refactor(pxe): batch tagged private log queries across all secrets
(#23048)
refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088)
feat(pxe,nr): flesh out account stubs and don't exclude syncing for
overrides (#23054)
feat: deploy method refactor 2 (#23033)
feat: fastForwardContractUpdate cheatcode for simulating contract
updates (#22905)
refactor(stdlib): consolidate find-function-by-selector helpers (#23008)
feat(ci): Snapshots for aztec-nr contract compilation failures and nargo
expand (#23061)
chore: kv store test fully on vitest (#23096)
refactor(pxe): skip redundant getBlock RPC when querying at anchor block
(#23100)
chore(playground): bump main chunk size limit 1750 → 1800 KB (#23107)
feat(txe): allow authorizing cross-contract utility calls in nr tests
(#23064)
chore: bench public fns with emit repro (#23105)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants