mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
remove unnecessary consts (#1586)
This commit is contained in:
committed by
Bastian Köcher
parent
0f79d1e86e
commit
5ff36549f1
@@ -11,27 +11,17 @@ smallvec = "1.7"
|
|||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|
||||||
bp-messages = { path = "../messages", default-features = false }
|
|
||||||
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
|
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"bp-messages/std",
|
|
||||||
"bp-polkadot-core/std",
|
"bp-polkadot-core/std",
|
||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"frame-support/std",
|
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-runtime/std",
|
|
||||||
"sp-std/std",
|
|
||||||
"sp-version/std",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,58 +18,12 @@
|
|||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
use bp_messages::{
|
|
||||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
|
||||||
};
|
|
||||||
use frame_support::weights::{
|
|
||||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
|
||||||
};
|
|
||||||
use sp_runtime::FixedU128;
|
|
||||||
use sp_std::prelude::*;
|
|
||||||
use sp_version::RuntimeVersion;
|
|
||||||
|
|
||||||
pub use bp_polkadot_core::*;
|
pub use bp_polkadot_core::*;
|
||||||
use bp_runtime::decl_bridge_runtime_apis;
|
use bp_runtime::decl_bridge_finality_runtime_apis;
|
||||||
|
|
||||||
/// Kusama Chain
|
/// Kusama Chain
|
||||||
pub type Kusama = PolkadotLike;
|
pub type Kusama = PolkadotLike;
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo.
|
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|
||||||
spec_name: sp_version::create_runtime_str!("kusama"),
|
|
||||||
impl_name: sp_version::create_runtime_str!("parity-kusama"),
|
|
||||||
authoring_version: 2,
|
|
||||||
spec_version: 9180,
|
|
||||||
impl_version: 0,
|
|
||||||
apis: sp_version::create_apis_vec![[]],
|
|
||||||
transaction_version: 11,
|
|
||||||
state_version: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo.
|
|
||||||
pub struct WeightToFee;
|
|
||||||
impl WeightToFeePolynomial for WeightToFee {
|
|
||||||
type Balance = Balance;
|
|
||||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
|
||||||
const CENTS: Balance = 1_000_000_000_000 / 30_000;
|
|
||||||
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
|
||||||
let p = CENTS;
|
|
||||||
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
|
|
||||||
smallvec::smallvec![WeightToFeeCoefficient {
|
|
||||||
degree: 1,
|
|
||||||
negative: false,
|
|
||||||
coeff_frac: Perbill::from_rational(p % q, q),
|
|
||||||
coeff_integer: p / q,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Per-byte fee for Kusama transactions.
|
|
||||||
pub const TRANSACTION_BYTE_FEE: Balance = 10 * 1_000_000_000_000 / 30_000 / 1_000;
|
|
||||||
|
|
||||||
/// Existential deposit on Kusama.
|
|
||||||
pub const EXISTENTIAL_DEPOSIT: Balance = 1_000_000_000_000 / 30_000;
|
|
||||||
|
|
||||||
/// The target length of a session (how often authorities change) on Kusama measured in of number of
|
/// The target length of a session (how often authorities change) on Kusama measured in of number of
|
||||||
/// blocks.
|
/// blocks.
|
||||||
///
|
///
|
||||||
@@ -79,16 +33,5 @@ pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
|
|||||||
|
|
||||||
/// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains.
|
/// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa";
|
pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa";
|
||||||
/// Name of the With-Kusama messages pallet instance that is deployed at bridged chains.
|
|
||||||
pub const WITH_KUSAMA_MESSAGES_PALLET_NAME: &str = "BridgeKusamaMessages";
|
|
||||||
|
|
||||||
/// Name of the transaction payment pallet at the Kusama runtime.
|
decl_bridge_finality_runtime_apis!(kusama);
|
||||||
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
|
|
||||||
|
|
||||||
/// Name of the DOT->KSM conversion rate stored in the Kusama runtime.
|
|
||||||
pub const POLKADOT_TO_KUSAMA_CONVERSION_RATE_PARAMETER_NAME: &str =
|
|
||||||
"PolkadotToKusamaConversionRate";
|
|
||||||
/// Name of the Polkadot fee multiplier parameter, stored in the Polkadot runtime.
|
|
||||||
pub const POLKADOT_FEE_MULTIPLIER_PARAMETER_NAME: &str = "PolkadotFeeMultiplier";
|
|
||||||
|
|
||||||
decl_bridge_runtime_apis!(kusama);
|
|
||||||
|
|||||||
@@ -11,27 +11,17 @@ smallvec = "1.7"
|
|||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|
||||||
bp-messages = { path = "../messages", default-features = false }
|
|
||||||
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
|
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"bp-messages/std",
|
|
||||||
"bp-polkadot-core/std",
|
"bp-polkadot-core/std",
|
||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"frame-support/std",
|
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-runtime/std",
|
|
||||||
"sp-std/std",
|
|
||||||
"sp-version/std",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,58 +18,12 @@
|
|||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
use bp_messages::{
|
|
||||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
|
||||||
};
|
|
||||||
use frame_support::weights::{
|
|
||||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
|
||||||
};
|
|
||||||
use sp_runtime::FixedU128;
|
|
||||||
use sp_std::prelude::*;
|
|
||||||
use sp_version::RuntimeVersion;
|
|
||||||
|
|
||||||
pub use bp_polkadot_core::*;
|
pub use bp_polkadot_core::*;
|
||||||
use bp_runtime::decl_bridge_runtime_apis;
|
use bp_runtime::decl_bridge_finality_runtime_apis;
|
||||||
|
|
||||||
/// Polkadot Chain
|
/// Polkadot Chain
|
||||||
pub type Polkadot = PolkadotLike;
|
pub type Polkadot = PolkadotLike;
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo.
|
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|
||||||
spec_name: sp_version::create_runtime_str!("polkadot"),
|
|
||||||
impl_name: sp_version::create_runtime_str!("parity-polkadot"),
|
|
||||||
authoring_version: 0,
|
|
||||||
spec_version: 9180,
|
|
||||||
impl_version: 0,
|
|
||||||
apis: sp_version::create_apis_vec![[]],
|
|
||||||
transaction_version: 12,
|
|
||||||
state_version: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo.
|
|
||||||
pub struct WeightToFee;
|
|
||||||
impl WeightToFeePolynomial for WeightToFee {
|
|
||||||
type Balance = Balance;
|
|
||||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
|
||||||
const CENTS: Balance = 10_000_000_000 / 100;
|
|
||||||
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
|
||||||
let p = CENTS;
|
|
||||||
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
|
|
||||||
smallvec::smallvec![WeightToFeeCoefficient {
|
|
||||||
degree: 1,
|
|
||||||
negative: false,
|
|
||||||
coeff_frac: Perbill::from_rational(p % q, q),
|
|
||||||
coeff_integer: p / q,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Per-byte fee for Polkadot transactions.
|
|
||||||
pub const TRANSACTION_BYTE_FEE: Balance = 10 * 10_000_000_000 / 100 / 1_000;
|
|
||||||
|
|
||||||
/// Existential deposit on Polkadot.
|
|
||||||
pub const EXISTENTIAL_DEPOSIT: Balance = 10_000_000_000;
|
|
||||||
|
|
||||||
/// The target length of a session (how often authorities change) on Polkadot measured in of number
|
/// The target length of a session (how often authorities change) on Polkadot measured in of number
|
||||||
/// of blocks.
|
/// of blocks.
|
||||||
///
|
///
|
||||||
@@ -79,16 +33,5 @@ pub const SESSION_LENGTH: BlockNumber = 4 * time_units::HOURS;
|
|||||||
|
|
||||||
/// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains.
|
/// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa";
|
pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa";
|
||||||
/// Name of the With-Polkadot messages pallet instance that is deployed at bridged chains.
|
|
||||||
pub const WITH_POLKADOT_MESSAGES_PALLET_NAME: &str = "BridgePolkadotMessages";
|
|
||||||
|
|
||||||
/// Name of the transaction payment pallet at the Polkadot runtime.
|
decl_bridge_finality_runtime_apis!(polkadot);
|
||||||
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
|
|
||||||
|
|
||||||
/// Name of the KSM->DOT conversion rate parameter, stored in the Polkadot runtime.
|
|
||||||
pub const KUSAMA_TO_POLKADOT_CONVERSION_RATE_PARAMETER_NAME: &str =
|
|
||||||
"KusamaToPolkadotConversionRate";
|
|
||||||
/// Name of the Kusama fee multiplier parameter, stored in the Polkadot runtime.
|
|
||||||
pub const KUSAMA_FEE_MULTIPLIER_PARAMETER_NAME: &str = "KusamaFeeMultiplier";
|
|
||||||
|
|
||||||
decl_bridge_runtime_apis!(polkadot);
|
|
||||||
|
|||||||
@@ -7,31 +7,19 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
|
|
||||||
smallvec = "1.7"
|
smallvec = "1.7"
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
bp-messages = { path = "../messages", default-features = false }
|
|
||||||
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"bp-messages/std",
|
|
||||||
"bp-polkadot-core/std",
|
"bp-polkadot-core/std",
|
||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"frame-support/std",
|
|
||||||
"codec/std",
|
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-runtime/std",
|
|
||||||
"sp-std/std",
|
|
||||||
"sp-version/std",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,18 +18,8 @@
|
|||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
use bp_messages::{
|
|
||||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
|
||||||
};
|
|
||||||
use frame_support::weights::{
|
|
||||||
Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
|
||||||
};
|
|
||||||
use sp_runtime::FixedU128;
|
|
||||||
use sp_std::prelude::*;
|
|
||||||
use sp_version::RuntimeVersion;
|
|
||||||
|
|
||||||
pub use bp_polkadot_core::*;
|
pub use bp_polkadot_core::*;
|
||||||
use bp_runtime::decl_bridge_runtime_apis;
|
use bp_runtime::decl_bridge_finality_runtime_apis;
|
||||||
|
|
||||||
/// Rococo Chain
|
/// Rococo Chain
|
||||||
pub type Rococo = PolkadotLike;
|
pub type Rococo = PolkadotLike;
|
||||||
@@ -41,50 +31,7 @@ pub type Rococo = PolkadotLike;
|
|||||||
/// conditions.
|
/// conditions.
|
||||||
pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
|
pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
|
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|
||||||
spec_name: sp_version::create_runtime_str!("rococo"),
|
|
||||||
impl_name: sp_version::create_runtime_str!("parity-rococo-v2.0"),
|
|
||||||
authoring_version: 0,
|
|
||||||
spec_version: 9200,
|
|
||||||
impl_version: 0,
|
|
||||||
apis: sp_version::create_apis_vec![[]],
|
|
||||||
transaction_version: 0,
|
|
||||||
state_version: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
|
|
||||||
pub struct WeightToFee;
|
|
||||||
impl WeightToFeePolynomial for WeightToFee {
|
|
||||||
type Balance = Balance;
|
|
||||||
fn polynomial() -> WeightToFeeCoefficients<Balance> {
|
|
||||||
const CENTS: Balance = 1_000_000_000_000 / 100;
|
|
||||||
let p = CENTS;
|
|
||||||
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
|
|
||||||
smallvec::smallvec![WeightToFeeCoefficient {
|
|
||||||
degree: 1,
|
|
||||||
negative: false,
|
|
||||||
coeff_frac: Perbill::from_rational(p % q, q),
|
|
||||||
coeff_integer: p / q,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
|
/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
|
pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
|
||||||
/// Name of the With-Rococo messages pallet instance that is deployed at bridged chains.
|
|
||||||
pub const WITH_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessages";
|
|
||||||
|
|
||||||
/// Existential deposit on Rococo.
|
decl_bridge_finality_runtime_apis!(rococo);
|
||||||
pub const EXISTENTIAL_DEPOSIT: Balance = 1_000_000_000_000 / 100;
|
|
||||||
|
|
||||||
/// Weight of pay-dispatch-fee operation for inbound messages at Rococo chain.
|
|
||||||
///
|
|
||||||
/// This value corresponds to the result of
|
|
||||||
/// `pallet_bridge_messages::WeightInfoExt::pay_inbound_dispatch_fee_overhead()` call for your
|
|
||||||
/// chain. Don't put too much reserve there, because it is used to **decrease**
|
|
||||||
/// `DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT` cost. So putting large reserve would make delivery
|
|
||||||
/// transactions cheaper.
|
|
||||||
pub const PAY_INBOUND_DISPATCH_FEE_WEIGHT: Weight = 600_000_000;
|
|
||||||
|
|
||||||
decl_bridge_runtime_apis!(rococo);
|
|
||||||
|
|||||||
@@ -19,11 +19,8 @@ bp-runtime = { path = "../runtime", default-features = false }
|
|||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
|
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
@@ -31,11 +28,8 @@ std = [
|
|||||||
"bp-header-chain/std",
|
"bp-header-chain/std",
|
||||||
"bp-polkadot-core/std",
|
"bp-polkadot-core/std",
|
||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"frame-support/std",
|
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
"sp-std/std",
|
|
||||||
"sp-version/std",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,12 +18,7 @@
|
|||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
use frame_support::weights::{
|
|
||||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
|
||||||
};
|
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_std::prelude::*;
|
|
||||||
use sp_version::RuntimeVersion;
|
|
||||||
|
|
||||||
pub use bp_polkadot_core::*;
|
pub use bp_polkadot_core::*;
|
||||||
use bp_runtime::decl_bridge_finality_runtime_apis;
|
use bp_runtime::decl_bridge_finality_runtime_apis;
|
||||||
@@ -31,36 +26,6 @@ use bp_runtime::decl_bridge_finality_runtime_apis;
|
|||||||
/// Westend Chain
|
/// Westend Chain
|
||||||
pub type Westend = PolkadotLike;
|
pub type Westend = PolkadotLike;
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Westend runtime found in the Polkadot repo.
|
|
||||||
pub struct WeightToFee;
|
|
||||||
impl WeightToFeePolynomial for WeightToFee {
|
|
||||||
type Balance = Balance;
|
|
||||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
|
||||||
const CENTS: Balance = 1_000_000_000_000 / 1_000;
|
|
||||||
// in Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
|
||||||
let p = CENTS;
|
|
||||||
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
|
|
||||||
smallvec::smallvec![WeightToFeeCoefficient {
|
|
||||||
degree: 1,
|
|
||||||
negative: false,
|
|
||||||
coeff_frac: Perbill::from_rational(p % q, q),
|
|
||||||
coeff_integer: p / q,
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: This needs to be kept up to date with the Westend runtime found in the Polkadot repo.
|
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|
||||||
spec_name: sp_version::create_runtime_str!("westend"),
|
|
||||||
impl_name: sp_version::create_runtime_str!("parity-westend"),
|
|
||||||
authoring_version: 2,
|
|
||||||
spec_version: 9140,
|
|
||||||
impl_version: 0,
|
|
||||||
apis: sp_version::create_apis_vec![[]],
|
|
||||||
transaction_version: 8,
|
|
||||||
state_version: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Westend Runtime `Call` enum.
|
/// Westend Runtime `Call` enum.
|
||||||
///
|
///
|
||||||
/// We are not currently submitting any Westend transactions => it is empty.
|
/// We are not currently submitting any Westend transactions => it is empty.
|
||||||
|
|||||||
@@ -7,28 +7,20 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
|
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
bp-messages = { path = "../messages", default-features = false }
|
|
||||||
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
|
||||||
bp-rococo = { path = "../chain-rococo", default-features = false }
|
bp-rococo = { path = "../chain-rococo", default-features = false }
|
||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"bp-messages/std",
|
|
||||||
"bp-polkadot-core/std",
|
"bp-polkadot-core/std",
|
||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"bp-rococo/std",
|
"bp-rococo/std",
|
||||||
"codec/std",
|
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-runtime/std",
|
|
||||||
"sp-std/std",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,16 +18,8 @@
|
|||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
use bp_messages::{
|
|
||||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
|
||||||
};
|
|
||||||
use sp_runtime::FixedU128;
|
|
||||||
use sp_std::prelude::*;
|
|
||||||
|
|
||||||
pub use bp_polkadot_core::*;
|
pub use bp_polkadot_core::*;
|
||||||
// Rococo runtime = Wococo runtime
|
use bp_runtime::decl_bridge_finality_runtime_apis;
|
||||||
pub use bp_rococo::{WeightToFee, EXISTENTIAL_DEPOSIT, PAY_INBOUND_DISPATCH_FEE_WEIGHT, VERSION};
|
|
||||||
use bp_runtime::decl_bridge_runtime_apis;
|
|
||||||
|
|
||||||
/// Wococo Chain
|
/// Wococo Chain
|
||||||
pub type Wococo = PolkadotLike;
|
pub type Wococo = PolkadotLike;
|
||||||
@@ -41,7 +33,5 @@ pub const SESSION_LENGTH: BlockNumber = time_units::MINUTES;
|
|||||||
|
|
||||||
/// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains.
|
/// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains.
|
||||||
pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa";
|
pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa";
|
||||||
/// Name of the With-Wococo messages pallet instance that is deployed at bridged chains.
|
|
||||||
pub const WITH_WOCOCO_MESSAGES_PALLET_NAME: &str = "BridgeWococoMessages";
|
|
||||||
|
|
||||||
decl_bridge_runtime_apis!(wococo);
|
decl_bridge_finality_runtime_apis!(wococo);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ impl CliEncodeMessage for Millau {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CliChain 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 KeyPair = sp_core::sr25519::Pair;
|
||||||
type MessagePayload = Vec<u8>;
|
type MessagePayload = Vec<u8>;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ impl CliEncodeMessage for Rialto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CliChain 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 KeyPair = sp_core::sr25519::Pair;
|
||||||
type MessagePayload = Vec<u8>;
|
type MessagePayload = Vec<u8>;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ impl CliEncodeMessage for RialtoParachain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CliChain 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 KeyPair = sp_core::sr25519::Pair;
|
||||||
type MessagePayload = Vec<u8>;
|
type MessagePayload = Vec<u8>;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use relay_westend_client::{Westend, Westmint};
|
|||||||
use sp_version::RuntimeVersion;
|
use sp_version::RuntimeVersion;
|
||||||
|
|
||||||
impl CliChain for Westend {
|
impl CliChain for Westend {
|
||||||
const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION;
|
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||||
|
|
||||||
type KeyPair = sp_core::sr25519::Pair;
|
type KeyPair = sp_core::sr25519::Pair;
|
||||||
type MessagePayload = Vec<u8>;
|
type MessagePayload = Vec<u8>;
|
||||||
@@ -35,7 +35,7 @@ impl CliChain for Westend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CliChain for Westmint {
|
impl CliChain for Westmint {
|
||||||
const RUNTIME_VERSION: RuntimeVersion = bp_westend::VERSION;
|
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||||
|
|
||||||
type KeyPair = sp_core::sr25519::Pair;
|
type KeyPair = sp_core::sr25519::Pair;
|
||||||
type MessagePayload = Vec<u8>;
|
type MessagePayload = Vec<u8>;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ macro_rules! declare_chain_connection_params_cli_schema {
|
|||||||
) -> anyhow::Result<relay_substrate_client::Client<Chain>> {
|
) -> anyhow::Result<relay_substrate_client::Client<Chain>> {
|
||||||
let chain_runtime_version = self
|
let chain_runtime_version = self
|
||||||
.[<$chain_prefix _runtime_version>]
|
.[<$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 {
|
Ok(relay_substrate_client::Client::new(relay_substrate_client::ConnectionParams {
|
||||||
host: self.[<$chain_prefix _host>],
|
host: self.[<$chain_prefix _host>],
|
||||||
port: self.[<$chain_prefix _port>],
|
port: self.[<$chain_prefix _port>],
|
||||||
|
|||||||
@@ -163,7 +163,9 @@ impl Balance {
|
|||||||
/// Used to abstract away CLI commands.
|
/// Used to abstract away CLI commands.
|
||||||
pub trait CliChain: relay_substrate_client::Chain {
|
pub trait CliChain: relay_substrate_client::Chain {
|
||||||
/// Current version of the chain runtime, known to relay.
|
/// 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.
|
/// Crypto KeyPair type used to send messages.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ impl Chain for Kusama {
|
|||||||
|
|
||||||
type SignedBlock = bp_kusama::SignedBlock;
|
type SignedBlock = bp_kusama::SignedBlock;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type WeightToFee = bp_kusama::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithGrandpa for Kusama {
|
impl ChainWithGrandpa for Kusama {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ impl ChainWithMessages for Millau {
|
|||||||
bp_millau::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
bp_millau::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||||
bp_millau::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
bp_millau::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||||
|
type WeightToFee = bp_millau::WeightToFee;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +86,6 @@ impl Chain for Millau {
|
|||||||
|
|
||||||
type SignedBlock = millau_runtime::SignedBlock;
|
type SignedBlock = millau_runtime::SignedBlock;
|
||||||
type Call = millau_runtime::Call;
|
type Call = millau_runtime::Call;
|
||||||
type WeightToFee = bp_millau::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithBalances for Millau {
|
impl ChainWithBalances for Millau {
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ impl Chain for Polkadot {
|
|||||||
|
|
||||||
type SignedBlock = bp_polkadot::SignedBlock;
|
type SignedBlock = bp_polkadot::SignedBlock;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type WeightToFee = bp_polkadot::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithGrandpa for Polkadot {
|
impl ChainWithGrandpa for Polkadot {
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ impl Chain for RialtoParachain {
|
|||||||
|
|
||||||
type SignedBlock = rialto_parachain_runtime::SignedBlock;
|
type SignedBlock = rialto_parachain_runtime::SignedBlock;
|
||||||
type Call = rialto_parachain_runtime::Call;
|
type Call = rialto_parachain_runtime::Call;
|
||||||
type WeightToFee = bp_rialto_parachain::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithBalances for RialtoParachain {
|
impl ChainWithBalances for RialtoParachain {
|
||||||
@@ -93,6 +92,7 @@ impl ChainWithMessages for RialtoParachain {
|
|||||||
bp_rialto_parachain::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
bp_rialto_parachain::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||||
bp_rialto_parachain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
bp_rialto_parachain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||||
|
type WeightToFee = bp_rialto_parachain::WeightToFee;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ impl Chain for Rialto {
|
|||||||
|
|
||||||
type SignedBlock = rialto_runtime::SignedBlock;
|
type SignedBlock = rialto_runtime::SignedBlock;
|
||||||
type Call = rialto_runtime::Call;
|
type Call = rialto_runtime::Call;
|
||||||
type WeightToFee = bp_rialto::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RelayChain for Rialto {
|
impl RelayChain for Rialto {
|
||||||
@@ -92,6 +91,7 @@ impl ChainWithMessages for Rialto {
|
|||||||
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
|
||||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
|
||||||
bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||||
|
type WeightToFee = bp_rialto::WeightToFee;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ impl Chain for Rococo {
|
|||||||
|
|
||||||
type SignedBlock = bp_rococo::SignedBlock;
|
type SignedBlock = bp_rococo::SignedBlock;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type WeightToFee = bp_rococo::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithGrandpa for Rococo {
|
impl ChainWithGrandpa for Rococo {
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ pub trait Chain: ChainBase + Clone {
|
|||||||
type SignedBlock: Member + Serialize + DeserializeOwned + BlockWithJustification<Self::Header>;
|
type SignedBlock: Member + Serialize + DeserializeOwned + BlockWithJustification<Self::Header>;
|
||||||
/// The aggregated `Call` type.
|
/// The aggregated `Call` type.
|
||||||
type Call: Clone + Codec + Dispatchable + Debug + Send;
|
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.
|
/// Substrate-based relay chain that supports parachains.
|
||||||
@@ -120,6 +117,8 @@ pub trait ChainWithMessages: Chain {
|
|||||||
/// `ChainWithMessages`.
|
/// `ChainWithMessages`.
|
||||||
const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce;
|
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.
|
/// Weights of message pallet calls.
|
||||||
type WeightInfo: pallet_bridge_messages::WeightInfoExt;
|
type WeightInfo: pallet_bridge_messages::WeightInfoExt;
|
||||||
}
|
}
|
||||||
@@ -127,7 +126,7 @@ pub trait ChainWithMessages: Chain {
|
|||||||
/// Call type used by the chain.
|
/// Call type used by the chain.
|
||||||
pub type CallOf<C> = <C as Chain>::Call;
|
pub type CallOf<C> = <C as Chain>::Call;
|
||||||
/// Weight-to-Fee type used by the chain.
|
/// 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.
|
/// Transaction status of the chain.
|
||||||
pub type TransactionStatusOf<C> = TransactionStatus<HashOf<C>, HashOf<C>>;
|
pub type TransactionStatusOf<C> = TransactionStatus<HashOf<C>, HashOf<C>>;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#![cfg(any(feature = "test-helpers", test))]
|
#![cfg(any(feature = "test-helpers", test))]
|
||||||
|
|
||||||
use crate::{Chain, ChainWithBalances};
|
use crate::{Chain, ChainWithBalances};
|
||||||
use frame_support::weights::{IdentityFee, Weight};
|
use frame_support::weights::Weight;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
/// Chain that may be used in tests.
|
/// Chain that may be used in tests.
|
||||||
@@ -60,7 +60,6 @@ impl Chain for TestChain {
|
|||||||
sp_runtime::generic::Block<Self::Header, sp_runtime::OpaqueExtrinsic>,
|
sp_runtime::generic::Block<Self::Header, sp_runtime::OpaqueExtrinsic>,
|
||||||
>;
|
>;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type WeightToFee = IdentityFee<u32>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithBalances for TestChain {
|
impl ChainWithBalances for TestChain {
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ impl Chain for Westend {
|
|||||||
|
|
||||||
type SignedBlock = bp_westend::SignedBlock;
|
type SignedBlock = bp_westend::SignedBlock;
|
||||||
type Call = bp_westend::Call;
|
type Call = bp_westend::Call;
|
||||||
type WeightToFee = bp_westend::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RelayChain for Westend {
|
impl RelayChain for Westend {
|
||||||
@@ -119,5 +118,4 @@ impl Chain for Westmint {
|
|||||||
|
|
||||||
type SignedBlock = bp_westend::SignedBlock;
|
type SignedBlock = bp_westend::SignedBlock;
|
||||||
type Call = bp_westend::Call;
|
type Call = bp_westend::Call;
|
||||||
type WeightToFee = bp_westend::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ impl Chain for Wococo {
|
|||||||
|
|
||||||
type SignedBlock = bp_wococo::SignedBlock;
|
type SignedBlock = bp_wococo::SignedBlock;
|
||||||
type Call = ();
|
type Call = ();
|
||||||
type WeightToFee = bp_wococo::WeightToFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChainWithGrandpa for Wococo {
|
impl ChainWithGrandpa for Wococo {
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ where
|
|||||||
/// **WARNING**: this functions will only be accurate if weight-to-fee conversion function
|
/// **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.
|
/// is linear. For non-linear polynomials the error will grow with `weight_difference` growth.
|
||||||
/// So better to use smaller differences.
|
/// 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_adjusted_weight_fee: BalanceOf<C>,
|
||||||
smaller_tx_weight: Weight,
|
smaller_tx_weight: Weight,
|
||||||
larger_adjusted_weight_fee: BalanceOf<C>,
|
larger_adjusted_weight_fee: BalanceOf<C>,
|
||||||
@@ -563,17 +563,17 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn compute_fee_multiplier_returns_sane_results() {
|
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_weight = 1_000_000;
|
||||||
let smaller_adjusted_weight_fee =
|
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_weight = smaller_weight + 200_000;
|
||||||
let larger_adjusted_weight_fee =
|
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!(
|
assert_eq!(
|
||||||
compute_fee_multiplier::<Rococo>(
|
compute_fee_multiplier::<Rialto>(
|
||||||
smaller_adjusted_weight_fee,
|
smaller_adjusted_weight_fee,
|
||||||
smaller_weight,
|
smaller_weight,
|
||||||
larger_adjusted_weight_fee,
|
larger_adjusted_weight_fee,
|
||||||
|
|||||||
Reference in New Issue
Block a user