You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat|refactor(header/sync): network head determination (#990)
* feat(params|header/sync): dirty intergration of block time into Syncer
Co-authored-by: Rene <[email protected]>
* feat(header): new utility funcs for the ExtendedHeader in preparation for Syncer improvements
Co-authored-by: Rene <[email protected]>
* feat|refactor(header/sync): revision of Syncer's objective head deteremination logic
The previous version of Syncer struggled with two issues:
* On Syncer's start, synchronization didn't start and waited for a gossiped header trigger sync and set a sync target (only when the subjective head was not expired)
* This is why Node could wait up to block time second to start syncing
* There was no way to request the most recent objective header of the network
* I.e. if the user wanted to request the latest possible state, it wasn't able to do that besides waiting for full sync to finish.
The new reimplementation fixes these two problems and improves code readability and docs. Mainly, it splits the existing `trustedHead` into two methods `subjectiveHead` and `objectiveHead`.
Where the latter now relies on the latest known header timestamp and block time to determine its recency.
The new reimplementation fixes these two problems and improves code readability and docs. Mainly, it splits the existing trustedHead into two methods subjectiveHead and objectiveHead.
Where the latter now relies on the latest known header timestamp and block time to determine its recency. If the header is not recent, we request it from the trusted peer(s), assuming it's always synced.
* docs(header/sync): add TODO for potential optimization
* refactor(header/sync): rework Syncer lifecycling
Mainly, allow Start to error so that subsequent Stop does not panic. While also make lifecycle logic less confusing and less error-prone
* fix(node): do not fail the Start for Syncer if it is not initialized, so that Node tests does not fail
* fix(header/sync): use RWLock for sync ranges
Going further, there wiil be multiple readers that should not block each other
* fix(header/sync): ensure objective head is requested only once when many at any moment
* chore(header/sync): cleanup syncing code and update the tests to use WaitSync
* chore(header/sync): documentation, logging and code dispoisiton improvements
* Terminology change from the 'objective head' to the 'network head' consistent over docs and logs
* More logs for unhappy cases + more information for extisting logs
* Extracttion of head retrieval logic into a separate file
* Apply docs suggestions from @renaynay and @liamsi
Co-authored-by: rene <[email protected]>
Co-authored-by: Ismail Khoffi <[email protected]>
* Update header/header.go
Co-authored-by: rene <[email protected]>
Co-authored-by: Rene <[email protected]>
Co-authored-by: rene <[email protected]>
Co-authored-by: Ismail Khoffi <[email protected]>
0 commit comments