Skip to content
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

feat(rpc): SyncNotes endpoint #424

Merged
merged 9 commits into from
Aug 5, 2024
Merged

feat(rpc): SyncNotes endpoint #424

merged 9 commits into from
Aug 5, 2024

Conversation

Mirko-von-Leipzig
Copy link
Contributor

Closes #409.

The implementation is essentially a clone of SyncState with some parts left off. Which makes me believe I've misunderstood the assignment :)

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left some comments inline.

Overall, I think this looks right - but there are two questions I have and probably @igamigo and @tomyrd are the ones best positioned to answer them:

  • Do we need to include the transactions field in the response (similar to how we have it for state sync). It seems to me that we don't - but I also haven't thought it through completely.
  • Would the client be able to use the MMR info returned from this endpoint to update its MMR correctly? On the client side, this will probably work somewhat differently from how state sync works because this endpoint would be invoked at the time when the client's MMR is "in the future" compared to the requested data.

proto/requests.proto Outdated Show resolved Hide resolved
proto/requests.proto Outdated Show resolved Hide resolved
proto/requests.proto Outdated Show resolved Hide resolved
crates/store/src/server/api.rs Outdated Show resolved Hide resolved
@igamigo
Copy link
Collaborator

igamigo commented Aug 1, 2024

Do we need to include the transactions field in the response (similar to how we have it for state sync). It seems to me that we don't - but I also haven't thought it through completely.

I don't think this is necessary.

Would the client be able to use the MMR info returned from this endpoint to update its MMR correctly? On the client side, this will probably work somewhat differently from how state sync works because this endpoint would be invoked at the time when the client's MMR is "in the future" compared to the requested data.

After reviewing it a little bit, I think returning a Merkle path here is better and makes for a cleaner handling of the response on the client side. More so if we assume the client is going to call the endpoint after having synced past the block of the note's creation.

@bobbinth
Copy link
Contributor

bobbinth commented Aug 1, 2024

After reviewing it a little bit, I think returning a Merkle path here is better and makes for a cleaner handling of the response on the client side. More so if we assume the client is going to call the endpoint after having synced past the block of the note's creation.

Yes - I came to a similar conclusion. Basically, we just need the MmrProof for the returned block header. And we can get this directly from the in-memory MMR.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left a few more comments inline.

proto/requests.proto Outdated Show resolved Hide resolved
proto/requests.proto Outdated Show resolved Hide resolved
proto/responses.proto Outdated Show resolved Hide resolved
crates/store/src/state.rs Outdated Show resolved Hide resolved
crates/store/src/state.rs Outdated Show resolved Hide resolved
crates/store/src/state.rs Outdated Show resolved Hide resolved
crates/store/src/db/sql.rs Outdated Show resolved Hide resolved
crates/store/src/db/sql.rs Outdated Show resolved Hide resolved
crates/store/src/db/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@tomyrd tomyrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I agree with what @igamigo said, we will need to test it in the client but I think it will work.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left a few more minor comments inline. After these are addressed we can merge.

crates/store/src/db/sql.rs Outdated Show resolved Hide resolved
crates/store/src/state.rs Outdated Show resolved Hide resolved
crates/store/src/state.rs Outdated Show resolved Hide resolved
crates/store/src/state.rs Show resolved Hide resolved
proto/responses.proto Outdated Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good! Thank you!

@bobbinth bobbinth merged commit 481a7b6 into next Aug 5, 2024
9 checks passed
@bobbinth bobbinth deleted the note-endpoint branch August 5, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants