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

Implement state sync strategy #4238

Open
dimartiro opened this issue Oct 9, 2024 · 1 comment · May be fixed by #4425
Open

Implement state sync strategy #4238

dimartiro opened this issue Oct 9, 2024 · 1 comment · May be fixed by #4425
Assignees
Labels
C-complex Complex changes across multiple modules. Possibly will require additional research. P-low this is mostly nice to have. S-network issues related to the dot/network package. T-feat this issue/pr is a new feature or functionality.

Comments

@dimartiro
Copy link
Contributor

dimartiro commented Oct 9, 2024

When the warp sync finished getting the fragments and its completed, we need to request and import the latest state.
This is a task that could take time and needs its own logic to be handle correctly.
For this reason we are not going to implement the state sync as part of the warp sync, instead, we are going to implement it as an independent strategy that might be run right after the warp sync strategy finished.

  • OnBlockAnnounceHandshake: Will update the best block hash / number for that peer
  • OnBlockAnnounce: same than OnBlockAnnounceHandshake
  • NextActions : Will return a state request
  • Process: Will process the response and import the state

We can read more about how the state sync is started after warp sync finishes here

An idea of how to implement the state sync strategy based on parity's implementation is here

Open questions:

  • How can we update the babe randomenss and validate babe to import new blocks after executing the state sync?
@dimartiro dimartiro self-assigned this Oct 9, 2024
@dimartiro dimartiro added C-complex Complex changes across multiple modules. Possibly will require additional research. S-network issues related to the dot/network package. P-low this is mostly nice to have. T-feat this issue/pr is a new feature or functionality. labels Oct 9, 2024
@dimartiro
Copy link
Contributor Author

dimartiro commented Oct 17, 2024

How can we update the babe randomenss and validate babe to import new blocks after executing the state sync?

Some findings regarding how to update the babe randomness using the state (so we can validate babe and import blocks on top of that)

https://github.com/paritytech/polkadot-sdk/blob/a2c75758034d920f4b163685377df2ef7a1c9299/substrate/client/consensus/babe/src/lib.rs#L1375

https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/consensus/grandpa/src/import.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-complex Complex changes across multiple modules. Possibly will require additional research. P-low this is mostly nice to have. S-network issues related to the dot/network package. T-feat this issue/pr is a new feature or functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant