From 44532aaca420a4f8e8e9b27b89f52bd7e4d697cc Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Fri, 30 Sep 2022 09:38:33 +0800 Subject: [PATCH] Companion for darwinia-network/darwinia-messages-substrate#201 --- .../src/bridges_message/crab.rs | 47 ------------------- .../src/bridges_message/pangolin.rs | 47 ------------------- 2 files changed, 94 deletions(-) diff --git a/runtime/crab-parachain/src/bridges_message/crab.rs b/runtime/crab-parachain/src/bridges_message/crab.rs index f4499014..98ba89f9 100644 --- a/runtime/crab-parachain/src/bridges_message/crab.rs +++ b/runtime/crab-parachain/src/bridges_message/crab.rs @@ -99,17 +99,6 @@ impl ThisChainWithMessages for CrabParachain { fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { MessageNonce::MAX } - - fn transaction_payment(transaction: MessageTransaction) -> Balance { - // in our testnets, both per-byte fee and weight-to-fee are 1:1 - messages::transaction_payment( - RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic, - 1, - FixedU128::zero(), - |weight| weight as _, - transaction, - ) - } } #[derive(Clone, Copy, RuntimeDebug)] @@ -132,42 +121,6 @@ impl BridgedChainWithMessages for Crab { target::maximal_incoming_message_dispatch_weight(bp_crab::Crab::max_extrinsic_weight()); 0..=upper_limit } - - fn estimate_delivery_transaction( - message_payload: &[u8], - include_pay_dispatch_fee_cost: bool, - message_dispatch_weight: Weight, - ) -> MessageTransaction { - let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX); - let extra_bytes_in_payload = Weight::from(message_payload_len) - .saturating_sub(EXPECTED_DEFAULT_MESSAGE_LENGTH.into()); - - MessageTransaction { - dispatch_weight: extra_bytes_in_payload - .saturating_mul(bp_crab::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT) - .saturating_add(bp_crab::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT) - .saturating_add(message_dispatch_weight) - .saturating_sub(if include_pay_dispatch_fee_cost { - 0 - } else { - bp_crab::PAY_INBOUND_DISPATCH_FEE_WEIGHT - }), - size: message_payload_len - .saturating_add(bp_crab::EXTRA_STORAGE_PROOF_SIZE) - .saturating_add(bp_crab::TX_EXTRA_BYTES), - } - } - - fn transaction_payment(transaction: MessageTransaction) -> Self::Balance { - // in our testnets, both per-byte fee and weight-to-fee are 1:1 - messages::transaction_payment( - bp_crab::RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic, - 1, - FixedU128::zero(), - |weight| weight as _, - transaction, - ) - } } impl TargetHeaderChain::AccountId> for Crab { type Error = &'static str; diff --git a/runtime/pangolin-parachain/src/bridges_message/pangolin.rs b/runtime/pangolin-parachain/src/bridges_message/pangolin.rs index ea01c06a..d3c2e63b 100644 --- a/runtime/pangolin-parachain/src/bridges_message/pangolin.rs +++ b/runtime/pangolin-parachain/src/bridges_message/pangolin.rs @@ -99,17 +99,6 @@ impl ThisChainWithMessages for PangolinParachain { fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { MessageNonce::MAX } - - fn transaction_payment(transaction: MessageTransaction) -> Balance { - // in our testnets, both per-byte fee and weight-to-fee are 1:1 - messages::transaction_payment( - RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic, - 1, - FixedU128::zero(), - |weight| weight as _, - transaction, - ) - } } #[derive(Clone, Copy, RuntimeDebug)] @@ -133,42 +122,6 @@ impl BridgedChainWithMessages for Pangolin { ); 0..=upper_limit } - - fn estimate_delivery_transaction( - message_payload: &[u8], - include_pay_dispatch_fee_cost: bool, - message_dispatch_weight: Weight, - ) -> MessageTransaction { - let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX); - let extra_bytes_in_payload = Weight::from(message_payload_len) - .saturating_sub(EXPECTED_DEFAULT_MESSAGE_LENGTH.into()); - - MessageTransaction { - dispatch_weight: extra_bytes_in_payload - .saturating_mul(bp_pangolin::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT) - .saturating_add(bp_pangolin::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT) - .saturating_add(message_dispatch_weight) - .saturating_sub(if include_pay_dispatch_fee_cost { - 0 - } else { - bp_pangolin::PAY_INBOUND_DISPATCH_FEE_WEIGHT - }), - size: message_payload_len - .saturating_add(bp_pangolin::EXTRA_STORAGE_PROOF_SIZE) - .saturating_add(bp_pangolin::TX_EXTRA_BYTES), - } - } - - fn transaction_payment(transaction: MessageTransaction) -> Self::Balance { - // in our testnets, both per-byte fee and weight-to-fee are 1:1 - messages::transaction_payment( - bp_pangolin::RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic, - 1, - FixedU128::zero(), - |weight| weight as _, - transaction, - ) - } } impl TargetHeaderChain::AccountId> for Pangolin