aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

refactor: more robust tagging index sync as sender

Open benesjan opened this issue 3 months ago • 1 comments

In this PR I implement the approach that Nico originally described in this post for sender tagging index sync (for recipient it will be done in a followup PR).

To summarize I do the following:

  1. Associate the tagging index with a hash of a tx in which the corresponding tax was used,
  2. I track the status of the given tx in the tagging data provider,
  3. tagging index status can be either PENDING, FINALIZED or DROPPED_OR_REVERTED (this status is only symbolic as when we realize a corresponding tx has been dropped or reverted we just delete the pending index),
  4. when choosing the next index to use when sending a private log I choose HIGHEST_PENDING_INDEX + 1 (or HIGHEST_FINALIZED_INDEX + 1 if there is no pending index),
  5. if the chosen index is further than WINDOW_LENGTH away from the HIGHEST_FINALIZED_INDEX an error is thrown. This should be a good guarantee of us never losing a log because we are always looking for a WINDOW_LENGTH of logs.

Notes for reviewer

  • I separated TaggingDataProvider into SenderTaggingDataProvider and RecipientTaggingDataProvider because the algorithms are completely disjoint and it makes the code clearer.
  • Moved the syncTaggedLogsAsSender function to pxe/src/tagging directory and renamed it as syncSenderTaggingIndexes. Now PrivateExecutionOracle just calls this function. This is a step in the direction of deprecating PXEOracleInterface and it allowed me to write a reasonably clear unit tests.

Issues created in this PR

  • https://github.com/AztecProtocol/aztec-packages/issues/17775
  • https://github.com/AztecProtocol/aztec-packages/issues/17776

benesjan avatar Oct 09 '25 16:10 benesjan

This stack of pull requests is managed by Graphite. Learn more about stacking.

benesjan avatar Oct 09 '25 16:10 benesjan