fix(pxe): Batch getLogsByTags calls in syncTaggedLogs to prevent RPC limit errors #19181
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.
Title
fix(pxe): Batch
getLogsByTagscalls insyncTaggedLogsto prevent RPC limit errorsDescription
Problem
When simulating or proving transactions, users encounter the error:
I've been getting this error from time to time in both node and browser environments, and it looks like that this has been known problem a few other people have also encountered.
This error occurs inconsistently and becomes more likely as the PXE handles more accounts and contracts during a session.
Root Cause
In
syncTaggedLogs, tags are generated for all registered senders and passed togetLogsByTagsin a single RPC call. The Aztec Node enforces aMAX_RPC_LEN = 100limit on array arguments via Zod validation.The tag count grows as:
number_of_senders × ~11 tags_per_senderEvidence from test logs:
Array must contain at most 100 element(s)As more accounts/contracts are registered with the PXE during test execution, the sender list grows, eventually exceeding the 100 tag limit.
Code Path
Solution
Add batching to
#getPrivateLogsByTagsto chunk tag arrays into batches ofMAX_RPC_LEN(100) before making RPC calls.This follows the existing pattern used by
syncNoteNullifiers, which already correctly batches itsfindLeavesIndexescalls.Changes
#getPrivateLogsByTags: Batch tags into chunks of 100, make multiple RPC calls, merge resultsTesting