Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/network): fix bugs in notifications protocol handlers; add metrics for inbound/outbound streams #2010
fix(dot/network): fix bugs in notifications protocol handlers; add metrics for inbound/outbound streams #2010
Changes from 70 commits
4666518
e03fa95
0692825
71f2937
2950c17
4597344
d873979
07ed907
bed53dc
39de2d7
a07d83d
178f727
6f3fd63
f335df9
67f59cc
941f954
d9bdff4
7f067c7
fa1fb31
d99a4ab
beb2e47
e7a5a15
00091c5
577ff25
3f5a323
f4eb7a5
178434e
c6a9465
3eb1b8e
dea40af
d9f7e36
f072ef3
56362e4
5a5ee4b
9584b4e
c2fa05e
d25196b
0319217
5a66fff
5ec3aa0
e30a399
02c15ac
83beda8
958c0c1
7c81966
4a8732e
dfc5e2c
a7de1d1
0fd0230
912a78b
8629b43
f077036
be2fcd8
7f1f429
a08a742
7d093ba
9aaa1f2
15bccf2
bfbca17
5efe331
0ef20de
9541b72
426a5fa
d8445b3
3a7a426
122c2a4
b3db52a
7ef53e3
d5e6339
99053f9
a8e9cff
b0d01a0
b291a9f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit maybe change that to
errMessageTypeNotValid = errors.New("message type is not valid")
and use it as
fmt.Errorf("%w: expected %T but got %T", errMessageTypeNotValid, (NotificationsMessage)(nil), message)
? That would be cool since it would adapt to name changes to the types. But that might be me getting excited for no reason haha!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.
just to double check, it's all good here if the message is not a request? Maybe should calling layers check that and pass it as a
*LightRequest
instead of aMessage
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.
it should never not be a request, just by reasoning of how the substrate networking protocol works (https://docs.rs/sc-network/0.9.0/sc_network/) if it's not a request, then we can ignore it, as it shouldn't be sent over an inbound stream. (in fact we can probably downscore the peer, but there's another issue open for that)
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.
we can't change it to be
*LightRequest
as it needs to implement the function typemessageHandler = func(stream libp2pnetwork.Stream, msg Message) error
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.
Thanks for clarifying!!
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.
Actually I think we could return an error since it's not meant to happen.
Or just remove the type assertion check so it panics, up to you. Panicing is fine too in this case I'd say.
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.
nit adding named returned values
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.