Skip to content

core: Register protocols at runtime #400

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lexnv
Copy link
Collaborator

@lexnv lexnv commented Jun 3, 2025

This PR adds the ability to register notification protocols and request-response protocols at runtime.

This is beneficial for users who don't have the full set of protocols during the node initialization. Instead, the protocols will be known at runtime, potentially after calling into the substrate runtime itself.

The counterpart on the substrate side must take into account that each protocol instance has a channel of communication with the rest of the protocols. This might complicate things on the substrate side, but in theory, it's possible to pass a new channel.

Signed-off-by: Alexandru Vasile <[email protected]>
@lexnv lexnv self-assigned this Jun 3, 2025
Copy link
Collaborator

@dmitry-markin dmitry-markin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍

@@ -149,6 +161,11 @@ pub struct Litep2p {

/// Bandwidth sink.
bandwidth_sink: BandwidthSink,

/// The keep-alive timeout for protocols.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The keep-alive timeout for protocols.
/// The executor & keep-alive timeout for protocols.

keep_alive_timeout: std::time::Duration,

/// Executor used to run protocols.
executor: Arc<dyn crate::executor::Executor>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO executor deserves a dedicated field in Litep2p, and may be we don't need a new struct then.

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