This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tomaka
added
A0-please_review
Pull request needs code review.
B1-clientnoteworthy
labels
Mar 31, 2020
twittner
reviewed
Mar 31, 2020
client/network/src/protocol.rs
Outdated
who: PeerId, | ||
response: message::RemoteCallResponse | ||
_: PeerId, | ||
_: message::RemoteCallResponse |
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.
Why not removing this and the other empty methods?
client/network/src/service.rs
Outdated
@@ -897,7 +912,11 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> { | |||
// Check for new incoming light client requests. | |||
if let Some(light_client_rqs) = this.light_client_rqs.as_mut() { | |||
while let Poll::Ready(Some(rq)) = light_client_rqs.poll_next_unpin(cx) { | |||
this.network_service.user_protocol_mut().add_light_client_request(rq); | |||
// This can error if there are too many queued requests already. | |||
let _ = this.network_service.light_client_request(rq); |
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.
Should we not log a message here if an error has been returned? Are there plans to replace those unbounded channels with something that can exercise back pressure?
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.
Are there plans to replace those unbounded channels with something that can exercise back pressure?
That would be #3230
twittner
approved these changes
Apr 1, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
(built on top of #5461)
In #3520, we introduced a second light client protocol with the intent of replacing the current one.
This PR switches to this new protocol by default for all light client requests.
Summary of the changes:
Removes the
light_dispatch
module entirely, as it was responsible for the old protocol. Also removes the code paths inprotocol.rs
that handles receiving responses on the old protocol. Note that we still answer requests, so this doesn't break backwards compatibility.The code in
on_demand_layer
now generateslight_client_handler::Request
s instead oflight_dispatch::RequestData
s for the network service to pick up. These two types are equivalent except that the new one uses the new protocol.When the code in
protocol.rs
detects a new best block for a peer, it reports it as aCustomMessageOutcome::PeerNewBest
event so that we can update the state of theLightClientHandler
. This is mandatory for it to know who to dispatch requests to.Here's probably the biggest change: lights nodes must also be able to perform block requests, and block requests are done on the wire through the regular sync-ing protocol. Unfortunately the
LightClientHandler
before this PR cannot handle these queries, as it is not "its" protocol. After discussion with @twittner, I changedlight_client_handler
to also be able to emitBlockRequest
s and receive backBlockResponse
s. While this is not a great solution, it is in my opinion the cleanest thing to do.Moves
light_dispatch::AlwaysBadChecker
to theon_demand
module andlight_dispatch::TIMEOUT_REPUTATION_CHANGE
tolight_client_handler
.Adds a Prometheus counter to the number of light requests that have been issued out.
Compatibility
After this PR, light clients will no longer be able to make queries to nodes that don't include #3520 (which was merged on February 12th).
Considering that this concerns the light client I don't think that this is a serious problem to anyone, but let me know if I'm wrong.