Skip to content

Conversation

@binier
Copy link
Contributor

@binier binier commented Jan 22, 2025

No description provided.

@binier binier requested review from 0xMimir and tizoc January 22, 2025 11:31
let nonce = nonce.into();
let message = GossipNetMessageV2::SnarkPoolDiff { message, nonce };
dispatcher.push(P2pNetworkPubsubAction::Broadcast { message });
if is_local {
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

@tizoc tizoc Jan 22, 2025

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).

@binier binier force-pushed the fix/p2p/webrtc_to_libp2p_propagation branch from a75f4ac to 144afec Compare January 22, 2025 14:45
…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 {
Copy link
Collaborator

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)

Copy link
Contributor Author

@binier binier Jan 22, 2025

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

@binier binier merged commit 2676e39 into develop Jan 23, 2025
31 checks passed
@binier binier deleted the fix/p2p/webrtc_to_libp2p_propagation branch January 23, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants