Rewrap all comments to 100 line width (#9490)

* reformat everything again

* manual formatting

* last manual fix

* Fix build
This commit is contained in:
Kian Paimani
2021-08-11 16:56:55 +02:00
committed by GitHub
parent 8180c58700
commit abd08e29ce
258 changed files with 1776 additions and 1447 deletions
+4 -2
View File
@@ -302,12 +302,14 @@ impl<B: BlockT> Behaviour<B> {
&mut self.substrate
}
/// Start querying a record from the DHT. Will later produce either a `ValueFound` or a `ValueNotFound` event.
/// Start querying a record from the DHT. Will later produce either a `ValueFound` or a
/// `ValueNotFound` event.
pub fn get_value(&mut self, key: &record::Key) {
self.discovery.get_value(key);
}
/// Starts putting a record into DHT. Will later produce either a `ValuePut` or a `ValuePutFailed` event.
/// Starts putting a record into DHT. Will later produce either a `ValuePut` or a
/// `ValuePutFailed` event.
pub fn put_value(&mut self, key: record::Key, value: Vec<u8>) {
self.discovery.put_value(key, value);
}
@@ -294,12 +294,12 @@ impl<B: BlockT> BlockRequestHandler<B> {
};
(justifications, Vec::new(), false)
} else {
// For now we keep compatibility by selecting precisely the GRANDPA one, and not just
// the first one. When sending we could have just taken the first one, since we don't
// expect there to be any other kind currently, but when receiving we need to add the
// engine ID tag.
// The ID tag is hardcoded here to avoid depending on the GRANDPA crate, and will be
// removed once we remove the backwards compatibility.
// For now we keep compatibility by selecting precisely the GRANDPA one, and not
// just the first one. When sending we could have just taken the first one,
// since we don't expect there to be any other kind currently, but when
// receiving we need to add the engine ID tag.
// The ID tag is hardcoded here to avoid depending on the GRANDPA crate, and
// will be removed once we remove the backwards compatibility.
// See: https://github.com/paritytech/substrate/issues/8172
let justification =
justifications.and_then(|just| just.into_justification(*b"FRNK"));
+13 -12
View File
@@ -112,8 +112,8 @@ pub struct Params<B: BlockT, H: ExHashT> {
/// Request response configuration for the block request protocol.
///
/// [`RequestResponseConfig::name`] is used to tag outgoing block requests with the correct
/// protocol name. In addition all of [`RequestResponseConfig`] is used to handle incoming block
/// requests, if enabled.
/// protocol name. In addition all of [`RequestResponseConfig`] is used to handle incoming
/// block requests, if enabled.
///
/// Can be constructed either via [`crate::block_request_handler::generate_protocol_config`]
/// allowing outgoing but not incoming requests, or constructed via
@@ -272,7 +272,6 @@ impl fmt::Debug for ProtocolId {
/// assert_eq!(peer_id, "QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV".parse::<PeerId>().unwrap());
/// assert_eq!(addr, "/ip4/198.51.100.19/tcp/30333".parse::<Multiaddr>().unwrap());
/// ```
///
pub fn parse_str_addr(addr_str: &str) -> Result<(PeerId, Multiaddr), ParseErr> {
let addr: Multiaddr = addr_str.parse()?;
parse_addr(addr)
@@ -506,7 +505,8 @@ impl NetworkConfiguration {
}
}
/// Create new default configuration for localhost-only connection with random port (useful for testing)
/// Create new default configuration for localhost-only connection with random port (useful for
/// testing)
pub fn new_local() -> NetworkConfiguration {
let mut config =
NetworkConfiguration::new("test-node", "test-client", Default::default(), None);
@@ -520,7 +520,8 @@ impl NetworkConfiguration {
config
}
/// Create new default configuration for localhost-only connection with random port (useful for testing)
/// Create new default configuration for localhost-only connection with random port (useful for
/// testing)
pub fn new_memory() -> NetworkConfiguration {
let mut config =
NetworkConfiguration::new("test-node", "test-client", Default::default(), None);
@@ -629,8 +630,8 @@ pub enum TransportConfig {
allow_private_ipv4: bool,
/// Optional external implementation of a libp2p transport. Used in WASM contexts where we
/// need some binding between the networking provided by the operating system or environment
/// and libp2p.
/// need some binding between the networking provided by the operating system or
/// environment and libp2p.
///
/// This parameter exists whatever the target platform is, but it is expected to be set to
/// `Some` only when compiling for WASM.
@@ -710,12 +711,12 @@ impl NodeKeyConfig {
///
/// * If the secret is configured as input, the corresponding keypair is returned.
///
/// * If the secret is configured as a file, it is read from that file, if it exists.
/// Otherwise a new secret is generated and stored. In either case, the
/// keypair obtained from the secret is returned.
/// * If the secret is configured as a file, it is read from that file, if it exists. Otherwise
/// a new secret is generated and stored. In either case, the keypair obtained from the
/// secret is returned.
///
/// * If the secret is configured to be new, it is generated and the corresponding
/// keypair is returned.
/// * If the secret is configured to be new, it is generated and the corresponding keypair is
/// returned.
pub fn into_keypair(self) -> io::Result<Keypair> {
use NodeKeyConfig::*;
match self {
+2 -1
View File
@@ -1002,7 +1002,8 @@ mod tests {
match e {
DiscoveryOut::UnroutablePeer(other) |
DiscoveryOut::Discovered(other) => {
// Call `add_self_reported_address` to simulate identify happening.
// Call `add_self_reported_address` to simulate identify
// happening.
let addr = swarms
.iter()
.find_map(|(s, a)| {
+4 -5
View File
@@ -121,10 +121,10 @@
//!
//! - **`/substrate/<protocol-id>/<version>`** (where `<protocol-id>` must be replaced with the
//! protocol ID of the targeted chain, and `<version>` is a number between 2 and 6). For each
//! connection we optionally keep an additional substream for all Substrate-based communications alive.
//! This protocol is considered legacy, and is progressively being replaced with alternatives.
//! This is designated as "The legacy Substrate substream" in this documentation. See below for
//! more details.
//! connection we optionally keep an additional substream for all Substrate-based communications
//! alive. This protocol is considered legacy, and is progressively being replaced with
//! alternatives. This is designated as "The legacy Substrate substream" in this documentation. See
//! below for more details.
//! - **`/<protocol-id>/sync/2`** is a request-response protocol (see below) that lets one perform
//! requests for information about blocks. Each request is the encoding of a `BlockRequest` and
//! each response is the encoding of a `BlockResponse`, as defined in the `api.v1.proto` file in
@@ -243,7 +243,6 @@
//! - Calling `trigger_repropagate` when a transaction is added to the pool.
//!
//! More precise usage details are still being worked on and will likely change in the future.
//!
mod behaviour;
mod chain;
@@ -36,7 +36,8 @@ fn generate_protocol_name(protocol_id: &ProtocolId) -> String {
s
}
/// Generates a [`ProtocolConfig`] for the light client request protocol, refusing incoming requests.
/// Generates a [`ProtocolConfig`] for the light client request protocol, refusing incoming
/// requests.
pub fn generate_protocol_config(protocol_id: &ProtocolId) -> ProtocolConfig {
ProtocolConfig {
name: generate_protocol_name(protocol_id).into(),
@@ -26,8 +26,9 @@
//! 2. Forward the request to [`crate::request_responses::RequestResponsesBehaviour`] via
//! [`OutEvent::SendRequest`](sender::OutEvent::SendRequest).
//!
//! 3. Wait for the response and forward the response via the [`futures::channel::oneshot::Sender`] provided earlier
//! with [`LightClientRequestSender::request`](sender::LightClientRequestSender::request).
//! 3. Wait for the response and forward the response via the [`futures::channel::oneshot::Sender`]
//! provided earlier with [`LightClientRequestSender::request`](sender::LightClientRequestSender::
//! request).
use crate::{
config::ProtocolId,
@@ -16,7 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Network packet message types. These get serialized and put into the lower level protocol payload.
//! Network packet message types. These get serialized and put into the lower level protocol
//! payload.
pub use self::generic::{
BlockAnnounce, FromBlock, RemoteCallRequest, RemoteChangesRequest, RemoteChangesResponse,
@@ -392,7 +393,8 @@ pub mod generic {
pub to: Option<Hash>,
/// Sequence direction.
pub direction: Direction,
/// Maximum number of blocks to return. An implementation defined maximum is used when unspecified.
/// Maximum number of blocks to return. An implementation defined maximum is used when
/// unspecified.
pub max: Option<u32>,
}
@@ -63,8 +63,8 @@ use wasm_timer::Instant;
/// - [`PeerState::Disabled`]: Has open TCP connection(s) unbeknownst to the peerset. No substream
/// is open.
/// - [`PeerState::Enabled`]: Has open TCP connection(s), acknowledged by the peerset.
/// - Notifications substreams are open on at least one connection, and external
/// API has been notified.
/// - Notifications substreams are open on at least one connection, and external API has been
/// notified.
/// - Notifications substreams aren't open.
/// - [`PeerState::Incoming`]: Has open TCP connection(s) and remote would like to open substreams.
/// Peerset has been asked to attribute an inbound slot.
@@ -1255,8 +1255,8 @@ impl NetworkBehaviour for Notifications {
.iter()
.any(|(_, s)| matches!(s, ConnectionState::OpenDesiredByRemote));
// If no connection is `OpenDesiredByRemote` anymore, clean up the peerset incoming
// request.
// If no connection is `OpenDesiredByRemote` anymore, clean up the peerset
// incoming request.
if no_desired_left {
// In the incoming state, we don't report "Dropped". Instead we will just
// ignore the corresponding Accept/Reject.
@@ -21,17 +21,17 @@ use asynchronous_codec::Framed;
///
/// The Substrate notifications protocol consists in the following:
///
/// - Node A opens a substream to node B and sends a message which contains some protocol-specific
/// higher-level logic. This message is prefixed with a variable-length integer message length.
/// This message can be empty, in which case `0` is sent.
/// - Node A opens a substream to node B and sends a message which contains some
/// protocol-specific higher-level logic. This message is prefixed with a variable-length
/// integer message length. This message can be empty, in which case `0` is sent.
/// - If node B accepts the substream, it sends back a message with the same properties.
/// - If instead B refuses the connection (which typically happens because no empty slot is
/// available), then it immediately closes the substream without sending back anything.
/// - Node A can then send notifications to B, prefixed with a variable-length integer indicating
/// the length of the message.
/// - Either node A or node B can signal that it doesn't want this notifications substream anymore
/// by closing its writing side. The other party should respond by also closing their own
/// writing side soon after.
/// - Node A can then send notifications to B, prefixed with a variable-length integer
/// indicating the length of the message.
/// - Either node A or node B can signal that it doesn't want this notifications substream
/// anymore by closing its writing side. The other party should respond by also closing their
/// own writing side soon after.
///
/// Notification substreams are unidirectional. If A opens a substream with B, then B is
/// encouraged but not required to open a substream to A as well.
+21 -20
View File
@@ -27,7 +27,6 @@
//! The `ChainSync` struct maintains the state of the block requests. Whenever something happens on
//! the network, or whenever a block has been successfully verified, call the appropriate method in
//! order to update it.
//!
use crate::{
protocol::message::{self, BlockAnnounce, BlockAttributes, BlockRequest, BlockResponse},
@@ -900,8 +899,8 @@ impl<B: BlockT> ChainSync<B> {
// If our best queued is more than `MAX_BLOCKS_TO_LOOK_BACKWARDS` blocks away from the
// common number, the peer best number is higher than our best queued and the common
// number is smaller than the last finalized block number, we should do an ancestor
// search to find a better common block. If the queue is full we wait till all blocks are
// imported though.
// search to find a better common block. If the queue is full we wait till all blocks
// are imported though.
if best_queued.saturating_sub(peer.common_number) > MAX_BLOCKS_TO_LOOK_BACKWARDS.into() &&
best_queued < peer.best_number &&
peer.common_number < last_finalized &&
@@ -1149,8 +1148,8 @@ impl<B: BlockT> ChainSync<B> {
ancestry_request::<B>(next_num),
))
} else {
// Ancestry search is complete. Check if peer is on a stale fork unknown to us and
// add it to sync targets if necessary.
// Ancestry search is complete. Check if peer is on a stale fork unknown
// to us and add it to sync targets if necessary.
trace!(
target: "sync",
"Ancestry search complete. Ours={} ({}), Theirs={} ({}), Common={:?} ({})",
@@ -1774,8 +1773,8 @@ impl<B: BlockT> ChainSync<B> {
///
/// This should be polled until it returns [`Poll::Pending`].
///
/// If [`PollBlockAnnounceValidation::ImportHeader`] is returned, then the caller MUST try to import passed
/// header (call `on_block_data`). The network request isn't sent in this case.
/// If [`PollBlockAnnounceValidation::ImportHeader`] is returned, then the caller MUST try to
/// import passed header (call `on_block_data`). The network request isn't sent in this case.
pub fn poll_block_announce_validation(
&mut self,
cx: &mut std::task::Context,
@@ -2002,7 +2001,8 @@ impl<B: BlockT> ChainSync<B> {
})
}
/// Find a block to start sync from. If we sync with state, that's the latest block we have state for.
/// Find a block to start sync from. If we sync with state, that's the latest block we have
/// state for.
fn reset_sync_start_point(&mut self) -> Result<(), ClientError> {
let info = self.client.info();
if matches!(self.mode, SyncMode::LightState { .. }) && info.finalized_state.is_some() {
@@ -2132,8 +2132,8 @@ fn ancestry_request<B: BlockT>(block: NumberFor<B>) -> BlockRequest<B> {
}
}
/// The ancestor search state expresses which algorithm, and its stateful parameters, we are using to
/// try to find an ancestor block
/// The ancestor search state expresses which algorithm, and its stateful parameters, we are using
/// to try to find an ancestor block
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum AncestorSearchState<B: BlockT> {
/// Use exponential backoff to find an ancestor, then switch to binary search.
@@ -2161,7 +2161,8 @@ fn handle_ancestor_search_state<B: BlockT>(
AncestorSearchState::ExponentialBackoff(next_distance_to_tip) => {
let next_distance_to_tip = *next_distance_to_tip;
if block_hash_match && next_distance_to_tip == One::one() {
// We found the ancestor in the first step so there is no need to execute binary search.
// We found the ancestor in the first step so there is no need to execute binary
// search.
return None
}
if block_hash_match {
@@ -2645,13 +2646,13 @@ mod test {
/// This test is a regression test as observed on a real network.
///
/// The node is connected to multiple peers. Both of these peers are having a best block (1) that
/// is below our best block (3). Now peer 2 announces a fork of block 3 that we will
/// The node is connected to multiple peers. Both of these peers are having a best block (1)
/// that is below our best block (3). Now peer 2 announces a fork of block 3 that we will
/// request from peer 2. After importing the fork, peer 2 and then peer 1 will announce block 4.
/// But as peer 1 in our view is still at block 1, we will request block 2 (which we already have)
/// from it. In the meanwhile peer 2 sends us block 4 and 3 and we send another request for block
/// 2 to peer 2. Peer 1 answers with block 2 and then peer 2. This will need to succeed, as we
/// have requested block 2 from both peers.
/// But as peer 1 in our view is still at block 1, we will request block 2 (which we already
/// have) from it. In the meanwhile peer 2 sends us block 4 and 3 and we send another request
/// for block 2 to peer 2. Peer 1 answers with block 2 and then peer 2. This will need to
/// succeed, as we have requested block 2 from both peers.
#[test]
fn do_not_report_peer_on_block_response_for_block_request() {
sp_tracing::try_init_simple();
@@ -2756,9 +2757,9 @@ mod test {
///
/// The scenario is that the node is doing a full resync and is connected to some node that is
/// doing a major sync as well. This other node that is doing a major sync will finish before
/// our node and send a block announcement message, but we don't have seen any block announcement
/// from this node in its sync process. Meaning our common number didn't change. It is now expected
/// that we start an ancestor search to find the common number.
/// our node and send a block announcement message, but we don't have seen any block
/// announcement from this node in its sync process. Meaning our common number didn't change. It
/// is now expected that we start an ancestor search to find the common number.
#[test]
fn do_ancestor_search_when_common_block_to_best_qeued_gap_is_to_big() {
sp_tracing::try_init_simple();
@@ -98,7 +98,8 @@ impl<B: BlockT> BlockCollection<B> {
);
}
/// Returns a set of block hashes that require a header download. The returned set is marked as being downloaded.
/// Returns a set of block hashes that require a header download. The returned set is marked as
/// being downloaded.
pub fn needed_blocks(
&mut self,
who: PeerId,
@@ -171,7 +172,8 @@ impl<B: BlockT> BlockCollection<B> {
Some(range)
}
/// Get a valid chain of blocks ordered in descending order and ready for importing into blockchain.
/// Get a valid chain of blocks ordered in descending order and ready for importing into
/// blockchain.
pub fn drain(&mut self, from: NumberFor<B>) -> Vec<BlockData<B>> {
let mut drained = Vec::new();
let mut ranges = Vec::new();
@@ -176,8 +176,8 @@ impl<B: BlockT> ExtraRequests<B> {
}
if best_finalized_number > self.best_seen_finalized_number {
// normally we'll receive finality notifications for every block => finalize would be enough
// but if many blocks are finalized at once, some notifications may be omitted
// normally we'll receive finality notifications for every block => finalize would be
// enough but if many blocks are finalized at once, some notifications may be omitted
// => let's use finalize_with_ancestors here
match self.tree.finalize_with_ancestors(
best_finalized_hash,
@@ -315,7 +315,8 @@ impl<'a, B: BlockT> Matcher<'a, B> {
for (peer, sync) in
peers.iter().filter(|(_, sync)| sync.state == PeerSyncState::Available)
{
// only ask peers that have synced at least up to the block number that we're asking the extra for
// only ask peers that have synced at least up to the block number that we're asking
// the extra for
if sync.best_number < request.1 {
continue
}
@@ -310,7 +310,8 @@ impl RequestResponsesBehaviour {
/// Initiates sending a request.
///
/// If there is no established connection to the target peer, the behavior is determined by the choice of `connect`.
/// If there is no established connection to the target peer, the behavior is determined by the
/// choice of `connect`.
///
/// An error is returned if the protocol doesn't match one that has been registered.
pub fn send_request(
@@ -700,8 +701,8 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(out))
},
// An inbound request failed, either while reading the request or due to failing
// to send a response.
// An inbound request failed, either while reading the request or due to
// failing to send a response.
RequestResponseEvent::InboundFailure {
request_id, peer, error, ..
} => {
+20 -12
View File
@@ -729,7 +729,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
/// > preventing the message from being delivered.
///
/// The protocol must have been registered with
/// [`NetworkConfiguration::notifications_protocols`](crate::config::NetworkConfiguration::notifications_protocols).
/// [`NetworkConfiguration::notifications_protocols`](crate::config::NetworkConfiguration::
/// notifications_protocols).
pub fn write_notification(
&self,
target: PeerId,
@@ -774,7 +775,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
/// Obtains a [`NotificationSender`] for a connected peer, if it exists.
///
/// A `NotificationSender` is scoped to a particular connection to the peer that holds
/// a receiver. With a `NotificationSender` at hand, sending a notification is done in two steps:
/// a receiver. With a `NotificationSender` at hand, sending a notification is done in two
/// steps:
///
/// 1. [`NotificationSender::ready`] is used to wait for the sender to become ready
/// for another notification, yielding a [`NotificationSenderReady`] token.
@@ -794,7 +796,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
/// in which case enqueued notifications will be lost.
///
/// The protocol must have been registered with
/// [`NetworkConfiguration::notifications_protocols`](crate::config::NetworkConfiguration::notifications_protocols).
/// [`NetworkConfiguration::notifications_protocols`](crate::config::NetworkConfiguration::
/// notifications_protocols).
///
/// # Usage
///
@@ -883,10 +886,10 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
/// notifications should remain the default ways of communicating information. For example, a
/// peer can announce something through a notification, after which the recipient can obtain
/// more information by performing a request.
/// As such, call this function with `IfDisconnected::ImmediateError` for `connect`. This way you
/// will get an error immediately for disconnected peers, instead of waiting for a potentially very
/// long connection attempt, which would suggest that something is wrong anyway, as you are
/// supposed to be connected because of the notification protocol.
/// As such, call this function with `IfDisconnected::ImmediateError` for `connect`. This way
/// you will get an error immediately for disconnected peers, instead of waiting for a
/// potentially very long connection attempt, which would suggest that something is wrong
/// anyway, as you are supposed to be connected because of the notification protocol.
///
/// No limit or throttling of concurrent outbound requests per peer and protocol are enforced.
/// Such restrictions, if desired, need to be enforced at the call site(s).
@@ -914,7 +917,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
}
}
/// Variation of `request` which starts a request whose response is delivered on a provided channel.
/// Variation of `request` which starts a request whose response is delivered on a provided
/// channel.
///
/// Instead of blocking and waiting for a reply, this function returns immediately, sending
/// responses via the passed in sender. This alternative API exists to make it easier to
@@ -1130,7 +1134,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
///
/// Returns an `Err` if one of the given addresses is invalid or contains an
/// invalid peer ID (which includes the local peer ID).
// NOTE: technically, this function only needs `Vec<PeerId>`, but we use `Multiaddr` here for convenience.
// NOTE: technically, this function only needs `Vec<PeerId>`, but we use `Multiaddr` here for
// convenience.
pub fn remove_peers_from_reserved_set(
&self,
protocol: Cow<'static, str>,
@@ -1198,7 +1203,8 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
///
/// Returns an `Err` if one of the given addresses is invalid or contains an
/// invalid peer ID (which includes the local peer ID).
// NOTE: technically, this function only needs `Vec<PeerId>`, but we use `Multiaddr` here for convenience.
// NOTE: technically, this function only needs `Vec<PeerId>`, but we use `Multiaddr` here for
// convenience.
pub fn remove_from_peers_set(
&self,
protocol: Cow<'static, str>,
@@ -1314,7 +1320,8 @@ pub struct NotificationSender {
}
impl NotificationSender {
/// Returns a future that resolves when the `NotificationSender` is ready to send a notification.
/// Returns a future that resolves when the `NotificationSender` is ready to send a
/// notification.
pub async fn ready<'a>(
&'a self,
) -> Result<NotificationSenderReady<'a>, NotificationSenderError> {
@@ -1371,7 +1378,8 @@ impl<'a> NotificationSenderReady<'a> {
/// Error returned by [`NetworkService::send_notification`].
#[derive(Debug, derive_more::Display, derive_more::Error)]
pub enum NotificationSenderError {
/// The notification receiver has been closed, usually because the underlying connection closed.
/// The notification receiver has been closed, usually because the underlying connection
/// closed.
///
/// Some of the notifications most recently sent may not have been received. However,
/// the peer may still be connected and a new `NotificationSender` for the same
@@ -49,7 +49,8 @@ pub enum VerificationResult<Block: BlockT> {
/// Warp sync backend. Handles retrieveing and verifying warp sync proofs.
pub trait WarpSyncProvider<B: BlockT>: Send + Sync {
/// Generate proof starting at given block hash. The proof is accumulated until maximum proof size is reached.
/// Generate proof starting at given block hash. The proof is accumulated until maximum proof
/// size is reached.
fn generate(
&self,
start: B::Hash,
@@ -61,11 +62,13 @@ pub trait WarpSyncProvider<B: BlockT>: Send + Sync {
set_id: SetId,
authorities: AuthorityList,
) -> Result<VerificationResult<B>, Box<dyn std::error::Error + Send + Sync>>;
/// Get current list of authorities. This is supposed to be genesis authorities when starting sync.
/// Get current list of authorities. This is supposed to be genesis authorities when starting
/// sync.
fn current_authorities(&self) -> AuthorityList;
}
/// Generates a [`RequestResponseConfig`] for the grandpa warp sync request protocol, refusing incoming requests.
/// Generates a [`RequestResponseConfig`] for the grandpa warp sync request protocol, refusing
/// incoming requests.
pub fn generate_request_response_config(protocol_id: ProtocolId) -> RequestResponseConfig {
RequestResponseConfig {
name: generate_protocol_name(protocol_id).into(),