Skip to content
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

Add Function to Enable Application Layer to Send Direct Control Messages #561

Open
yhassanzadeh13 opened this issue Jul 2, 2024 · 8 comments

Comments

@yhassanzadeh13
Copy link
Contributor

Description

Proposal: Introduce a new function, SendControl, to the GossipSubRouter that allows the application layer to send direct control messages to a peer. This feature will primarily be used to develop finer-grained testing. Flow blockchain currently uses this feature quite extensively.

Proposed Function

// SendControl dispatches the given set of control messages to the given peer.
func (gs *GossipSubRouter) SendControl(p peer.ID, ctl *pb.ControlMessage, msgs ...*pb.Message) bool {
    out := rpcWithControl(msgs, ctl.Ihave, ctl.Iwant, ctl.Graft, ctl.Prune)
    return gs.sendRPC(p, out)
}

Sample implementation on my forked version.

Rationale

Adding this function does not break encapsulation drastically. It is available at the router-level, meaning it is only accessible if the application layer creates a router and passes it to a pubsub instance, rather than creating a gossipsub instance directly. This ensures controlled usage and maintains the integrity of the encapsulation.

Benefits

  • Enables finer-grained testing.
  • Provides more control for application layer developers.
  • Maintains encapsulation integrity by limiting accessibility.

I can make the PR upon a soft approval.

@vyzo
Copy link
Collaborator

vyzo commented Jul 2, 2024

In principle this is fine, as it can allow application specific extensions to the protocol; this is useful for testing and early adoption as a path to standarization.
It is also in line with the philosophy of extensibility in the protocol.

However, i think that just sending control messages is insufficient. We also need a way to process incoming custom control messages.

@yhassanzadeh13
Copy link
Contributor Author

In principle this is fine, as it can allow application specific extensions to the protocol; this is useful for testing and early adoption as a path to standarization.
It is also in line with the philosophy of extensibility in the protocol.

Thanks, I'll then proceed with the PR.

We also need a way to process incoming custom control messages.

I believe processing incoming messages has already been implemented through the RPC inspector set by the application layer, as shown in this link: #509. Are you considering a different functionality?

@vyzo
Copy link
Collaborator

vyzo commented Jul 3, 2024

Oh right, i forgot!
No, i think it is sufficient.

@yhassanzadeh13
Copy link
Contributor Author

Created the PR: #562

@yhassanzadeh13
Copy link
Contributor Author

@vyzo a gentle reminder for this issue; the PR is ready pending a review; thanks! #562

@vyzo
Copy link
Collaborator

vyzo commented Oct 17, 2024

ah sorry, i forgot!

vyzo pushed a commit that referenced this issue Oct 18, 2024
…ges (#562)

### PR Description

This PR addresses #561;
i.e., adding a new `SendControl` function to the `GossipSubRouter`. This
will allow the application layer to send direct control messages to
peers, facilitating finer-grained testing.
@yhassanzadeh13
Copy link
Contributor Author

Is it possible to have a tagged release of the master head (inclusive of #562)?

@vyzo
Copy link
Collaborator

vyzo commented Nov 7, 2024

sure, will make a patch release.

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

No branches or pull requests

2 participants