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
Reduce unhandled NetworkEvents #982
Conversation
Reviewpad Report
|
48e6346
to
a1812e5
Compare
channel: MsgResponder::FromSelf(sender), | ||
}); | ||
} else { | ||
trace!("Replicate cmd to self received, ignoring"); |
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.
the log is bit confusing.
As I understand, it is a non-query request to self, which can be ignored
, maybe due to replicate
?
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.
ah yeh, we'd be asking ourself to replicate data which we're already holding? So can be ignored
sn_networking/src/driver.rs
Outdated
@@ -394,6 +394,8 @@ impl NetworkBuilder { | |||
|
|||
// Gossipsub behaviour | |||
let gossipsub_config = libp2p::gossipsub::ConfigBuilder::default() | |||
// disable sending to ALL_PEERS subscribed to a topic, which is the default behaviour | |||
.flood_publish(false) |
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 may cause a subscriber
miss a msg?
it it is not known by ALL publisher ?
with the flood
disabled, will
forwarding` still get undertaken?
sn_networking/src/event.rs
Outdated
// if the request is replication, we can handle it and send the OK response here, | ||
// as we send that regardless of how we handle the request as its unimportant to the sender. | ||
match request { | ||
Request::Cmd(cmd) => { |
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.
sounds like the Replicate
is the only Request::Cmd
to be received across nodes?
I'd prefer narrow down then enum to be Cmd::Replicate
only, to avoid later on it mess-up with other new work flow ?
This should avoid issues if that enum grows
Description
Summary generated by Reviewpad on 20 Nov 23 10:37 UTC
This pull request includes the following changes:
In
sn_networking/src/cmd.rs
:Query
type, it sends aNetworkEvent::QueryRequestReceived
. Otherwise, it logs a message stating that a replicate command to self was received and it is ignored.In
sn_networking/src/driver.rs
:flood_publish(false)
).In
sn_networking/src/event.rs
:RequestReceived
toCmdRequestReceived
and added a new variantQueryRequestReceived
in theNetworkEvent
enum.In
sn_networking/src/swarm_driver.rs
:Cmd
type, it sends a replicate OK response to the peer and handles the command separately. If the request is aQuery
type, it sends aNetworkEvent::QueryRequestReceived
.In
sn_node/src/node.rs
:handle_response
function. If the response is a replicate OK response, it logs a warning as it should have been handled earlier.handle_query
andhandle_node_cmd
functions. Instead of returning a response, it now directly sends the response using thesend_response
function.In
sn_transfers/src/cashnotes/signed_spend.rs
:custom_debug
attribute to theSpend
struct.These changes improve the handling of requests and responses in the code.