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

Endpoint for note syncing #409

Closed
bobbinth opened this issue Jul 16, 2024 · 4 comments
Closed

Endpoint for note syncing #409

bobbinth opened this issue Jul 16, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request rpc Related to the RPC component store Related to the store component
Milestone

Comments

@bobbinth
Copy link
Contributor

As described in 0xPolygonMiden/miden-client#405 (comment), it may be beneficial to have an endpoint which works similar to the SyncState but is limited only to retrieving note data.

The endpoint could be called NoteSync and could look as follows:

Parameters

  • block_num: uint32 – send notes created starting at this block.
  • note_tags: [uint32] – send notes matching these tags.

Returns

  • chain_tip: uint32 – number of the latest block in the chain.
  • block_header: BlockHeader – block header of the block with the first note matching the specified criteria.
  • mmr_delta: MmrDelta – data needed to update the partial MMR from request.block_num + 1 to response.block_header.block_num.
  • notes: [NoteSyncRecord] – a list of all notes together with the Merkle paths from response.block_header.note_root.

One open question is how exactly we should handle the mmr_delta here (or if there is a better way to send this info to the client).

@bobbinth bobbinth added enhancement New feature or request store Related to the store component rpc Related to the RPC component labels Jul 16, 2024
@bobbinth bobbinth added this to the v0.5 milestone Jul 16, 2024
@Mirko-von-Leipzig
Copy link
Contributor

Mirko-von-Leipzig commented Jul 31, 2024

I'm trying to understand how this gets used. Am I understanding correctly that the response only returns the delta up to the first matching block?

And that chain_tip is only there to suggest to the user that he ought to call the method again with request.block_num = response.block_header.block_num until he catches the notes he is interested in?

@Mirko-von-Leipzig
Copy link
Contributor

One open question is how exactly we should handle the mmr_delta here (or if there is a better way to send this info to the client).

Does this also apply to the state sync endpoint? If not, what makes the two queries different aside from less data?

@bobbinth
Copy link
Contributor Author

I'm trying to understand how this gets used. Am I understanding correctly that the response only returns the delta up to the first matching block?

Correct.

And that chain_tip is only there to suggest to the user that he ought to call the method again with request.block_num = response.block_header.block_num until he catches the notes he is interested in?

Also correct. The motivation for this is to provide a sort of "context-independent pagination". We can improve on this by streaming responses as discussed in #174. Also, I think we should impose a limit on the span of time covered by a response (e.g., 1 epoch). This way, no response will cover more than 1 epoch which could simplify dealing with this on the database level in the future.

Does this also apply to the state sync endpoint? If not, what makes the two queries different aside from less data?

Yes - the main (only?) difference is that state sync also deals with accounts and nullifiers, but note sync is purely for syncing notes.

@Dominik1999 Dominik1999 moved this to In Progress in User's testnet Aug 5, 2024
@Dominik1999 Dominik1999 moved this from In Progress to In Review in User's testnet Aug 5, 2024
@bobbinth
Copy link
Contributor Author

bobbinth commented Aug 5, 2024

Closed by #424.

@bobbinth bobbinth closed this as completed Aug 5, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in User's testnet Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rpc Related to the RPC component store Related to the store component
Projects
Status: Done
Development

No branches or pull requests

2 participants