-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Gossipsub config setting (#389)
# Description This PR implements the following features: - [x] Add `enable_gossipsub` config - [x] Add `PubSubError` with `NotEnabled` and wrapped Gossipsub `SubscriptionError` and `PublishE - [x] Add runtime network `Error` with `PubSubError` - [x] Handle Gossipsub on/off cases for `gossip_subscribe` and `gossip_publish` ## Link to issue Closes #388 ## Type of change - [x] New feature (non-breaking change that adds functionality) - [x] Refactor (non-breaking change that updates existing functionality) ## Test plan (required) All existing tests should pass. We will test Gossipsub on/off in upcoming multi-node workflow integration tests. --------- Co-authored-by: Zeeshan Lakhani <zeeshan.lakhani@gmail.com>
- Loading branch information
1 parent
3508861
commit fc542ef
Showing
6 changed files
with
92 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#[derive(thiserror::Error, Debug)] | ||
pub(crate) enum Error { | ||
#[error("pubsub error: {0}")] | ||
PubSubError(#[from] PubSubError), | ||
} | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
pub(crate) enum PubSubError { | ||
#[error("insufficient peers subscribed to topic {0} for publishing")] | ||
InsufficientPeers(String), | ||
#[error("not enabled")] | ||
NotEnabled, | ||
#[error(transparent)] | ||
Publish(#[from] libp2p::gossipsub::PublishError), | ||
#[error(transparent)] | ||
Subscription(#[from] libp2p::gossipsub::SubscriptionError), | ||
// TODO: We may be able to remove this error type once we clean-up erroring | ||
// through the runtime. | ||
#[error("error on conversion: {0}")] | ||
Conversion(#[from] anyhow::Error), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters