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

Add a function for syncing blocks from Zebra's non-finalized best chain to a ReadStateService in another process #8576

Closed
arya2 opened this issue Jun 3, 2024 · 0 comments · Fixed by #8596
Assignees
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes C-feature Category: New features

Comments

@arya2
Copy link
Contributor

arya2 commented Jun 3, 2024

Motivation

We want the ChainTipChange struct to work in a separate process so it can be used in zebra-scan and/or the indexer.

We also want to have access to all of Zebra's best chain via the ReadStateService from another process, including blocks in the non-finalized portion of Zebra's best chain.

Note: Accessing the finalized portion of Zebra's best chain should only require a ReadStateService initialized with a read-only ZebraDb using the same cache directory (except maybe when Zebra is configured to use an ephemeral state).

Design

Add a function in zebra-rpc that:

  • Polls the getbestblockhash method to check if a process has the latest best chain tip in Zebra
  • Calls the getblock method to sync any blocks in Zebra that are missing in the new process
  • Infers when there's been a chain fork/reorganization and re-syncs all of the blocks past the finalized tip from Zebra
  • Sends new blocks to the LatestChainTip channel used by ChainTipChange

This function could returns a ChainTipChange struct, or accept a ChainTipSender.

@arya2 arya2 added A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes labels Jun 3, 2024
@arya2 arya2 self-assigned this Jun 3, 2024
@github-project-automation github-project-automation bot moved this to New in Zebra Jun 3, 2024
@arya2 arya2 added the C-feature Category: New features label Jun 3, 2024
@mpguerra mpguerra moved this from New to Sprint Backlog in Zebra Jun 4, 2024
@mpguerra mpguerra moved this from Sprint Backlog to In progress in Zebra Jun 6, 2024
@mpguerra mpguerra moved this from In progress to Review/QA in Zebra Jun 17, 2024
@mergify mergify bot closed this as completed in #8596 Jul 9, 2024
@github-project-automation github-project-automation bot moved this from Review/QA to Done in Zebra Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes C-feature Category: New features
Projects
Archived in project
1 participant