mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51:02 +00:00
remove unnecessary consts (#1586)
This commit is contained in:
committed by
Bastian Köcher
parent
0f79d1e86e
commit
5ff36549f1
@@ -90,7 +90,7 @@ impl CliEncodeMessage for Millau {
|
||||
}
|
||||
|
||||
impl CliChain for Millau {
|
||||
const RUNTIME_VERSION: RuntimeVersion = millau_runtime::VERSION;
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = Some(millau_runtime::VERSION);
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
type MessagePayload = Vec<u8>;
|
||||
|
||||
@@ -73,7 +73,7 @@ impl CliEncodeMessage for Rialto {
|
||||
}
|
||||
|
||||
impl CliChain for Rialto {
|
||||
const RUNTIME_VERSION: RuntimeVersion = rialto_runtime::VERSION;
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = Some(rialto_runtime::VERSION);
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
type MessagePayload = Vec<u8>;
|
||||
|
||||
@@ -74,7 +74,7 @@ impl CliEncodeMessage for RialtoParachain {
|
||||
}
|
||||
|
||||
impl CliChain for RialtoParachain {
|
||||
const RUNTIME_VERSION: RuntimeVersion = rialto_parachain_runtime::VERSION;
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = Some(rialto_parachain_runtime::VERSION);
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
type MessagePayload = Vec<u8>;
|
||||
|
||||
@@ -21,7 +21,7 @@ use relay_westend_client::{Westend, Westmint};
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
impl CliChain for Westend {
|
||||
const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION;
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
type MessagePayload = Vec<u8>;
|
||||
@@ -35,7 +35,7 @@ impl CliChain for Westend {
|
||||
}
|
||||
|
||||
impl CliChain for Westmint {
|
||||
const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION;
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
type MessagePayload = Vec<u8>;
|
||||
|
||||
@@ -115,7 +115,7 @@ macro_rules! declare_chain_connection_params_cli_schema {
|
||||
) -> anyhow::Result<relay_substrate_client::Client<Chain>> {
|
||||
let chain_runtime_version = self
|
||||
.[<$chain_prefix _runtime_version>]
|
||||
.into_runtime_version(Some(Chain::RUNTIME_VERSION))?;
|
||||
.into_runtime_version(Chain::RUNTIME_VERSION)?;
|
||||
Ok(relay_substrate_client::Client::new(relay_substrate_client::ConnectionParams {
|
||||
host: self.[<$chain_prefix _host>],
|
||||
port: self.[<$chain_prefix _port>],
|
||||
|
||||
@@ -163,7 +163,9 @@ impl Balance {
|
||||
/// Used to abstract away CLI commands.
|
||||
pub trait CliChain: relay_substrate_client::Chain {
|
||||
/// Current version of the chain runtime, known to relay.
|
||||
const RUNTIME_VERSION: sp_version::RuntimeVersion;
|
||||
///
|
||||
/// can be `None` if relay is not going to submit transactions to that chain.
|
||||
const RUNTIME_VERSION: Option<sp_version::RuntimeVersion>;
|
||||
|
||||
/// Crypto KeyPair type used to send messages.
|
||||
///
|
||||
|
||||
@@ -58,7 +58,6 @@ impl Chain for Kusama {
|
||||
|
||||
type SignedBlock = bp_kusama::SignedBlock;
|
||||
type Call = ();
|
||||
type WeightToFee = bp_kusama::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Kusama {
|
||||
|
||||
@@ -71,6 +71,7 @@ impl ChainWithMessages for Millau {
|
||||
bp_millau::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_millau::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
type WeightToFee = bp_millau::WeightToFee;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
@@ -85,7 +86,6 @@ impl Chain for Millau {
|
||||
|
||||
type SignedBlock = millau_runtime::SignedBlock;
|
||||
type Call = millau_runtime::Call;
|
||||
type WeightToFee = bp_millau::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithBalances for Millau {
|
||||
|
||||
@@ -58,7 +58,6 @@ impl Chain for Polkadot {
|
||||
|
||||
type SignedBlock = bp_polkadot::SignedBlock;
|
||||
type Call = ();
|
||||
type WeightToFee = bp_polkadot::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Polkadot {
|
||||
|
||||
@@ -66,7 +66,6 @@ impl Chain for RialtoParachain {
|
||||
|
||||
type SignedBlock = rialto_parachain_runtime::SignedBlock;
|
||||
type Call = rialto_parachain_runtime::Call;
|
||||
type WeightToFee = bp_rialto_parachain::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithBalances for RialtoParachain {
|
||||
@@ -93,6 +92,7 @@ impl ChainWithMessages for RialtoParachain {
|
||||
bp_rialto_parachain::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_rialto_parachain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
type WeightToFee = bp_rialto_parachain::WeightToFee;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ impl Chain for Rialto {
|
||||
|
||||
type SignedBlock = rialto_runtime::SignedBlock;
|
||||
type Call = rialto_runtime::Call;
|
||||
type WeightToFee = bp_rialto::WeightToFee;
|
||||
}
|
||||
|
||||
impl RelayChain for Rialto {
|
||||
@@ -92,6 +91,7 @@ impl ChainWithMessages for Rialto {
|
||||
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||
bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
type WeightToFee = bp_rialto::WeightToFee;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ impl Chain for Rococo {
|
||||
|
||||
type SignedBlock = bp_rococo::SignedBlock;
|
||||
type Call = ();
|
||||
type WeightToFee = bp_rococo::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Rococo {
|
||||
|
||||
@@ -59,9 +59,6 @@ pub trait Chain: ChainBase + Clone {
|
||||
type SignedBlock: Member + Serialize + DeserializeOwned + BlockWithJustification<Self::Header>;
|
||||
/// The aggregated `Call` type.
|
||||
type Call: Clone + Codec + Dispatchable + Debug + Send;
|
||||
|
||||
/// Type that is used by the chain, to convert from weight to fee.
|
||||
type WeightToFee: WeightToFee<Balance = Self::Balance>;
|
||||
}
|
||||
|
||||
/// Substrate-based relay chain that supports parachains.
|
||||
@@ -120,6 +117,8 @@ pub trait ChainWithMessages: Chain {
|
||||
/// `ChainWithMessages`.
|
||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce;
|
||||
|
||||
/// Type that is used by the chain, to convert from weight to fee.
|
||||
type WeightToFee: WeightToFee<Balance = Self::Balance>;
|
||||
/// Weights of message pallet calls.
|
||||
type WeightInfo: pallet_bridge_messages::WeightInfoExt;
|
||||
}
|
||||
@@ -127,7 +126,7 @@ pub trait ChainWithMessages: Chain {
|
||||
/// Call type used by the chain.
|
||||
pub type CallOf<C> = <C as Chain>::Call;
|
||||
/// Weight-to-Fee type used by the chain.
|
||||
pub type WeightToFeeOf<C> = <C as Chain>::WeightToFee;
|
||||
pub type WeightToFeeOf<C> = <C as ChainWithMessages>::WeightToFee;
|
||||
/// Transaction status of the chain.
|
||||
pub type TransactionStatusOf<C> = TransactionStatus<HashOf<C>, HashOf<C>>;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#![cfg(any(feature = "test-helpers", test))]
|
||||
|
||||
use crate::{Chain, ChainWithBalances};
|
||||
use frame_support::weights::{IdentityFee, Weight};
|
||||
use frame_support::weights::Weight;
|
||||
use std::time::Duration;
|
||||
|
||||
/// Chain that may be used in tests.
|
||||
@@ -60,7 +60,6 @@ impl Chain for TestChain {
|
||||
sp_runtime::generic::Block<Self::Header, sp_runtime::OpaqueExtrinsic>,
|
||||
>;
|
||||
type Call = ();
|
||||
type WeightToFee = IdentityFee<u32>;
|
||||
}
|
||||
|
||||
impl ChainWithBalances for TestChain {
|
||||
|
||||
@@ -61,7 +61,6 @@ impl Chain for Westend {
|
||||
|
||||
type SignedBlock = bp_westend::SignedBlock;
|
||||
type Call = bp_westend::Call;
|
||||
type WeightToFee = bp_westend::WeightToFee;
|
||||
}
|
||||
|
||||
impl RelayChain for Westend {
|
||||
@@ -119,5 +118,4 @@ impl Chain for Westmint {
|
||||
|
||||
type SignedBlock = bp_westend::SignedBlock;
|
||||
type Call = bp_westend::Call;
|
||||
type WeightToFee = bp_westend::WeightToFee;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ impl Chain for Wococo {
|
||||
|
||||
type SignedBlock = bp_wococo::SignedBlock;
|
||||
type Call = ();
|
||||
type WeightToFee = bp_wococo::WeightToFee;
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Wococo {
|
||||
|
||||
@@ -497,7 +497,7 @@ where
|
||||
/// **WARNING**: this functions will only be accurate if weight-to-fee conversion function
|
||||
/// is linear. For non-linear polynomials the error will grow with `weight_difference` growth.
|
||||
/// So better to use smaller differences.
|
||||
fn compute_fee_multiplier<C: Chain>(
|
||||
fn compute_fee_multiplier<C: ChainWithMessages>(
|
||||
smaller_adjusted_weight_fee: BalanceOf<C>,
|
||||
smaller_tx_weight: Weight,
|
||||
larger_adjusted_weight_fee: BalanceOf<C>,
|
||||
@@ -563,17 +563,17 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn compute_fee_multiplier_returns_sane_results() {
|
||||
let multiplier: FixedU128 = bp_rococo::WeightToFee::weight_to_fee(&1).into();
|
||||
let multiplier: FixedU128 = bp_rialto::WeightToFee::weight_to_fee(&1).into();
|
||||
|
||||
let smaller_weight = 1_000_000;
|
||||
let smaller_adjusted_weight_fee =
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rococo>::weight_to_fee(&smaller_weight));
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rialto>::weight_to_fee(&smaller_weight));
|
||||
|
||||
let larger_weight = smaller_weight + 200_000;
|
||||
let larger_adjusted_weight_fee =
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rococo>::weight_to_fee(&larger_weight));
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rialto>::weight_to_fee(&larger_weight));
|
||||
assert_eq!(
|
||||
compute_fee_multiplier::<Rococo>(
|
||||
compute_fee_multiplier::<Rialto>(
|
||||
smaller_adjusted_weight_fee,
|
||||
smaller_weight,
|
||||
larger_adjusted_weight_fee,
|
||||
|
||||
Reference in New Issue
Block a user