From 9b1c299d247c857468da591009b2829fd4ac9cb1 Mon Sep 17 00:00:00 2001
From: Serban Iorga <serban@parity.io>
Date: Tue, 4 Feb 2025 12:02:45 +0200
Subject: [PATCH] Fix Message codec indexes (#7437)

Fixes https://github.com/paritytech/polkadot-sdk/issues/7400

(cherry picked from commit d6aa157888902fdfcee3995e5ff209847977c696)
---
 .../client/network/src/protocol/message.rs    | 61 +------------------
 1 file changed, 1 insertion(+), 60 deletions(-)

diff --git a/substrate/client/network/src/protocol/message.rs b/substrate/client/network/src/protocol/message.rs
index 5f2511fd6dd..e9dc57a7935 100644
--- a/substrate/client/network/src/protocol/message.rs
+++ b/substrate/client/network/src/protocol/message.rs
@@ -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)]
@@ -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
@@ -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
-- 
GitLab