-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Prioritise primary stream #6086
Conversation
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.
oh yeah this is better.
we're still draining all protocol messages but hitting the primary earlier again.
one comment about break statement and FuturesUnordered suggestion
crates/net/eth-wire/src/multiplex.rs
Outdated
Poll::Ready(None) => return Poll::Ready(None), | ||
Poll::Pending => { | ||
this.inner.protocols.push(proto); | ||
break |
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.
this break will terminate the for loop now, but we still want to advance the remaining streams, right?
perhaps we should rewrite protocols: Vec<ProtocolStream>
as
FuturesUnordered<StreamFuture<ProtocolStream>
see also SelectAll impl
https://docs.rs/futures-util/0.3.30/src/futures_util/stream/select_all.rs.html#93
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.
absolutely. I also found some more code that impedes us from prioritising the primary stream, fixed it in the latest commit.
stoping development, in favour of using |
programmability spans up a new attack surface onto the node. this pr prioritises the primary stream. it is a good precaution that aims to limit the damage of user-defined vulnerabilities to the injected handles, and not let them effect the whole node.
by letting users inject cap-handles into reth, we are making the node vulnerable to all kinds of errors we cannot foresee and therefore not make any guarantees for how the node runs. a scenario that could happen before, is that some user-defined cap-handle can be dos:ed so that it sends endless messages, this means that the
RlpxSatelliteStream
stream will get stuck in a loop and no moreeth
messages would be sent or received.