-
Notifications
You must be signed in to change notification settings - Fork 42
[version] Restart services on chain or protocol change #884
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
base: main
Are you sure you want to change the base?
Conversation
eaed258
to
8c45672
Compare
8c45672
to
c0bbcbc
Compare
c0bbcbc
to
f4fa6d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors version‐related functionality to ensure that nodes and indexers correctly restart or reset their databases when the chain or protocol version changes. Key changes include:
- Extracting version‐related logic into a separate file and refactoring driver methods (adding FetchVersion and ResetDB).
- Adding a version check loop to both syncer and indexer processes.
- Refining worker task setups and logger usage across the indexer and syncer.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
nil/services/indexer/indexer.go | Refactored version checking, introduced a new logger, and updated worker task configuration. |
nil/services/indexer/fetch_block.go | Removed unused logger variable. |
nil/services/indexer/driver/driver.go | Removed SetupScheme; added FetchVersion and ResetDB methods. |
nil/services/indexer/clickhouse/clickhouse.go | Refactored out SetupScheme in favor of FetchVersion and ResetDB. |
nil/services/indexer/badger/badger.go | Removed SetupScheme and updated the IndexTxPool receiver. |
nil/internal/collate/version.go | Added new version handling functionality for both local and remote version fetching. |
nil/internal/collate/syncer.go | Removed duplicate version retrieval methods and integrated new version check functionality. |
nil/internal/collate/bootstrap.go | Removed version handler logic now handled by the version package. |
nil/common/concurrent/utils.go | Added a new RunTickerLoopWithErr function for ticker loops with error propagation. |
f4fa6d7
to
bfcaa0b
Compare
bfcaa0b
to
384233a
Compare
384233a
to
5de1417
Compare
5de1417
to
fe50415
Compare
|
||
s.Run("RunArchiveNode", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added while debugging failing tests
fe50415
to
925fd7e
Compare
} | ||
|
||
var res common.Hash | ||
res, err = v.fetchGenesisBlockHash(ctx, peerId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can also log error
return nil, err | ||
} | ||
|
||
if !bytes.Equal(localVersion[:], remoteVersion[:]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't hashes comparable via ==
/!=
?
Syncing nodes stop if the chain or protocol version changed.
Indexer stops if the chain version changed.
Changes:
Fixes #769 and #659
Tested locally: