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

network: update syncQueue to track sent/received requests by hash #1518

Closed
noot opened this issue Apr 12, 2021 · 5 comments
Closed

network: update syncQueue to track sent/received requests by hash #1518

noot opened this issue Apr 12, 2021 · 5 comments

Comments

@noot
Copy link
Contributor

noot commented Apr 12, 2021

Task summary

  • currently, the syncQueue tracks requests by number, not hash
  • this is fine when syncing the chain, but at the head, we want to request blocks by hash since there are small chain forks
  • currently we only request blocks by hash when needing to get a parent block we don't currently have
  • update syncQueue to produce and track requests by hash as well as number
@EclesioMeloJunior
Copy link
Member

Hi! The requests are blocks that we send to or receive from others peers? And track means to save at database?

@noot
Copy link
Contributor Author

noot commented May 3, 2021

@EclesioMeloJunior hey, yes the requests are BlockRequestMessage s that we sent to other peers, we don't track requests that we receive. to track means to cache it in the syncQueue struct, for example, this is the current mapping used which tracks request info by starting number: https://github.com/ChainSafe/gossamer/blob/development/dot/network/sync.go#L130 the idea of this issue is to have the same mapping but for hashes, and use that when we request using StartingBlock as a hash, since StartingBlock can be a number or a hash: https://github.com/ChainSafe/gossamer/blob/development/dot/network/message.go#L71

@EclesioMeloJunior
Copy link
Member

EclesioMeloJunior commented May 9, 2021

@noot, what is the use case of justificationRequestData? Can we use it when we request using StartingBlock as a hash?

@noot
Copy link
Contributor Author

noot commented May 10, 2021

@EclesioMeloJunior hey, the justificationRequestData is for making requests that only request the justification, not the header + body + justification. so there should be a separate map for requests that are by hash that request header + body + justification

@EclesioMeloJunior
Copy link
Member

closed with PR #1575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants