File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
yarn-project/pxe/src/tagging/sync Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,16 @@ export async function syncSenderTaggingIndexes(
5050 // hard limit we give a guarantee to a recipient that he doesn't need to look further than WINDOW_LEN ahead of the
5151 // highest finalized index.
5252 //
53- // This function synchronizes these two values by iteratively querying the node for a window of indexes at a time,
54- // storing all those indexes as pending, and then checking the status of each pending index to update its
55- // finalization status accordingly.
53+ // This function synchronizes the finalized and pending indexes by iteratively querying the node for a window of
54+ // indexes at a time, storing all those indexes as pending, and then checking the status of each pending index to
55+ // update its finalization status accordingly. If we stumble upon a window with no indexes, we stop the loop.
56+ //
57+ // Stopping at that point is safe because of the limit described above - there can never be an index that is more
58+ // than WINDOW_LEN from the highest finalized index.
59+ //
60+ // # Note on performance
61+ // Each window advance requires two queries (logs + tx status). For example, syncing indexes 0–500 with a window of
62+ // 100 takes at least 10 round trips (5 windows × 2 queries).
5663
5764 const finalizedIndex = await taggingDataProvider . getLastFinalizedIndex ( secret ) ;
5865
You can’t perform that action at this time.
0 commit comments