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

fix(dot/sync): execute p2p handshake when there is no target #3695

Merged
merged 17 commits into from
Jan 18, 2024

Conversation

EclesioMeloJunior
Copy link
Member

Changes

  • Gossamer is not able to run bootstrap sync without a block target, the target is calculated given the peer's block announcements handshake (which contains the peer best block and best hash), so Gossamer waits for peers to send the data.

  • This PR introduces a change in the waitEnoughPeersAndTarget, basically this function after X seconds will, pro-actively, execute a block announcement handshake with the connected bootnodes, given the responses Gossamer can calculates the target and start syncing

Tests

WIP

Issues

Primary Reviewer

@timwu20 @q9f

dot/sync/syncer.go Outdated Show resolved Hide resolved
@dimartiro
Copy link
Contributor

dimartiro commented Jan 16, 2024

Why do we have to wait instead of just start syncing from bootnodes? I guess it is to prevent overload the bootnodes and being a "good samaritan client" but I want to be sure 😅

dimartiro
dimartiro previously approved these changes Jan 16, 2024
Copy link
Contributor

@dimartiro dimartiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea to have introduced the peerViewSet struct, I added a couple of suggestions to take advantage of that structure but they are not blockers

dot/network/light.go Outdated Show resolved Hide resolved
dot/sync/chain_sync.go Outdated Show resolved Hide resolved
dot/sync/chain_sync.go Outdated Show resolved Hide resolved
dot/sync/chain_sync.go Outdated Show resolved Hide resolved
@q9f q9f added the P-high this should be addressed ASAP. label Jan 16, 2024
@EclesioMeloJunior EclesioMeloJunior changed the title fix(dot/sync): execute a block announce when there is no target fix(dot/sync): execute p2p handshake when there is no target Jan 16, 2024
@EclesioMeloJunior
Copy link
Member Author

EclesioMeloJunior commented Jan 16, 2024

Why do we have to wait instead of just start syncing from bootnodes? I guess it is to prevent overload the bootnodes and being a "good samaritan client" but I want to be sure 😅

Actually, this is a good option, we will not overload the network because this is just a handshake, which means we will not act as bad actors since this action will only take place at the start of the node. Will change to don't wait for peers/target but request those informations from bootnode peers and if there is no peers then we should wait

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 57 lines in your changes are missing coverage. Please review.

Comparison is base (e03fa13) 50.55% compared to head (44c08f0) 50.28%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #3695      +/-   ##
===============================================
- Coverage        50.55%   50.28%   -0.27%     
===============================================
  Files              229      230       +1     
  Lines            28605    28663      +58     
===============================================
- Hits             14462    14414      -48     
- Misses           12624    12730     +106     
  Partials          1519     1519              

@P1sar P1sar added the S-network issues related to the dot/network package. label Jan 17, 2024
dot/network/service.go Outdated Show resolved Hide resolved
dot/network/service.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_test.go Outdated Show resolved Hide resolved
dimartiro
dimartiro previously approved these changes Jan 17, 2024
Copy link
Contributor

@dimartiro dimartiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, agree with Axay's comment to remove / uncomment the test cases

Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work, lgtm

Copy link
Contributor

@axaysagathiya axaysagathiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EclesioMeloJunior EclesioMeloJunior merged commit a9db0ec into development Jan 18, 2024
23 of 24 checks passed
@EclesioMeloJunior EclesioMeloJunior deleted the eclesio/start-sync-from-block-announce branch January 18, 2024 12:06
github-actions bot pushed a commit that referenced this pull request Mar 1, 2024
# [0.9.0](v0.8.0...v0.9.0) (2024-3-1)

### Bug Fixes

* add a limit of number of bytes while scale decoding a slice ([#3733](#3733)) ([5edbf89](5edbf89))
* **docs:** Fixing link to polkadot runtime fundamentals to the right one ([#3763](#3763)) ([a785d32](a785d32))
* don't panic if we fail to convert hex to bytes ([#3734](#3734)) ([12234de](12234de))
* **dot/sync:** execute p2p handshake when there is no target ([#3695](#3695)) ([a9db0ec](a9db0ec))
* fix index out of range undeterministic error in rpc test ([#3718](#3718)) ([d099384](d099384))
* fix non deterministic  panic during TestStableNetworkRPC integration test ([#3756](#3756)) ([ee3d243](ee3d243))
* **lib/trie:** use `MustBeHashed` for V1 trie nodes with larger storage values ([#3739](#3739)) ([f5e48a9](f5e48a9))
* **mocks:** Set fixed version for uber mockgen in CI ([#3656](#3656)) ([ea9877e](ea9877e))
* **runtime/storage:** support nested storage transactions ([#3670](#3670)) ([3e99f6d](3e99f6d))
* segfault on node restart ([#3736](#3736)) ([d1ca7aa](d1ca7aa))
* **state-version:** should be uint8 instead of uint32 ([#3779](#3779)) ([c8fdb14](c8fdb14))
* update paseo chain spec ([#3770](#3770)) ([6a54f28](6a54f28))
* use last finalized block on startup ([#3737](#3737)) ([c262642](c262642))

### Features

* **config:** dynamically set version based on environment ([#3693](#3693)) ([5c534c9](5c534c9))
* **staging:** Expose RPC on Westend Staging Node ([#3687](#3687)) ([c374eaa](c374eaa))
* **tests/scripts:** create script to retrieve trie state via rpc ([#3714](#3714)) ([5ccea40](5ccea40))
Copy link

github-actions bot commented Mar 1, 2024

🎉 This PR is included in version 0.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

timwu20 pushed a commit that referenced this pull request Apr 19, 2024
# [0.9.0](v0.8.0...v0.9.0) (2024-3-1)

### Bug Fixes

* add a limit of number of bytes while scale decoding a slice ([#3733](#3733)) ([5edbf89](5edbf89))
* **docs:** Fixing link to polkadot runtime fundamentals to the right one ([#3763](#3763)) ([a785d32](a785d32))
* don't panic if we fail to convert hex to bytes ([#3734](#3734)) ([12234de](12234de))
* **dot/sync:** execute p2p handshake when there is no target ([#3695](#3695)) ([a9db0ec](a9db0ec))
* fix index out of range undeterministic error in rpc test ([#3718](#3718)) ([d099384](d099384))
* fix non deterministic  panic during TestStableNetworkRPC integration test ([#3756](#3756)) ([ee3d243](ee3d243))
* **lib/trie:** use `MustBeHashed` for V1 trie nodes with larger storage values ([#3739](#3739)) ([f5e48a9](f5e48a9))
* **mocks:** Set fixed version for uber mockgen in CI ([#3656](#3656)) ([ea9877e](ea9877e))
* **runtime/storage:** support nested storage transactions ([#3670](#3670)) ([3e99f6d](3e99f6d))
* segfault on node restart ([#3736](#3736)) ([d1ca7aa](d1ca7aa))
* **state-version:** should be uint8 instead of uint32 ([#3779](#3779)) ([c8fdb14](c8fdb14))
* update paseo chain spec ([#3770](#3770)) ([6a54f28](6a54f28))
* use last finalized block on startup ([#3737](#3737)) ([c262642](c262642))

### Features

* **config:** dynamically set version based on environment ([#3693](#3693)) ([5c534c9](5c534c9))
* **staging:** Expose RPC on Westend Staging Node ([#3687](#3687)) ([c374eaa](c374eaa))
* **tests/scripts:** create script to retrieve trie state via rpc ([#3714](#3714)) ([5ccea40](5ccea40))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high this should be addressed ASAP. S-network issues related to the dot/network package.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gossamer sometimes don't start syncing when starting
6 participants