Skip to content

perf(pxe): derive sender tagging finalization from log blocks - #25033

Merged
nchamo merged 3 commits into
merge-train/fairiesfrom
nchamo/optimize-sync-rpc-calls
Jul 29, 2026
Merged

nchamo merged 3 commits into
merge-train/fairiesfrom
nchamo/optimize-sync-rpc-calls

Conversation

@nchamo

@nchamo nchamo commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

We are trying to reduce the RPC calls PXE makes to nodes. We are starting with one of the most common workflows, which runs every time a user sends a message.

How it works now

Before sending a message for a secret, PXE has to pick the next tagging index to use. It queries the node for the logs of a window of tags, starting just above the highest finalized index. It then calls the node again once per pending tx in that window to read its receipt, which includes txs that no log surfaced, such as the ones this PXE sent earlier. A receipt reporting the tx as finalized is what lets us advance the highest finalized index.

The change

A log already carries the block it was mined in, so we no longer need to ask the node about its tx. We compare that block against our locally synced finalized tip instead, and a window whose logs settle every pending tx now costs a single query.

We still fetch receipts for the txs the logs cannot settle. A tx absent from the window needs one to say whether it is still in the mempool or was dropped. A tx whose highest tracked index is missing onchain partially reverted, and only its tx effect tells us which of its tags survived.

One behavior changes. Logs are queried per secret, so finalizing from them advances only the secret being synced, while a receipt covers the whole tx. A tx that also carried logs for another secret keeps its entry there until that secret syncs on its own.

Metrics

Ran the client flow benchmarks on the base commit and on this branch. Every call we save is a receipt fetch. getTxReceipt drops from 35 to 23, which takes the total from 226 to 214, and no other RPC method moves.

Per flow, the savings land on the transfers, which are the flows that emit private logs. The private_fpc variants gain the most because paying through a private FPC means a second private transfer.

Flow RPC calls Round trips getTxReceipt
transfer_1_recursions+private_fpc 38 → 32 24 → 22 11 → 5
transfer_0_recursions+private_fpc 39 → 35 27 → 25 9 → 5
transfer_1_recursions+sponsored_fpc 23 → 21 17 → 15 5 → 3
amm_add_liquidity_1_recursions 39 → 39 27 → 27 4 → 4
token_bridge_claim_private 26 → 26 14 → 14 1 → 1
storage_proof_7_layers 11 → 11 7 → 7 1 → 1

The unchanged flows are the control: they show the change does nothing to workflows that do not send private logs.

The sender tagging sync fetched a receipt for every pending tx in a window. The block a log sits in already says whether its tx is finalized, so a window now usually resolves from its logs query alone. Receipts are fetched only for the txs the logs cannot settle: those absent from the window, and those whose highest tracked index is missing onchain.
@nchamo nchamo added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure ci-draft Run CI on draft PRs. labels Jul 28, 2026
@nchamo nchamo self-assigned this Jul 28, 2026
@nchamo
nchamo marked this pull request as ready for review July 28, 2026 19:14
@nchamo
nchamo requested a review from Thunkar July 28, 2026 19:29

@Thunkar Thunkar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome!

@nchamo
nchamo enabled auto-merge (squash) July 29, 2026 03:04
@AztecBot

Copy link
Copy Markdown
Collaborator

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/b40bc059fbaa00f4�b40bc059fbaa00f48;;�): yarn-project/kv-store/scripts/run_test.sh src/sqlite-opfs/internal/ordered-binary-browser.test.ts (1s) (code: 0)

@nchamo
nchamo merged commit 518f690 into merge-train/fairies Jul 29, 2026
12 checks passed
@nchamo
nchamo deleted the nchamo/optimize-sync-rpc-calls branch July 29, 2026 03:35
nchamo pushed a commit that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants