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

Refactor sync package to use the strategy approach #4112

Open
EclesioMeloJunior opened this issue Jul 31, 2024 · 0 comments · May be fixed by #4114
Open

Refactor sync package to use the strategy approach #4112

EclesioMeloJunior opened this issue Jul 31, 2024 · 0 comments · May be fixed by #4114
Assignees
Labels
C-complex Complex changes across multiple modules. Possibly will require additional research. P-high this should be addressed ASAP. S-network issues related to the dot/network package. T-enhancement this issue/pr covers improvement of existing functionality.

Comments

@EclesioMeloJunior
Copy link
Member

EclesioMeloJunior commented Jul 31, 2024

Issue summary

  • Currently, Gossamer sync package is full writing for full sync method, so everything in the sync package is a lot coupled and there is no room to expand or introduce a new sync strategy, such as Warp Sync, without a huge code change.

  • What I am proposing here is to change the sync package a single SyncService and this service contains a strategy that can be FullSyncStrategy or WarpSyncStrategy both implementing the interface Strategy and all that the SyncService knows is that it has a property strategy of type Strategy.

  • The SyncService works in a loop that execs the following actions:

  1. Acquire the strategy.NextActions()
  2. Execute the next actions
  3. Pass the results to strategy.IsFinished()
  4. Check if the strategy is done, if so move to the default strategy, otherwise go to step 1
  • The implementation of the Strategy interface does not need to have any knowledge about network or workers, it should only know about its current state like: forks, fragments, blocks announced

The approach is explained in this PDF
WARP Sync slides (1).pdf

@EclesioMeloJunior EclesioMeloJunior added S-network issues related to the dot/network package. C-complex Complex changes across multiple modules. Possibly will require additional research. T-enhancement this issue/pr covers improvement of existing functionality. P-high this should be addressed ASAP. labels Jul 31, 2024
@EclesioMeloJunior EclesioMeloJunior self-assigned this Jul 31, 2024
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-high this should be addressed ASAP. S-network issues related to the dot/network package. T-enhancement this issue/pr covers improvement of existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant