Remove message fee + message send calls (#1642)

* remove message fee

* it is compiling!

* fixes + fmt

* more cleanup

* more cleanup

* restore MessageDeliveryAndDispatchPayment since we'll need relayer rewards

* started rational relayer removal

* more removal

* removed estimate fee subcommand

* remove DispatchFeePayment

* more removals

* removed conversion rates && some metrics

* - unneeded associated type

* - OutboundMessageFee

* fix benchmarks compilation

* fmt

* test + fix benchmarks

* fix send message

* clippy
This commit is contained in:
Svyatoslav Nikolsky
2022-11-18 12:24:45 +03:00
committed by Bastian Köcher
parent 1217b2cf80
commit 8c845602cf
92 changed files with 589 additions and 5796 deletions
@@ -18,7 +18,6 @@
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
use bp_messages::Weight;
use messages_relay::relay_strategy::MixStrategy;
use relay_bridge_hub_rococo_client::BridgeHubRococo;
use relay_bridge_hub_wococo_client::BridgeHubWococo;
use substrate_relay_helper::messages_lane::SubstrateMessageLane;
@@ -55,15 +54,6 @@ substrate_relay_helper::generate_mocked_receive_message_delivery_proof_call_buil
pub struct BridgeHubRococoMessagesToBridgeHubWococoMessageLane;
impl SubstrateMessageLane for BridgeHubRococoMessagesToBridgeHubWococoMessageLane {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
type SourceChain = BridgeHubRococo;
type TargetChain = BridgeHubWococo;
@@ -71,8 +61,4 @@ impl SubstrateMessageLane for BridgeHubRococoMessagesToBridgeHubWococoMessageLan
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder;
type ReceiveMessagesDeliveryProofCallBuilder =
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder;
type TargetToSourceChainConversionRateUpdateBuilder = ();
type RelayStrategy = MixStrategy;
}
@@ -18,7 +18,6 @@
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
use bp_messages::Weight;
use messages_relay::relay_strategy::MixStrategy;
use relay_bridge_hub_rococo_client::BridgeHubRococo;
use relay_bridge_hub_wococo_client::BridgeHubWococo;
use substrate_relay_helper::messages_lane::SubstrateMessageLane;
@@ -55,15 +54,6 @@ substrate_relay_helper::generate_mocked_receive_message_delivery_proof_call_buil
pub struct BridgeHubWococoMessagesToBridgeHubRococoMessageLane;
impl SubstrateMessageLane for BridgeHubWococoMessagesToBridgeHubRococoMessageLane {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
type SourceChain = BridgeHubWococo;
type TargetChain = BridgeHubRococo;
@@ -71,8 +61,4 @@ impl SubstrateMessageLane for BridgeHubWococoMessagesToBridgeHubRococoMessageLan
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder;
type ReceiveMessagesDeliveryProofCallBuilder =
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder;
type TargetToSourceChainConversionRateUpdateBuilder = ();
type RelayStrategy = MixStrategy;
}
@@ -16,16 +16,10 @@
//! Millau chain specification for CLI.
use crate::cli::{
bridge,
encode_message::{CliEncodeMessage, RawMessage},
CliChain,
};
use bp_messages::LaneId;
use crate::cli::{bridge, encode_message::CliEncodeMessage, CliChain};
use bp_rialto_parachain::RIALTO_PARACHAIN_ID;
use bp_runtime::EncodedOrDecodedCall;
use relay_millau_client::Millau;
use relay_substrate_client::BalanceOf;
use sp_version::RuntimeVersion;
use xcm::latest::prelude::*;
@@ -56,37 +50,6 @@ impl CliEncodeMessage for Millau {
})
.into())
}
fn encode_send_message_call(
lane: LaneId,
payload: RawMessage,
fee: BalanceOf<Self>,
bridge_instance_index: u8,
) -> anyhow::Result<EncodedOrDecodedCall<Self::Call>> {
Ok(match bridge_instance_index {
bridge::MILLAU_TO_RIALTO_INDEX => millau_runtime::RuntimeCall::BridgeRialtoMessages(
millau_runtime::MessagesCall::send_message {
lane_id: lane,
payload,
delivery_and_dispatch_fee: fee,
},
)
.into(),
bridge::MILLAU_TO_RIALTO_PARACHAIN_INDEX =>
millau_runtime::RuntimeCall::BridgeRialtoParachainMessages(
millau_runtime::MessagesCall::send_message {
lane_id: lane,
payload,
delivery_and_dispatch_fee: fee,
},
)
.into(),
_ => anyhow::bail!(
"Unsupported target bridge pallet with instance index: {}",
bridge_instance_index
),
})
}
}
impl CliChain for Millau {
@@ -16,7 +16,6 @@
//! Millau-to-Rialto messages sync entrypoint.
use messages_relay::relay_strategy::MixStrategy;
use relay_millau_client::Millau;
use relay_rialto_client::Rialto;
use substrate_relay_helper::messages_lane::{
@@ -27,25 +26,8 @@ use substrate_relay_helper::messages_lane::{
/// Description of Millau -> Rialto messages bridge.
#[derive(Clone, Debug)]
pub struct MillauMessagesToRialto;
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
Millau,
MillauMessagesToRialtoUpdateConversionRateCallBuilder,
millau_runtime::Runtime,
millau_runtime::WithRialtoMessagesInstance,
millau_runtime::rialto_messages::MillauToRialtoMessagesParameter::RialtoToMillauConversionRate
);
impl SubstrateMessageLane for MillauMessagesToRialto {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto::MILLAU_TO_RIALTO_CONVERSION_RATE_PARAMETER_NAME);
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
type SourceChain = Millau;
type TargetChain = Rialto;
@@ -59,9 +41,4 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
millau_runtime::Runtime,
millau_runtime::WithRialtoMessagesInstance,
>;
type TargetToSourceChainConversionRateUpdateBuilder =
MillauMessagesToRialtoUpdateConversionRateCallBuilder;
type RelayStrategy = MixStrategy;
}
@@ -16,7 +16,6 @@
//! Millau-to-RialtoParachain messages sync entrypoint.
use messages_relay::relay_strategy::MixStrategy;
use relay_millau_client::Millau;
use relay_rialto_parachain_client::RialtoParachain;
use substrate_relay_helper::messages_lane::{
@@ -27,30 +26,8 @@ use substrate_relay_helper::messages_lane::{
/// Description of Millau -> RialtoParachain messages bridge.
#[derive(Clone, Debug)]
pub struct MillauMessagesToRialtoParachain;
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
Millau,
MillauMessagesToRialtoParachainUpdateConversionRateCallBuilder,
millau_runtime::Runtime,
millau_runtime::WithRialtoParachainMessagesInstance,
millau_runtime::rialto_parachain_messages::MillauToRialtoParachainMessagesParameter::RialtoParachainToMillauConversionRate
);
impl SubstrateMessageLane for MillauMessagesToRialtoParachain {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE_PARAMETER_NAME);
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_PARACHAIN_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto_parachain::MILLAU_FEE_MULTIPLIER_PARAMETER_NAME);
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_PARACHAIN_FEE_MULTIPLIER_PARAMETER_NAME);
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
Some(bp_millau::TRANSACTION_PAYMENT_PALLET_NAME);
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
Some(bp_rialto_parachain::TRANSACTION_PAYMENT_PALLET_NAME);
type SourceChain = Millau;
type TargetChain = RialtoParachain;
@@ -64,9 +41,4 @@ impl SubstrateMessageLane for MillauMessagesToRialtoParachain {
millau_runtime::Runtime,
millau_runtime::WithRialtoParachainMessagesInstance,
>;
type TargetToSourceChainConversionRateUpdateBuilder =
MillauMessagesToRialtoParachainUpdateConversionRateCallBuilder;
type RelayStrategy = MixStrategy;
}
@@ -37,7 +37,6 @@ mod millau;
mod rialto;
mod rialto_parachain;
mod rococo;
mod statemine;
mod westend;
mod wococo;
@@ -16,15 +16,9 @@
//! Rialto chain specification for CLI.
use crate::cli::{
bridge,
encode_message::{CliEncodeMessage, RawMessage},
CliChain,
};
use bp_messages::LaneId;
use crate::cli::{bridge, encode_message::CliEncodeMessage, CliChain};
use bp_runtime::EncodedOrDecodedCall;
use relay_rialto_client::Rialto;
use relay_substrate_client::BalanceOf;
use sp_version::RuntimeVersion;
use xcm::latest::prelude::*;
@@ -48,28 +42,6 @@ impl CliEncodeMessage for Rialto {
})
.into())
}
fn encode_send_message_call(
lane: LaneId,
payload: RawMessage,
fee: BalanceOf<Self>,
bridge_instance_index: u8,
) -> anyhow::Result<EncodedOrDecodedCall<Self::Call>> {
Ok(match bridge_instance_index {
bridge::RIALTO_TO_MILLAU_INDEX => rialto_runtime::RuntimeCall::BridgeMillauMessages(
rialto_runtime::MessagesCall::send_message {
lane_id: lane,
payload,
delivery_and_dispatch_fee: fee,
},
)
.into(),
_ => anyhow::bail!(
"Unsupported target bridge pallet with instance index: {}",
bridge_instance_index
),
})
}
}
impl CliChain for Rialto {
@@ -16,7 +16,6 @@
//! Rialto-to-Millau messages sync entrypoint.
use messages_relay::relay_strategy::MixStrategy;
use relay_millau_client::Millau;
use relay_rialto_client::Rialto;
use substrate_relay_helper::messages_lane::{
@@ -27,25 +26,8 @@ use substrate_relay_helper::messages_lane::{
/// Description of Rialto -> Millau messages bridge.
#[derive(Clone, Debug)]
pub struct RialtoMessagesToMillau;
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
Rialto,
RialtoMessagesToMillauUpdateConversionRateCallBuilder,
rialto_runtime::Runtime,
rialto_runtime::WithMillauMessagesInstance,
rialto_runtime::millau_messages::RialtoToMillauMessagesParameter::MillauToRialtoConversionRate
);
impl SubstrateMessageLane for RialtoMessagesToMillau {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto::MILLAU_TO_RIALTO_CONVERSION_RATE_PARAMETER_NAME);
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
type SourceChain = Rialto;
type TargetChain = Millau;
@@ -59,9 +41,4 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
rialto_runtime::Runtime,
rialto_runtime::WithMillauMessagesInstance,
>;
type TargetToSourceChainConversionRateUpdateBuilder =
RialtoMessagesToMillauUpdateConversionRateCallBuilder;
type RelayStrategy = MixStrategy;
}
@@ -16,15 +16,9 @@
//! Rialto parachain specification for CLI.
use crate::cli::{
bridge,
encode_message::{CliEncodeMessage, RawMessage},
CliChain,
};
use bp_messages::LaneId;
use crate::cli::{bridge, encode_message::CliEncodeMessage, CliChain};
use bp_runtime::EncodedOrDecodedCall;
use relay_rialto_parachain_client::RialtoParachain;
use relay_substrate_client::BalanceOf;
use sp_version::RuntimeVersion;
use xcm::latest::prelude::*;
@@ -50,29 +44,6 @@ impl CliEncodeMessage for RialtoParachain {
)
.into())
}
fn encode_send_message_call(
lane: LaneId,
payload: RawMessage,
fee: BalanceOf<Self>,
bridge_instance_index: u8,
) -> anyhow::Result<EncodedOrDecodedCall<Self::Call>> {
Ok(match bridge_instance_index {
bridge::RIALTO_PARACHAIN_TO_MILLAU_INDEX =>
rialto_parachain_runtime::RuntimeCall::BridgeMillauMessages(
rialto_parachain_runtime::MessagesCall::send_message {
lane_id: lane,
payload,
delivery_and_dispatch_fee: fee,
},
)
.into(),
_ => anyhow::bail!(
"Unsupported target bridge pallet with instance index: {}",
bridge_instance_index
),
})
}
}
impl CliChain for RialtoParachain {
@@ -16,7 +16,6 @@
//! RialtoParachain-to-Millau messages sync entrypoint.
use messages_relay::relay_strategy::MixStrategy;
use relay_millau_client::Millau;
use relay_rialto_parachain_client::RialtoParachain;
use substrate_relay_helper::messages_lane::{
@@ -27,30 +26,8 @@ use substrate_relay_helper::messages_lane::{
/// Description of RialtoParachain -> Millau messages bridge.
#[derive(Clone, Debug)]
pub struct RialtoParachainMessagesToMillau;
substrate_relay_helper::generate_direct_update_conversion_rate_call_builder!(
RialtoParachain,
RialtoParachainMessagesToMillauUpdateConversionRateCallBuilder,
rialto_parachain_runtime::Runtime,
rialto_parachain_runtime::WithMillauMessagesInstance,
rialto_parachain_runtime::millau_messages::RialtoParachainToMillauMessagesParameter::MillauToRialtoParachainConversionRate
);
impl SubstrateMessageLane for RialtoParachainMessagesToMillau {
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_PARACHAIN_TO_MILLAU_CONVERSION_RATE_PARAMETER_NAME);
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto_parachain::MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE_PARAMETER_NAME);
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
Some(bp_millau::RIALTO_PARACHAIN_FEE_MULTIPLIER_PARAMETER_NAME);
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> =
Some(bp_rialto_parachain::MILLAU_FEE_MULTIPLIER_PARAMETER_NAME);
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
Some(bp_rialto_parachain::TRANSACTION_PAYMENT_PALLET_NAME);
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> =
Some(bp_millau::TRANSACTION_PAYMENT_PALLET_NAME);
type SourceChain = RialtoParachain;
type TargetChain = Millau;
@@ -64,9 +41,4 @@ impl SubstrateMessageLane for RialtoParachainMessagesToMillau {
rialto_parachain_runtime::Runtime,
rialto_parachain_runtime::WithMillauMessagesInstance,
>;
type TargetToSourceChainConversionRateUpdateBuilder =
RialtoParachainMessagesToMillauUpdateConversionRateCallBuilder;
type RelayStrategy = MixStrategy;
}
@@ -1,34 +0,0 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Statemine chain specification for CLI.
use crate::cli::CliChain;
use relay_statemine_client::Statemine;
use sp_version::RuntimeVersion;
impl CliChain for Statemine {
const RUNTIME_VERSION: Option<RuntimeVersion> = Some(bp_statemine::VERSION);
type KeyPair = sp_core::sr25519::Pair;
fn ss58_format() -> u16 {
sp_core::crypto::Ss58AddressFormat::from(
sp_core::crypto::Ss58AddressFormatRegistry::KusamaAccount,
)
.into()
}
}