From 7a961f303afdcd97eddbee7591ad960db94c628f Mon Sep 17 00:00:00 2001 From: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:34:30 +0200 Subject: [PATCH] Remove unused code (#6525) Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> --- polkadot/node/subsystem-types/src/messages.rs | 113 ------------------ 1 file changed, 113 deletions(-) diff --git a/polkadot/node/subsystem-types/src/messages.rs b/polkadot/node/subsystem-types/src/messages.rs index cb0834c5ba3..bf1dbe552f5 100644 --- a/polkadot/node/subsystem-types/src/messages.rs +++ b/polkadot/node/subsystem-types/src/messages.rs @@ -58,12 +58,6 @@ use std::{ pub mod network_bridge_event; pub use network_bridge_event::NetworkBridgeEvent; -/// Subsystem messages where each message is always bound to a relay parent. -pub trait BoundToRelayParent { - /// Returns the relay parent this message is bound to. - fn relay_parent(&self) -> Hash; -} - /// Messages received by the Candidate Backing subsystem. #[derive(Debug)] pub enum CandidateBackingMessage { @@ -78,16 +72,6 @@ pub enum CandidateBackingMessage { Statement(Hash, SignedFullStatement), } -impl BoundToRelayParent for CandidateBackingMessage { - fn relay_parent(&self) -> Hash { - match self { - Self::GetBackedCandidates(hash, _, _) => *hash, - Self::Second(hash, _, _) => *hash, - Self::Statement(hash, _) => *hash, - } - } -} - /// Blanket error for validation failing for internal reasons. #[derive(Debug, Error)] #[error("Validation failed with {0:?}")] @@ -170,17 +154,6 @@ pub enum CandidateValidationMessage { ), } -impl CandidateValidationMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - match self { - Self::ValidateFromChainState(_, _, _, _) => None, - Self::ValidateFromExhaustive(_, _, _, _, _, _) => None, - Self::PreCheck(relay_parent, _, _) => Some(*relay_parent), - } - } -} - /// Messages received by the Collator Protocol subsystem. #[derive(Debug, derive_more::From)] pub enum CollatorProtocolMessage { @@ -218,12 +191,6 @@ impl Default for CollatorProtocolMessage { } } -impl BoundToRelayParent for CollatorProtocolMessage { - fn relay_parent(&self) -> Hash { - Default::default() - } -} - /// Messages received by the dispute coordinator subsystem. /// /// NOTE: Any response oneshots might get cancelled if the `DisputeCoordinator` was not yet @@ -397,23 +364,6 @@ pub enum NetworkBridgeTxMessage { }, } -impl NetworkBridgeTxMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - match self { - Self::ReportPeer(_, _) => None, - Self::DisconnectPeer(_, _) => None, - Self::SendValidationMessage(_, _) => None, - Self::SendCollationMessage(_, _) => None, - Self::SendValidationMessages(_) => None, - Self::SendCollationMessages(_) => None, - Self::ConnectToValidators { .. } => None, - Self::ConnectToResolvedValidators { .. } => None, - Self::SendRequests { .. } => None, - } - } -} - /// Availability Distribution Message. #[derive(Debug)] pub enum AvailabilityDistributionMessage { @@ -463,16 +413,6 @@ pub enum BitfieldDistributionMessage { NetworkBridgeUpdate(NetworkBridgeEvent<net_protocol::BitfieldDistributionMessage>), } -impl BitfieldDistributionMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - match self { - Self::DistributeBitfield(hash, _) => Some(*hash), - Self::NetworkBridgeUpdate(_) => None, - } - } -} - /// Availability store subsystem message. #[derive(Debug)] pub enum AvailabilityStoreMessage { @@ -526,13 +466,6 @@ pub enum AvailabilityStoreMessage { }, } -impl AvailabilityStoreMessage { - /// In fact, none of the `AvailabilityStore` messages assume a particular relay parent. - pub fn relay_parent(&self) -> Option<Hash> { - None - } -} - /// A response channel for the result of a chain API request. pub type ChainApiResponseChannel<T> = oneshot::Sender<Result<T, crate::errors::ChainApiError>>; @@ -575,13 +508,6 @@ pub enum ChainApiMessage { }, } -impl ChainApiMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - None - } -} - /// Chain selection subsystem messages #[derive(Debug)] pub enum ChainSelectionMessage { @@ -594,20 +520,6 @@ pub enum ChainSelectionMessage { BestLeafContaining(Hash, oneshot::Sender<Option<Hash>>), } -impl ChainSelectionMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - // None of the messages, even the ones containing specific - // block hashes, can be considered to have those blocks as - // a relay parent. - match *self { - ChainSelectionMessage::Approved(_) => None, - ChainSelectionMessage::Leaves(_) => None, - ChainSelectionMessage::BestLeafContaining(..) => None, - } - } -} - /// A sender for the result of a runtime API request. pub type RuntimeApiSender<T> = oneshot::Sender<Result<T, crate::errors::RuntimeApiError>>; @@ -702,15 +614,6 @@ pub enum RuntimeApiMessage { Request(Hash, RuntimeApiRequest), } -impl RuntimeApiMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - match self { - Self::Request(hash, _) => Some(*hash), - } - } -} - /// Statement distribution message. #[derive(Debug, derive_more::From)] pub enum StatementDistributionMessage { @@ -762,15 +665,6 @@ pub enum ProvisionerMessage { ProvisionableData(Hash, ProvisionableData), } -impl BoundToRelayParent for ProvisionerMessage { - fn relay_parent(&self) -> Hash { - match self { - Self::RequestInherentData(hash, _) => *hash, - Self::ProvisionableData(hash, _) => *hash, - } - } -} - /// Message to the Collation Generation subsystem. #[derive(Debug)] pub enum CollationGenerationMessage { @@ -778,13 +672,6 @@ pub enum CollationGenerationMessage { Initialize(CollationGenerationConfig), } -impl CollationGenerationMessage { - /// If the current variant contains the relay parent hash, return it. - pub fn relay_parent(&self) -> Option<Hash> { - None - } -} - /// The result type of [`ApprovalVotingMessage::CheckAndImportAssignment`] request. #[derive(Debug, Clone, PartialEq, Eq)] pub enum AssignmentCheckResult { -- GitLab