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

[stable2409] Backport #7437 #7466

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading