Skip to content
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
5 changes: 4 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ clippy-nightly:
stage: lint
<<: *docker-env
<<: *test-refs
variables:
RUSTFLAGS: "-D warnings"
script:
- SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure
# clippy currently is raising `derive-partial-eq-without-eq` warning even if `Eq` is actually derived
- SKIP_WASM_BUILD=1 cargo +nightly clippy --all-targets -- -A clippy::redundant_closure -A clippy::derive-partial-eq-without-eq

fmt:
stage: lint
Expand Down
4 changes: 1 addition & 3 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ parameter_types! {
pub struct BeefyDummyDataProvider;

impl beefy_primitives::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider {
fn extra_data() -> () {
()
}
fn extra_data() {}
}

impl pallet_beefy_mmr::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion bin/millau/runtime/src/rialto_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl MessageBridge for WithRialtoMessageBridge {
bridged_to_this_conversion_rate_override: Option<FixedU128>,
) -> bp_millau::Balance {
let conversion_rate = bridged_to_this_conversion_rate_override
.unwrap_or_else(|| RialtoToMillauConversionRate::get());
.unwrap_or_else(RialtoToMillauConversionRate::get);
bp_millau::Balance::try_from(conversion_rate.saturating_mul_int(bridged_balance))
.unwrap_or(bp_millau::Balance::MAX)
}
Expand Down
2 changes: 1 addition & 1 deletion bin/millau/runtime/src/rialto_parachain_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl MessageBridge for WithRialtoParachainMessageBridge {
bridged_to_this_conversion_rate_override: Option<FixedU128>,
) -> bp_millau::Balance {
let conversion_rate = bridged_to_this_conversion_rate_override
.unwrap_or_else(|| RialtoParachainToMillauConversionRate::get());
.unwrap_or_else(RialtoParachainToMillauConversionRate::get);
bp_millau::Balance::try_from(conversion_rate.saturating_mul_int(bridged_balance))
.unwrap_or(bp_millau::Balance::MAX)
}
Expand Down
4 changes: 3 additions & 1 deletion bin/rialto-parachain/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
}

/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
#[derive(
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension,
)]
#[serde(deny_unknown_fields)]
pub struct Extensions {
/// The relay chain of the Parachain.
Expand Down
2 changes: 1 addition & 1 deletion bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()).into());
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down
2 changes: 1 addition & 1 deletion bin/rialto-parachain/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl MessageBridge for WithMillauMessageBridge {
bridged_to_this_conversion_rate_override: Option<FixedU128>,
) -> bp_rialto_parachain::Balance {
let conversion_rate = bridged_to_this_conversion_rate_override
.unwrap_or_else(|| MillauToRialtoParachainConversionRate::get());
.unwrap_or_else(MillauToRialtoParachainConversionRate::get);
bp_rialto_parachain::Balance::try_from(conversion_rate.saturating_mul_int(bridged_balance))
.unwrap_or(bp_rialto_parachain::Balance::MAX)
}
Expand Down
4 changes: 1 addition & 3 deletions bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,7 @@ parameter_types! {
pub struct BeefyDummyDataProvider;

impl beefy_primitives::mmr::BeefyDataProvider<()> for BeefyDummyDataProvider {
fn extra_data() -> () {
()
}
fn extra_data() {}
}

impl pallet_beefy_mmr::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion bin/rialto/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl MessageBridge for WithMillauMessageBridge {
bridged_to_this_conversion_rate_override: Option<FixedU128>,
) -> bp_rialto::Balance {
let conversion_rate = bridged_to_this_conversion_rate_override
.unwrap_or_else(|| MillauToRialtoConversionRate::get());
.unwrap_or_else(MillauToRialtoConversionRate::get);
bp_rialto::Balance::try_from(conversion_rate.saturating_mul_int(bridged_balance))
.unwrap_or(bp_rialto::Balance::MAX)
}
Expand Down
3 changes: 1 addition & 2 deletions bin/rialto/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ mod tests {
let mut incoming_message = DispatchMessage {
key: MessageKey { lane_id: [0, 0, 0, 0], nonce: 1 },
data: DispatchMessageData { payload: Ok((location, xcm).into()), fee: 0 },
}
.into();
};

let dispatch_weight = MessageDispatcher::dispatch_weight(&mut incoming_message);
assert_eq!(dispatch_weight, 1_000_000_000);
Expand Down
24 changes: 12 additions & 12 deletions bin/runtime-common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ pub mod target {
use super::*;

/// Decoded Bridged -> This message payload.
#[derive(RuntimeDebug, PartialEq)]
#[derive(RuntimeDebug, PartialEq, Eq)]
pub struct FromBridgedChainMessagePayload<Call> {
/// Data that is actually sent over the wire.
pub xcm: (xcm::v3::MultiLocation, xcm::v3::Xcm<Call>),
Expand Down Expand Up @@ -726,7 +726,7 @@ pub mod target {
.map_err(Into::into)
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub(crate) enum MessageProofError {
Empty,
MessagesCountMismatch,
Expand Down Expand Up @@ -944,7 +944,7 @@ pub mod xcm_copy {
message: &mut Option<Xcm<()>>,
) -> Result<((Vec<u8>, XcmHash), MultiAssets), SendError> {
let bridged_network = BridgedNetwork::get();
ensure!(&network == &bridged_network, SendError::NotApplicable);
ensure!(network == bridged_network, SendError::NotApplicable);
// We don't/can't use the `channel` for this adapter.
let dest = destination.take().ok_or(SendError::MissingArgument)?;
let universal_dest = match dest.pushed_front_with(GlobalConsensus(bridged_network)) {
Expand Down Expand Up @@ -1030,13 +1030,13 @@ mod tests {
}
}

#[derive(Debug, PartialEq, Decode, Encode, Clone)]
#[derive(Debug, PartialEq, Eq, Decode, Encode, Clone)]
struct ThisChainAccountId(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
struct ThisChainSigner(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
struct ThisChainSignature(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
enum ThisChainCall {
#[codec(index = 42)]
Transfer,
Expand All @@ -1056,13 +1056,13 @@ mod tests {
}
}

#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
struct BridgedChainAccountId(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
struct BridgedChainSigner(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
struct BridgedChainSignature(u32);
#[derive(Debug, PartialEq, Decode, Encode)]
#[derive(Debug, PartialEq, Eq, Decode, Encode)]
enum BridgedChainCall {}
#[derive(Clone, Debug)]
struct BridgedChainOrigin;
Expand All @@ -1079,7 +1079,7 @@ mod tests {

macro_rules! impl_wrapped_balance {
($name:ident) => {
#[derive(Debug, PartialEq, Decode, Encode, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Decode, Encode, Clone, Copy)]
struct $name(u32);

impl From<u32> for $name {
Expand Down
6 changes: 3 additions & 3 deletions modules/grandpa/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
///
/// ```nocompile
/// pallet_bridge_grandpa::declare_check_bridged_block_number_ext!{
/// Runtime,
/// Call::BridgeRialtoGrandpa => RialtoGrandpaInstance,
/// Call::BridgeWestendGrandpa => WestendGrandpaInstance,
/// Runtime,
/// Call::BridgeRialtoGrandpa => RialtoGrandpaInstance,
/// Call::BridgeWestendGrandpa => WestendGrandpaInstance,
/// }
/// ```
#[macro_export]
Expand Down
2 changes: 1 addition & 1 deletion primitives/header-chain/src/justification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<H: HeaderT> crate::FinalityProof<H::Number> for GrandpaJustification<H> {
}

/// Justification verification error.
#[derive(RuntimeDebug, PartialEq)]
#[derive(Eq, RuntimeDebug, PartialEq)]
pub enum Error {
/// Failed to decode justification.
JustificationDecode,
Expand Down
2 changes: 1 addition & 1 deletion primitives/header-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait Parameter: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}
impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}

/// A GRANDPA Authority List and ID.
#[derive(Default, Encode, Decode, RuntimeDebug, PartialEq, Clone, TypeInfo)]
#[derive(Default, Encode, Eq, Decode, RuntimeDebug, PartialEq, Clone, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct AuthoritySet {
/// List of GRANDPA authorities for the current round.
Expand Down
4 changes: 2 additions & 2 deletions primitives/messages/src/source_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<SenderOrigin, AccountId, Balance>
}

/// Send message artifacts.
#[derive(RuntimeDebug, PartialEq)]
#[derive(Eq, RuntimeDebug, PartialEq)]
pub struct SendMessageArtifacts {
/// Nonce of the message.
pub nonce: MessageNonce,
Expand All @@ -198,7 +198,7 @@ pub trait MessagesBridge<SenderOrigin, AccountId, Balance, Payload> {
}

/// Bridge that does nothing when message is being sent.
#[derive(RuntimeDebug, PartialEq)]
#[derive(Eq, RuntimeDebug, PartialEq)]
pub struct NoopMessagesBridge;

impl<SenderOrigin, AccountId, Balance, Payload>
Expand Down
2 changes: 1 addition & 1 deletion primitives/runtime/src/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ where
}
}

#[derive(RuntimeDebug, PartialEq)]
#[derive(Eq, RuntimeDebug, PartialEq)]
pub enum Error {
StorageRootMismatch,
StorageValueUnavailable,
Expand Down
16 changes: 8 additions & 8 deletions relays/bin-substrate/src/cli/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::millau_messages_to_rialto::MillauMessagesToRialto as MessagesLane;
use $crate::chains::millau_messages_to_rialto::MillauMessagesToRialto as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -93,7 +93,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::rialto_messages_to_millau::RialtoMessagesToMillau as MessagesLane;
use $crate::chains::rialto_messages_to_millau::RialtoMessagesToMillau as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -112,7 +112,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::rococo_messages_to_wococo::RococoMessagesToWococo as MessagesLane;
use $crate::chains::rococo_messages_to_wococo::RococoMessagesToWococo as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -131,7 +131,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::wococo_messages_to_rococo::WococoMessagesToRococo as MessagesLane;
use $crate::chains::wococo_messages_to_rococo::WococoMessagesToRococo as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -150,7 +150,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::kusama_messages_to_polkadot::KusamaMessagesToPolkadot as MessagesLane;
use $crate::chains::kusama_messages_to_polkadot::KusamaMessagesToPolkadot as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -169,7 +169,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::polkadot_messages_to_kusama::PolkadotMessagesToKusama as MessagesLane;
use $crate::chains::polkadot_messages_to_kusama::PolkadotMessagesToKusama as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -188,7 +188,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::millau_messages_to_rialto_parachain::MillauMessagesToRialtoParachain as MessagesLane;
use $crate::chains::millau_messages_to_rialto_parachain::MillauMessagesToRialtoParachain as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand All @@ -207,7 +207,7 @@ macro_rules! select_full_bridge {

// Relay-messages
#[allow(unused_imports)]
use crate::chains::rialto_parachain_messages_to_millau::RialtoParachainMessagesToMillau as MessagesLane;
use $crate::chains::rialto_parachain_messages_to_millau::RialtoParachainMessagesToMillau as MessagesLane;

// Send-message / Estimate-fee
#[allow(unused_imports)]
Expand Down
6 changes: 2 additions & 4 deletions relays/bin-substrate/src/cli/encode_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ pub(crate) fn compute_maximal_message_size(
bridge_runtime_common::messages::target::maximal_incoming_message_size(
maximal_target_extrinsic_size,
);
let maximal_message_size = if maximal_message_size > maximal_source_extrinsic_size {
if maximal_message_size > maximal_source_extrinsic_size {
maximal_source_extrinsic_size
} else {
maximal_message_size
};

maximal_message_size
}
}
4 changes: 2 additions & 2 deletions relays/bin-substrate/src/cli/register_parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const NEXT_FREE_PARA_ID_STORAGE_NAME: &str = "NextFreeParaId";
const PARAS_LIFECYCLES_STORAGE_NAME: &str = "ParaLifecycles";

/// Register parachain.
#[derive(StructOpt, Debug, PartialEq)]
#[derive(StructOpt, Debug, PartialEq, Eq)]
pub struct RegisterParachain {
/// A parachain to register.
#[structopt(possible_values = Parachain::VARIANTS, case_insensitive = true)]
Expand All @@ -69,7 +69,7 @@ pub struct RegisterParachain {
}

/// Parachain to register.
#[derive(Debug, EnumString, EnumVariantNames, PartialEq)]
#[derive(Debug, EnumString, EnumVariantNames, PartialEq, Eq)]
#[strum(serialize_all = "kebab_case")]
pub enum Parachain {
RialtoParachain,
Expand Down
4 changes: 2 additions & 2 deletions relays/bin-substrate/src/cli/reinit_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use substrate_relay_helper::{
};

/// Reinitialize bridge pallet.
#[derive(Debug, PartialEq, StructOpt)]
#[derive(Debug, PartialEq, Eq, StructOpt)]
pub struct ReinitBridge {
/// A bridge instance to reinitialize.
#[structopt(possible_values = ReinitBridgeName::VARIANTS, case_insensitive = true)]
Expand All @@ -62,7 +62,7 @@ pub struct ReinitBridge {
target_sign: TargetSigningParams,
}

#[derive(Debug, EnumString, EnumVariantNames, PartialEq)]
#[derive(Debug, EnumString, EnumVariantNames, PartialEq, Eq)]
#[strum(serialize_all = "kebab_case")]
/// Bridge to initialize.
pub enum ReinitBridgeName {
Expand Down
2 changes: 1 addition & 1 deletion relays/bin-substrate/src/cli/relay_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{
};

/// Relayer operating mode.
#[derive(Debug, EnumString, EnumVariantNames, Clone, Copy, PartialEq)]
#[derive(Debug, EnumString, EnumVariantNames, Clone, Copy, PartialEq, Eq)]
#[strum(serialize_all = "kebab_case")]
pub enum RelayerMode {
/// The relayer doesn't care about rewards.
Expand Down
1 change: 1 addition & 0 deletions relays/bin-substrate/src/cli/send_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl SendMessage {
),
};
let payload_len = payload.encode().len();
#[allow(clippy::useless_conversion)]
let send_message_call = Source::encode_send_message_call(
self.lane.0,
payload,
Expand Down
2 changes: 1 addition & 1 deletion relays/client-millau/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::time::Duration;
pub type HeaderId = relay_utils::HeaderId<millau_runtime::Hash, millau_runtime::BlockNumber>;

/// Millau chain definition.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Millau;

impl ChainBase for Millau {
Expand Down
2 changes: 1 addition & 1 deletion relays/client-rialto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::time::Duration;
pub type HeaderId = relay_utils::HeaderId<rialto_runtime::Hash, rialto_runtime::BlockNumber>;

/// Rialto chain definition
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Rialto;

impl ChainBase for Rialto {
Expand Down
2 changes: 1 addition & 1 deletion relays/client-substrate/src/test_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::weights::{IdentityFee, Weight};
use std::time::Duration;

/// Chain that may be used in tests.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TestChain;

impl bp_runtime::Chain for TestChain {
Expand Down
Loading