-
Notifications
You must be signed in to change notification settings - Fork 962
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
header/p2p: request head from multiple peers #1046
header/p2p: request head from multiple peers #1046
Conversation
c785d09
to
d57e897
Compare
Codecov Report
@@ Coverage Diff @@
## main #1046 +/- ##
==========================================
+ Coverage 56.33% 57.02% +0.69%
==========================================
Files 136 141 +5
Lines 9170 9488 +318
==========================================
+ Hits 5166 5411 +245
- Misses 3465 3526 +61
- Partials 539 551 +12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
@renaynay shared this PR with me, I hope my comments are helpful.
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.
Suggestions in the form of a PR/diff: https://github.com/vgonkivs/celestia-node/pull/50/files
In a discussion with @renaynay and @Wondertan we agreed, that we should take a header with max height that was provided by at least 2 of trusted peers |
41dc56f
to
4e751fb
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.
Looks really good! I still have yet to test it against arabica bc bridge is down.
- Can we change
doRequest
to justrequest
since we already haveperformRequest
? - Please format parseHead test like this:
/*
Height -> Amount
headerHeight[0]=1 -> 1
headerHeight[1]=2 -> 1
headerHeight[2]=3 -> 1
result -> headerHeight[2]
*/
{
precondition: gen,
expectedHeight: 3,
},
/*
Height -> Amount
headerHeight[0]=1 -> 2
headerHeight[1]=2 -> 1
headerHeight[2]=3 -> 1
result -> headerHeight[0]
*/
{
precondition: func() []*header.ExtendedHeader {
res := gen()
res = append(res, res[0])
return res
},
expectedHeight: 1,
},
/*
Height -> Amount
headerHeight[0]=1 -> 3
headerHeight[1]=2 -> 2
headerHeight[2]=3 -> 1
result -> headerHeight[1]
*/
{
precondition: func() []*header.ExtendedHeader {
res := gen()
res = append(res, res[0])
res = append(res, res[0])
res = append(res, res[1])
return res
},
expectedHeight: 2,
},
- i would rename
parseHeads
tobestHead
or something like that to indicate that we're looking for the best head according to documented conditions - can you add a debug log in the case that inside of
parseHeads
that you reach the case where no header has at least 2 peers returning it and you have to resort to returning the max height?
d2d32ec
to
095e3ff
Compare
63c741a
to
e44a96e
Compare
Co-authored-by: rene <[email protected]>
514e326
d091f27
to
514e326
Compare
Resolves:
Head
method sanity checks headers array returned #980Head
from multiple trusted peers instead of just one and compare them #1019