Skip to content

Commit

Permalink
[stable2407] Backport #7437 (#7465)
Browse files Browse the repository at this point in the history
Backport #7437 into `stable2407` from serban300.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent fd4b790 commit dc31da0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 60 deletions.
10 changes: 10 additions & 0 deletions prdoc/pr_7437.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: Remove dead code

doc:
- audience: Runtime Dev
description: |
Remove unused code

crates:
- name: sc-network
bump: patch
61 changes: 1 addition & 60 deletions substrate/client/network/src/protocol/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
use codec::{Decode, Encode};
use sc_client_api::StorageProof;
use sc_network_common::message::RequestId;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};

/// Type alias for using the message type using block type parameters.
#[allow(unused)]
pub type Message<B> = generic::Message<
<B as BlockT>::Header,
<B as BlockT>::Hash,
<<B as BlockT>::Header as HeaderT>::Number,
<B as BlockT>::Extrinsic,
>;

/// Remote call response.
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
Expand All @@ -53,17 +43,9 @@ pub struct RemoteReadResponse {

/// Generic types.
pub mod generic {
use super::{RemoteCallResponse, RemoteReadResponse};
use codec::{Decode, Encode, Input};
use sc_client_api::StorageProof;
use sc_network_common::{
message::RequestId,
role::Roles,
sync::message::{
generic::{BlockRequest, BlockResponse},
BlockAnnounce,
},
};
use sc_network_common::{message::RequestId, role::Roles};
use sp_runtime::ConsensusEngineId;

/// Consensus is mostly opaque to us
Expand All @@ -75,47 +57,6 @@ pub mod generic {
pub data: Vec<u8>,
}

/// A network message.
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
pub enum Message<Header, Hash, Number, Extrinsic> {
/// Status packet.
Status(Status<Hash, Number>),
/// Block request.
BlockRequest(BlockRequest<Hash, Number>),
/// Block response.
BlockResponse(BlockResponse<Header, Hash, Extrinsic>),
/// Block announce.
BlockAnnounce(BlockAnnounce<Header>),
/// Consensus protocol message.
// NOTE: index is incremented by 1 due to transaction-related
// message that was removed
#[codec(index = 6)]
Consensus(ConsensusMessage),
/// Remote method call request.
RemoteCallRequest(RemoteCallRequest<Hash>),
/// Remote method call response.
RemoteCallResponse(RemoteCallResponse),
/// Remote storage read request.
RemoteReadRequest(RemoteReadRequest<Hash>),
/// Remote storage read response.
RemoteReadResponse(RemoteReadResponse),
/// Remote header request.
RemoteHeaderRequest(RemoteHeaderRequest<Number>),
/// Remote header response.
RemoteHeaderResponse(RemoteHeaderResponse<Header>),
/// Remote changes request.
RemoteChangesRequest(RemoteChangesRequest<Hash>),
/// Remote changes response.
RemoteChangesResponse(RemoteChangesResponse<Number, Hash>),
/// Remote child storage read request.
RemoteReadChildRequest(RemoteReadChildRequest<Hash>),
/// Batch of consensus protocol messages.
// NOTE: index is incremented by 2 due to finality proof related
// messages that were removed.
#[codec(index = 17)]
ConsensusBatch(Vec<ConsensusMessage>),
}

/// Status sent on connection.
// TODO https://github.com/paritytech/substrate/issues/4674: replace the `Status`
// struct with this one, after waiting a few releases beyond `NetworkSpecialization`'s
Expand Down

0 comments on commit dc31da0

Please sign in to comment.