-
Notifications
You must be signed in to change notification settings - Fork 575
refactor!: splitting getLogsByTags to private and public versions
#19158
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
a36eb2f to
1a47f83
Compare
yarn-project/pxe/src/contract_function_simulator/pxe_oracle_interface.ts
Outdated
Show resolved
Hide resolved
7f81d21 to
e225434
Compare
528b8ae to
19b00c9
Compare
e225434 to
8b2772a
Compare
getLogsByTags to private and public versions
getLogsByTags to private and public versionsgetLogsByTags to private and public versions
8b2772a to
cd892e9
Compare
yarn-project/pxe/src/contract_function_simulator/noir-structs/log_retrieval_request.ts
Show resolved
Hide resolved
yarn-project/pxe/src/tagging/recipient_sync/utils/load_logs_for_range.test.ts
Show resolved
Hide resolved
mverzilli
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.
Approving because it's overall good and I won't be around to approve later, but we probably should also add migration notes, shouldn't we?
yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts
Outdated
Show resolved
Hide resolved
yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts
Outdated
Show resolved
Hide resolved
yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts
Outdated
Show resolved
Hide resolved
| const txEffect = await TxEffect.random(); | ||
| txEffect.privateLogs = mockPrivateLogs(blockNumber, txIndex); | ||
| txEffect.publicLogs = mockPublicLogs(blockNumber, txIndex); | ||
| txEffect.publicLogs = []; // No public logs needed for private log tests |
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.
Shouldn't we test some cases with public logs? Even when we know the implementation handles it well now, we probably want to spec that, especially consider the LogStore processes and reduces logs of both types at the same time
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.
There is a new block of tests for getPublicLogsByTagsFromContract. Or do you think they are insufficient.
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.
Archiver changes look good to me, and agree with @mverzilli on extracting some helpers to make it easier to follow. I also agree with him in that you are a really nice person.
6da68b6 to
0d69348
Compare
Indeed, I have some more changes to this endpoint in the pipeline and I plan on writing them once I am done with those. But thanks for reminding me |
859acfe to
f88fa5c
Compare
Fixes #14555 ## New PR Description As mentioned in the old PR description I originally planned to just type the arg of `getLogsByTags` but while addressing this PR's feedback I realized that I made a mistake: the `getLogsByTags` endpoint was used for both private and public logs and the issue is that for public logs we use "unsiloed" tag and for private logs we use siloed tag. Having these 2 endpoints merged was just a tech debt: there is not a place where we would call this endpoint expecting only 1 type of logs. This led to us having ugly utilities that filtered out one kind of logs after retrieval. We didn't split this before because we didn't want to introduce a breaking change to the API. Given that I am already breaking backwards compatibility and given the error I made it made sense to fix this by splitting the two endpoints. Now we have `getPrivateLogsByTag` and `getPublicLogsByTagsFromContract` endpoints. ## Old PR Description In this PR I used the `SiloedTag` type for the param in `getLogsByTags`. This allowed me to drop some ugly type conversions. This was just a tech debt. The diff turned out to be quite large because I needed to move the type from `pxe` to `stdlib`. As mentioned in a PR down the stack this is second of 3 PRs in which I clean up the `getLogsByTags` endpoint: 1. First PR - including block timestamp in return value, 2. This is the second PR - I type the tag arg of the function to be `SiloedTag`, 3. in the last PR I will drop pagination from this endpoint. Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
f88fa5c to
e8de31f
Compare
…19158) Fixes #14555 ## New PR Description As mentioned in the old PR description I originally planned to just type the arg of `getLogsByTags` but while addressing this PR's feedback I realized that I made a mistake: the `getLogsByTags` endpoint was used for both private and public logs and the issue is that for public logs we use "unsiloed" tag and for private logs we use siloed tag. Having these 2 endpoints merged was just a tech debt: there is not a place where we would call this endpoint expecting only 1 type of logs. This led to us having ugly utilities that filtered out one kind of logs after retrieval. We didn't split this before because we didn't want to introduce a breaking change to the API. Given that I am already breaking backwards compatibility and given the error I made it made sense to fix this by splitting the two endpoints. Now we have `getPrivateLogsByTag` and `getPublicLogsByTagsFromContract` endpoints. ## Old PR Description In this PR I used the `SiloedTag` type for the param in `getLogsByTags`. This allowed me to drop some ugly type conversions. This was just a tech debt. The diff turned out to be quite large because I needed to move the type from `pxe` to `stdlib`. As mentioned in a PR down the stack this is second of 3 PRs in which I clean up the `getLogsByTags` endpoint: 1. First PR - including block timestamp in return value, 2. This is the second PR - I type the tag arg of the function to be `SiloedTag`, 3. in the last PR I will drop pagination from this endpoint.

Fixes #14555
New PR Description
As mentioned in the old PR description I originally planned to just type the arg of
getLogsByTagsbut while addressing this PR's feedback I realized that I made a mistake: thegetLogsByTagsendpoint was used for both private and public logs and the issue is that for public logs we use "unsiloed" tag and for private logs we use siloed tag.Having these 2 endpoints merged was just a tech debt: there is not a place where we would call this endpoint expecting only 1 type of logs. This led to us having ugly utilities that filtered out one kind of logs after retrieval.
We didn't split this before because we didn't want to introduce a breaking change to the API.
Given that I am already breaking backwards compatibility and given the error I made it made sense to fix this by splitting the two endpoints.
Now we have
getPrivateLogsByTagandgetPublicLogsByTagsFromContractendpoints.Old PR Description
In this PR I used the
SiloedTagtype for the param ingetLogsByTags. This allowed me to drop some ugly type conversions. This was just a tech debt.The diff turned out to be quite large because I needed to move the type from
pxetostdlib.As mentioned in a PR down the stack this is second of 3 PRs in which I clean up the
getLogsByTagsendpoint:SiloedTag,