From 9b1c299d247c857468da591009b2829fd4ac9cb1 Mon Sep 17 00:00:00 2001 From: Serban Iorga 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 5f2511fd6ddc..e9dc57a79356 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 = generic::Message< - ::Header, - ::Hash, - <::Header as HeaderT>::Number, - ::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, } - /// A network message. - #[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)] - pub enum Message { - /// Status packet. - Status(Status), - /// Block request. - BlockRequest(BlockRequest), - /// Block response. - BlockResponse(BlockResponse), - /// Block announce. - BlockAnnounce(BlockAnnounce
), - /// 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), - /// Remote method call response. - RemoteCallResponse(RemoteCallResponse), - /// Remote storage read request. - RemoteReadRequest(RemoteReadRequest), - /// Remote storage read response. - RemoteReadResponse(RemoteReadResponse), - /// Remote header request. - RemoteHeaderRequest(RemoteHeaderRequest), - /// Remote header response. - RemoteHeaderResponse(RemoteHeaderResponse
), - /// Remote changes request. - RemoteChangesRequest(RemoteChangesRequest), - /// Remote changes response. - RemoteChangesResponse(RemoteChangesResponse), - /// Remote child storage read request. - RemoteReadChildRequest(RemoteReadChildRequest), - /// 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), - } - /// 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