-
Notifications
You must be signed in to change notification settings - Fork 575
refactor: more robust tagging index sync as sender #17611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
73a8f6d to
778aeaa
Compare
588cef2 to
39f19c1
Compare
ceb0929 to
d100cf8
Compare
778aeaa to
0a26d3b
Compare
0a26d3b to
16795d9
Compare
977b053 to
dfec582
Compare
dfec582 to
f04c9c9
Compare
yarn-project/pxe/src/contract_function_simulator/execution_data_provider.ts
Outdated
Show resolved
Hide resolved
yarn-project/pxe/src/contract_function_simulator/pxe_oracle_interface.test.ts
Show resolved
Hide resolved
yarn-project/pxe/src/contract_function_simulator/pxe_oracle_interface.ts
Show resolved
Hide resolved
yarn-project/pxe/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts
Show resolved
Hide resolved
bcf2da9 to
4f1a6ee
Compare
nventuro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a lot of comments since this is a very large PR. In hindsight we probably should've implemented some of the logic e.g. re. to pending or to processing in separate prs, and then merged that with pxe's work. So unfortutunately there's lots of comments both big and small in the mix.
Sorry it took so long to review this. Thanks for the effort in keeping it up to date and as understandable as possible.
yarn-project/pxe/src/contract_function_simulator/oracle/private_execution_oracle.ts
Outdated
Show resolved
Hide resolved
yarn-project/pxe/src/storage/tagging_data_provider/sender_tagging_data_provider.test.ts
Show resolved
Hide resolved
yarn-project/pxe/src/storage/tagging_data_provider/sender_tagging_data_provider.ts
Outdated
Show resolved
Hide resolved
yarn-project/pxe/src/storage/tagging_data_provider/sender_tagging_data_provider.ts
Outdated
Show resolved
Hide resolved
yarn-project/pxe/src/storage/tagging_data_provider/sender_tagging_data_provider.ts
Outdated
Show resolved
Hide resolved
yarn-project/pxe/src/tagging/sync/sync_sender_tagging_indexes.ts
Outdated
Show resolved
Hide resolved
e2f9768 to
a55fa6b
Compare
nventuro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The improvements are excellent, thank you very much for going through my comments and considering each of them.
In this PR I implement the approach that Nico originally described in [this post](https://forum.aztec.network/t/on-note-discovery-and-index-coordination/7165) 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 - #17775 - #17776 Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
e52830e to
eb5f940
Compare
In this PR I implement the approach that Nico originally described in [this post](https://forum.aztec.network/t/on-note-discovery-and-index-coordination/7165) 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 - #17775 - #17776
In this PR I implement the approach that Nico originally described in [this post](https://forum.aztec.network/t/on-note-discovery-and-index-coordination/7165) 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 - #17775 - #17776

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:
HIGHEST_PENDING_INDEX + 1(orHIGHEST_FINALIZED_INDEX + 1if there is no pending index),Notes for reviewer
TaggingDataProviderintoSenderTaggingDataProviderandRecipientTaggingDataProviderbecause the algorithms are completely disjoint and it makes the code clearer.syncTaggedLogsAsSenderfunction topxe/src/taggingdirectory and renamed it assyncSenderTaggingIndexes. NowPrivateExecutionOraclejust calls this function. This is a step in the direction of deprecatingPXEOracleInterfaceand it allowed me to write a reasonably clear unit tests.Issues created in this PR
PXEOracleInterface#17776