Skip to content

Commit d6aa157

Browse files
authored
Fix Message codec indexes (#7437)
Fixes #7400
1 parent 0e386be commit d6aa157

1 file changed

Lines changed: 1 addition & 60 deletions

File tree

substrate/client/network/src/protocol/message.rs

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@
2222
use codec::{Decode, Encode};
2323
use sc_client_api::StorageProof;
2424
use sc_network_common::message::RequestId;
25-
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
26-
27-
/// Type alias for using the message type using block type parameters.
28-
#[allow(unused)]
29-
pub type Message<B> = generic::Message<
30-
<B as BlockT>::Header,
31-
<B as BlockT>::Hash,
32-
<<B as BlockT>::Header as HeaderT>::Number,
33-
<B as BlockT>::Extrinsic,
34-
>;
3525

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

5444
/// Generic types.
5545
pub mod generic {
56-
use super::{RemoteCallResponse, RemoteReadResponse};
5746
use codec::{Decode, Encode, Input};
5847
use sc_client_api::StorageProof;
59-
use sc_network_common::{
60-
message::RequestId,
61-
role::Roles,
62-
sync::message::{
63-
generic::{BlockRequest, BlockResponse},
64-
BlockAnnounce,
65-
},
66-
};
48+
use sc_network_common::{message::RequestId, role::Roles};
6749
use sp_runtime::ConsensusEngineId;
6850

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

78-
/// A network message.
79-
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
80-
pub enum Message<Header, Hash, Number, Extrinsic> {
81-
/// Status packet.
82-
Status(Status<Hash, Number>),
83-
/// Block request.
84-
BlockRequest(BlockRequest<Hash, Number>),
85-
/// Block response.
86-
BlockResponse(BlockResponse<Header, Hash, Extrinsic>),
87-
/// Block announce.
88-
BlockAnnounce(BlockAnnounce<Header>),
89-
/// Consensus protocol message.
90-
// NOTE: index is incremented by 1 due to transaction-related
91-
// message that was removed
92-
#[codec(index = 6)]
93-
Consensus(ConsensusMessage),
94-
/// Remote method call request.
95-
RemoteCallRequest(RemoteCallRequest<Hash>),
96-
/// Remote method call response.
97-
RemoteCallResponse(RemoteCallResponse),
98-
/// Remote storage read request.
99-
RemoteReadRequest(RemoteReadRequest<Hash>),
100-
/// Remote storage read response.
101-
RemoteReadResponse(RemoteReadResponse),
102-
/// Remote header request.
103-
RemoteHeaderRequest(RemoteHeaderRequest<Number>),
104-
/// Remote header response.
105-
RemoteHeaderResponse(RemoteHeaderResponse<Header>),
106-
/// Remote changes request.
107-
RemoteChangesRequest(RemoteChangesRequest<Hash>),
108-
/// Remote changes response.
109-
RemoteChangesResponse(RemoteChangesResponse<Number, Hash>),
110-
/// Remote child storage read request.
111-
RemoteReadChildRequest(RemoteReadChildRequest<Hash>),
112-
/// Batch of consensus protocol messages.
113-
// NOTE: index is incremented by 2 due to finality proof related
114-
// messages that were removed.
115-
#[codec(index = 17)]
116-
ConsensusBatch(Vec<ConsensusMessage>),
117-
}
118-
11960
/// Status sent on connection.
12061
// TODO https://github.com/paritytech/substrate/issues/4674: replace the `Status`
12162
// struct with this one, after waiting a few releases beyond `NetworkSpecialization`'s

0 commit comments

Comments
 (0)