mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 04:45:42 +00:00
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:
committed by
Bastian Köcher
parent
1217b2cf80
commit
8c845602cf
@@ -32,18 +32,8 @@ pub mod rialto_messages;
|
||||
pub mod rialto_parachain_messages;
|
||||
pub mod xcm_config;
|
||||
|
||||
use crate::{
|
||||
rialto_messages::{ToRialtoMessagePayload, WithRialtoMessageBridge},
|
||||
rialto_parachain_messages::{
|
||||
ToRialtoParachainMessagePayload, WithRialtoParachainMessageBridge,
|
||||
},
|
||||
};
|
||||
|
||||
use beefy_primitives::{crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet};
|
||||
use bp_runtime::{HeaderId, HeaderIdProvider};
|
||||
use bridge_runtime_common::messages::{
|
||||
source::estimate_message_dispatch_and_delivery_fee, MessageBridge,
|
||||
};
|
||||
use codec::Decode;
|
||||
use pallet_grandpa::{
|
||||
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
|
||||
@@ -57,7 +47,7 @@ use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
traits::{Block as BlockT, IdentityLookup, Keccak256, NumberFor, OpaqueKeys},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perquintill,
|
||||
ApplyExtrinsicResult, FixedPointNumber, Perquintill,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -476,9 +466,6 @@ parameter_types! {
|
||||
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
// `IdentityFee` is used by Millau => we may use weight directly
|
||||
pub const GetDeliveryConfirmationTransactionFee: Balance =
|
||||
bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT.ref_time() as _;
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
pub const RialtoChainId: bp_runtime::ChainId = bp_runtime::RIALTO_CHAIN_ID;
|
||||
pub const RialtoParachainChainId: bp_runtime::ChainId = bp_runtime::RIALTO_PARACHAIN_CHAIN_ID;
|
||||
@@ -490,17 +477,14 @@ pub type WithRialtoMessagesInstance = ();
|
||||
impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
|
||||
type Parameter = rialto_messages::MillauToRialtoMessagesParameter;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
|
||||
type MaximalOutboundPayloadSize = crate::rialto_messages::ToRialtoMaximalOutboundPayloadSize;
|
||||
type OutboundPayload = crate::rialto_messages::ToRialtoMessagePayload;
|
||||
type OutboundMessageFee = Balance;
|
||||
|
||||
type InboundPayload = crate::rialto_messages::FromRialtoMessagePayload;
|
||||
type InboundMessageFee = bp_rialto::Balance;
|
||||
type InboundRelayer = bp_rialto::AccountId;
|
||||
|
||||
type TargetHeaderChain = crate::rialto_messages::Rialto;
|
||||
@@ -509,7 +493,6 @@ impl pallet_bridge_messages::Config<WithRialtoMessagesInstance> for Runtime {
|
||||
pallet_bridge_relayers::MessageDeliveryAndDispatchPaymentAdapter<
|
||||
Runtime,
|
||||
WithRialtoMessagesInstance,
|
||||
GetDeliveryConfirmationTransactionFee,
|
||||
>;
|
||||
type OnMessageAccepted = ();
|
||||
type OnDeliveryConfirmed = ();
|
||||
@@ -525,7 +508,6 @@ pub type WithRialtoParachainMessagesInstance = pallet_bridge_messages::Instance1
|
||||
impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = pallet_bridge_messages::weights::BridgeWeight<Runtime>;
|
||||
type Parameter = rialto_parachain_messages::MillauToRialtoParachainMessagesParameter;
|
||||
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
|
||||
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
|
||||
type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane;
|
||||
@@ -533,10 +515,8 @@ impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Run
|
||||
type MaximalOutboundPayloadSize =
|
||||
crate::rialto_parachain_messages::ToRialtoParachainMaximalOutboundPayloadSize;
|
||||
type OutboundPayload = crate::rialto_parachain_messages::ToRialtoParachainMessagePayload;
|
||||
type OutboundMessageFee = Balance;
|
||||
|
||||
type InboundPayload = crate::rialto_parachain_messages::FromRialtoParachainMessagePayload;
|
||||
type InboundMessageFee = bp_rialto_parachain::Balance;
|
||||
type InboundRelayer = bp_rialto_parachain::AccountId;
|
||||
|
||||
type TargetHeaderChain = crate::rialto_parachain_messages::RialtoParachain;
|
||||
@@ -545,7 +525,6 @@ impl pallet_bridge_messages::Config<WithRialtoParachainMessagesInstance> for Run
|
||||
pallet_bridge_relayers::MessageDeliveryAndDispatchPaymentAdapter<
|
||||
Runtime,
|
||||
WithRialtoParachainMessagesInstance,
|
||||
GetDeliveryConfirmationTransactionFee,
|
||||
>;
|
||||
type OnMessageAccepted = ();
|
||||
type OnDeliveryConfirmed = ();
|
||||
@@ -941,24 +920,12 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rialto::ToRialtoOutboundLaneApi<Block, Balance, ToRialtoMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: ToRialtoMessagePayload,
|
||||
rialto_to_this_conversion_rate: Option<FixedU128>,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<WithRialtoMessageBridge>(
|
||||
&payload,
|
||||
WithRialtoMessageBridge::RELAYER_FEE_PERCENT,
|
||||
rialto_to_this_conversion_rate,
|
||||
).ok()
|
||||
}
|
||||
|
||||
impl bp_rialto::ToRialtoOutboundLaneApi<Block> for Runtime {
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<bp_messages::OutboundMessageDetails<Balance>> {
|
||||
) -> Vec<bp_messages::OutboundMessageDetails> {
|
||||
bridge_runtime_common::messages_api::outbound_message_details::<
|
||||
Runtime,
|
||||
WithRialtoMessagesInstance,
|
||||
@@ -966,10 +933,10 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rialto::FromRialtoInboundLaneApi<Block, bp_rialto::Balance> for Runtime {
|
||||
impl bp_rialto::FromRialtoInboundLaneApi<Block> for Runtime {
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails<bp_rialto::Balance>)>,
|
||||
messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>,
|
||||
) -> Vec<bp_messages::InboundMessageDetails> {
|
||||
bridge_runtime_common::messages_api::inbound_message_details::<
|
||||
Runtime,
|
||||
@@ -978,24 +945,12 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rialto_parachain::ToRialtoParachainOutboundLaneApi<Block, Balance, ToRialtoParachainMessagePayload> for Runtime {
|
||||
fn estimate_message_delivery_and_dispatch_fee(
|
||||
_lane_id: bp_messages::LaneId,
|
||||
payload: ToRialtoParachainMessagePayload,
|
||||
rialto_parachain_to_this_conversion_rate: Option<FixedU128>,
|
||||
) -> Option<Balance> {
|
||||
estimate_message_dispatch_and_delivery_fee::<WithRialtoParachainMessageBridge>(
|
||||
&payload,
|
||||
WithRialtoParachainMessageBridge::RELAYER_FEE_PERCENT,
|
||||
rialto_parachain_to_this_conversion_rate,
|
||||
).ok()
|
||||
}
|
||||
|
||||
impl bp_rialto_parachain::ToRialtoParachainOutboundLaneApi<Block> for Runtime {
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
begin: bp_messages::MessageNonce,
|
||||
end: bp_messages::MessageNonce,
|
||||
) -> Vec<bp_messages::OutboundMessageDetails<Balance>> {
|
||||
) -> Vec<bp_messages::OutboundMessageDetails> {
|
||||
bridge_runtime_common::messages_api::outbound_message_details::<
|
||||
Runtime,
|
||||
WithRialtoParachainMessagesInstance,
|
||||
@@ -1003,10 +958,10 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl bp_rialto_parachain::FromRialtoParachainInboundLaneApi<Block, bp_rialto_parachain::Balance> for Runtime {
|
||||
impl bp_rialto_parachain::FromRialtoParachainInboundLaneApi<Block> for Runtime {
|
||||
fn message_details(
|
||||
lane: bp_messages::LaneId,
|
||||
messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails<bp_rialto_parachain::Balance>)>,
|
||||
messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>,
|
||||
) -> Vec<bp_messages::InboundMessageDetails> {
|
||||
bridge_runtime_common::messages_api::inbound_message_details::<
|
||||
Runtime,
|
||||
@@ -1060,13 +1015,11 @@ impl_runtime_apis! {
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
|
||||
use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof, prepare_message_proof, prepare_outbound_message};
|
||||
use bridge_runtime_common::messages;
|
||||
use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof, prepare_message_proof};
|
||||
use pallet_bridge_messages::benchmarking::{
|
||||
Pallet as MessagesBench,
|
||||
Config as MessagesConfig,
|
||||
MessageDeliveryProofParams,
|
||||
MessageParams,
|
||||
MessageProofParams,
|
||||
};
|
||||
use pallet_bridge_parachains::benchmarking::{
|
||||
@@ -1076,18 +1029,10 @@ impl_runtime_apis! {
|
||||
use rialto_messages::WithRialtoMessageBridge;
|
||||
|
||||
impl MessagesConfig<WithRialtoMessagesInstance> for Runtime {
|
||||
fn maximal_message_size() -> u32 {
|
||||
messages::source::maximal_message_size::<WithRialtoMessageBridge>()
|
||||
}
|
||||
|
||||
fn bridged_relayer_id() -> Self::InboundRelayer {
|
||||
[0u8; 32].into()
|
||||
}
|
||||
|
||||
fn account_balance(account: &Self::AccountId) -> Self::OutboundMessageFee {
|
||||
pallet_balances::Pallet::<Runtime>::free_balance(account)
|
||||
}
|
||||
|
||||
fn endow_account(account: &Self::AccountId) {
|
||||
pallet_balances::Pallet::<Runtime>::make_free_balance_be(
|
||||
account,
|
||||
@@ -1095,12 +1040,6 @@ impl_runtime_apis! {
|
||||
);
|
||||
}
|
||||
|
||||
fn prepare_outbound_message(
|
||||
params: MessageParams<Self::AccountId>,
|
||||
) -> (rialto_messages::ToRialtoMessagePayload, Balance) {
|
||||
(prepare_outbound_message::<WithRialtoMessageBridge>(params), Self::message_fee())
|
||||
}
|
||||
|
||||
fn prepare_message_proof(
|
||||
params: MessageProofParams,
|
||||
) -> (rialto_messages::FromRialtoMessagesProof, Weight) {
|
||||
|
||||
Reference in New Issue
Block a user