-
Notifications
You must be signed in to change notification settings - Fork 41
Fix WebRTC to LibP2P propagation #1033
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
Conversation
| let nonce = nonce.into(); | ||
| let message = GossipNetMessageV2::SnarkPoolDiff { message, nonce }; | ||
| dispatcher.push(P2pNetworkPubsubAction::Broadcast { message }); | ||
| if is_local { |
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.
@binier I am confused by this, is this enough to differentiate non-webrtc from webrtc sourced messages? What happens with messages received from libp2p? aren't they going to follow the same path and be considered as webrtc-sourced by this condition 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.
My assumption is that if msg was received from libp2p, it should still be in mcache so the action won't be enabled because this will be false: https://github.com/openmina/openmina/blob/b5c83e8fb6276306d730a627a0cb79da9af301a4/p2p/src/network/pubsub/p2p_network_pubsub_actions.rs#L206
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.
ok, but if that is the case please add a comment clarifying that there, because right now it is quite confusing
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.
also may break accidentally if for some reason that caching logic changes somehow
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.
also may break accidentally if for some reason that caching logic changes somehow
It will "break" anyways if that happens. Though right now maybe not, coz block rebroadcast won't wait for block application right? It seems to do only precheck and rebroadcast in that case.
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.
@binier block rebroadcast now waits for the application to be successful, Grga implemented that in #1001 (but just for blocks at the moment, this doesn't apply to transactions or snarks yet).
My point is that if for whatever reason this code needs to be changed (or somebody is trying to debug something semi-related), it would be better to not depend on our own memories or to have to re-understand the code to understand the assumptions made here (which depend on code from somewhere else). The comment makes the (non-obvious) assumption very explicit and will save time (both in that case, or any other kind of refactor affecting this).
a75f4ac to
144afec
Compare
…nders for libp2p received blocks Same issue affects transactions and snarks too, so needs to be fixed there as well.
| }, | ||
| }) { | ||
| // Otherwise block was received from WebRTC so inject it in libp2p. | ||
| store.dispatch(P2pNetworkPubsubAction::WebRtcRebroadcast { |
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.
what would happen if we dispatched this one unconditionally? is the conditional check what avoids the duplication of the message? (I ask because we can do this here because the transition frontier still doesn't use queued actions, but once that is implemented we will have to figure out something else 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.
is the conditional check what avoids the duplication of the message?
but once that is implemented we will have to figure out something else here)
yes and yes
No description provided.