ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
427 stars 111 forks source link

Gossamer sync target is not being correctly updated #4184

Open EclesioMeloJunior opened 1 day ago

EclesioMeloJunior commented 1 day ago

Task summary

The problem is: the calculation is giving a small value which is not allowing Gossamer to request more blocks, for example in this logs:

2024-09-18T13:10:06Z INFO relevant announced block #22631044 (0x3f4876cc...6cce68e2) pkg=sync
2024-09-18T13:10:06Z INFO updating peer 12D3KooWJ4UzytYirRHP87seufMAX8zi31FP7gES6qBMeAFvhFkT view to #22631044 (0x3f4876cc...6cce68e2) pkg=sync
2024-09-18T13:10:08Z INFO 🚣 currently syncing, 63 peers connected, finalized #22629888 (0x53454215...d6391b48), best #22630262 (0xdb3a0e53...f2d48962) pkg=sync
2024-09-18T13:10:08Z INFO [FINISHED] worker 12D3KooWDf4EUyhsNzuQnxayCHiUobXFV4P6jw1ZzyNmy7myn9a8, request: BlockRequestMessage RequestedData=19 StartingBlock={22630263} Direction=0 Max=1 pkg=sync

Even though we received a block announce for block #22631044, we issue a request asking just for block #22630263.

The fix should allow Gossamer to not lag behind, like in this case and stay up to date with the announcements of the network

haikoschol commented 1 day ago

What's the rationale for choosing the mean height for the target instead of the highest available?

EclesioMeloJunior commented 1 day ago

I don't have a answer for that, I would say that is to not be biased for a single peer.

EclesioMeloJunior commented 9 hours ago

Changed it to use the highest instead of mean and then the sync stay much more stable! Thanks for the comment @haikoschol

image image