Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 0c6370e

Browse files
authored
remove unnecessary consts (#1586)
1 parent e0feb85 commit 0c6370e

File tree

28 files changed

+29
-316
lines changed

28 files changed

+29
-316
lines changed

Cargo.lock

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

primitives/chain-kusama/Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,17 @@ smallvec = "1.7"
1111

1212
# Bridge Dependencies
1313

14-
bp-messages = { path = "../messages", default-features = false }
1514
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
1615
bp-runtime = { path = "../runtime", default-features = false }
1716

1817
# Substrate Based Dependencies
1918

20-
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2119
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
22-
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
23-
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
24-
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2520

2621
[features]
2722
default = ["std"]
2823
std = [
29-
"bp-messages/std",
3024
"bp-polkadot-core/std",
3125
"bp-runtime/std",
32-
"frame-support/std",
3326
"sp-api/std",
34-
"sp-runtime/std",
35-
"sp-std/std",
36-
"sp-version/std",
3727
]

primitives/chain-kusama/src/lib.rs

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,12 @@
1818
// RuntimeApi generated functions
1919
#![allow(clippy::too_many_arguments)]
2020

21-
use bp_messages::{
22-
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
23-
};
24-
use frame_support::weights::{
25-
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
26-
};
27-
use sp_runtime::FixedU128;
28-
use sp_std::prelude::*;
29-
use sp_version::RuntimeVersion;
30-
3121
pub use bp_polkadot_core::*;
32-
use bp_runtime::decl_bridge_runtime_apis;
22+
use bp_runtime::decl_bridge_finality_runtime_apis;
3323

3424
/// Kusama Chain
3525
pub type Kusama = PolkadotLike;
3626

37-
// NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo.
38-
pub const VERSION: RuntimeVersion = RuntimeVersion {
39-
spec_name: sp_version::create_runtime_str!("kusama"),
40-
impl_name: sp_version::create_runtime_str!("parity-kusama"),
41-
authoring_version: 2,
42-
spec_version: 9180,
43-
impl_version: 0,
44-
apis: sp_version::create_apis_vec![[]],
45-
transaction_version: 11,
46-
state_version: 0,
47-
};
48-
49-
// NOTE: This needs to be kept up to date with the Kusama runtime found in the Polkadot repo.
50-
pub struct WeightToFee;
51-
impl WeightToFeePolynomial for WeightToFee {
52-
type Balance = Balance;
53-
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
54-
const CENTS: Balance = 1_000_000_000_000 / 30_000;
55-
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
56-
let p = CENTS;
57-
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
58-
smallvec::smallvec![WeightToFeeCoefficient {
59-
degree: 1,
60-
negative: false,
61-
coeff_frac: Perbill::from_rational(p % q, q),
62-
coeff_integer: p / q,
63-
}]
64-
}
65-
}
66-
67-
/// Per-byte fee for Kusama transactions.
68-
pub const TRANSACTION_BYTE_FEE: Balance = 10 * 1_000_000_000_000 / 30_000 / 1_000;
69-
70-
/// Existential deposit on Kusama.
71-
pub const EXISTENTIAL_DEPOSIT: Balance = 1_000_000_000_000 / 30_000;
72-
7327
/// The target length of a session (how often authorities change) on Kusama measured in of number of
7428
/// blocks.
7529
///
@@ -79,16 +33,5 @@ pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
7933

8034
/// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains.
8135
pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa";
82-
/// Name of the With-Kusama messages pallet instance that is deployed at bridged chains.
83-
pub const WITH_KUSAMA_MESSAGES_PALLET_NAME: &str = "BridgeKusamaMessages";
84-
85-
/// Name of the transaction payment pallet at the Kusama runtime.
86-
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
87-
88-
/// Name of the DOT->KSM conversion rate stored in the Kusama runtime.
89-
pub const POLKADOT_TO_KUSAMA_CONVERSION_RATE_PARAMETER_NAME: &str =
90-
"PolkadotToKusamaConversionRate";
91-
/// Name of the Polkadot fee multiplier parameter, stored in the Polkadot runtime.
92-
pub const POLKADOT_FEE_MULTIPLIER_PARAMETER_NAME: &str = "PolkadotFeeMultiplier";
9336

94-
decl_bridge_runtime_apis!(kusama);
37+
decl_bridge_finality_runtime_apis!(kusama);

primitives/chain-polkadot/Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,17 @@ smallvec = "1.7"
1111

1212
# Bridge Dependencies
1313

14-
bp-messages = { path = "../messages", default-features = false }
1514
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
1615
bp-runtime = { path = "../runtime", default-features = false }
1716

1817
# Substrate Based Dependencies
1918

20-
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2119
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
22-
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
23-
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
24-
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2520

2621
[features]
2722
default = ["std"]
2823
std = [
29-
"bp-messages/std",
3024
"bp-polkadot-core/std",
3125
"bp-runtime/std",
32-
"frame-support/std",
3326
"sp-api/std",
34-
"sp-runtime/std",
35-
"sp-std/std",
36-
"sp-version/std",
3727
]

primitives/chain-polkadot/src/lib.rs

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,12 @@
1818
// RuntimeApi generated functions
1919
#![allow(clippy::too_many_arguments)]
2020

21-
use bp_messages::{
22-
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
23-
};
24-
use frame_support::weights::{
25-
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
26-
};
27-
use sp_runtime::FixedU128;
28-
use sp_std::prelude::*;
29-
use sp_version::RuntimeVersion;
30-
3121
pub use bp_polkadot_core::*;
32-
use bp_runtime::decl_bridge_runtime_apis;
22+
use bp_runtime::decl_bridge_finality_runtime_apis;
3323

3424
/// Polkadot Chain
3525
pub type Polkadot = PolkadotLike;
3626

37-
// NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo.
38-
pub const VERSION: RuntimeVersion = RuntimeVersion {
39-
spec_name: sp_version::create_runtime_str!("polkadot"),
40-
impl_name: sp_version::create_runtime_str!("parity-polkadot"),
41-
authoring_version: 0,
42-
spec_version: 9180,
43-
impl_version: 0,
44-
apis: sp_version::create_apis_vec![[]],
45-
transaction_version: 12,
46-
state_version: 0,
47-
};
48-
49-
// NOTE: This needs to be kept up to date with the Polkadot runtime found in the Polkadot repo.
50-
pub struct WeightToFee;
51-
impl WeightToFeePolynomial for WeightToFee {
52-
type Balance = Balance;
53-
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
54-
const CENTS: Balance = 10_000_000_000 / 100;
55-
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
56-
let p = CENTS;
57-
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
58-
smallvec::smallvec![WeightToFeeCoefficient {
59-
degree: 1,
60-
negative: false,
61-
coeff_frac: Perbill::from_rational(p % q, q),
62-
coeff_integer: p / q,
63-
}]
64-
}
65-
}
66-
67-
/// Per-byte fee for Polkadot transactions.
68-
pub const TRANSACTION_BYTE_FEE: Balance = 10 * 10_000_000_000 / 100 / 1_000;
69-
70-
/// Existential deposit on Polkadot.
71-
pub const EXISTENTIAL_DEPOSIT: Balance = 10_000_000_000;
72-
7327
/// The target length of a session (how often authorities change) on Polkadot measured in of number
7428
/// of blocks.
7529
///
@@ -79,16 +33,5 @@ pub const SESSION_LENGTH: BlockNumber = 4 * time_units::HOURS;
7933

8034
/// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains.
8135
pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa";
82-
/// Name of the With-Polkadot messages pallet instance that is deployed at bridged chains.
83-
pub const WITH_POLKADOT_MESSAGES_PALLET_NAME: &str = "BridgePolkadotMessages";
84-
85-
/// Name of the transaction payment pallet at the Polkadot runtime.
86-
pub const TRANSACTION_PAYMENT_PALLET_NAME: &str = "TransactionPayment";
87-
88-
/// Name of the KSM->DOT conversion rate parameter, stored in the Polkadot runtime.
89-
pub const KUSAMA_TO_POLKADOT_CONVERSION_RATE_PARAMETER_NAME: &str =
90-
"KusamaToPolkadotConversionRate";
91-
/// Name of the Kusama fee multiplier parameter, stored in the Polkadot runtime.
92-
pub const KUSAMA_FEE_MULTIPLIER_PARAMETER_NAME: &str = "KusamaFeeMultiplier";
9336

94-
decl_bridge_runtime_apis!(polkadot);
37+
decl_bridge_finality_runtime_apis!(polkadot);

primitives/chain-rococo/Cargo.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,19 @@ edition = "2021"
77
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
88

99
[dependencies]
10-
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
1110
smallvec = "1.7"
1211

1312
# Bridge Dependencies
14-
bp-messages = { path = "../messages", default-features = false }
1513
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
1614
bp-runtime = { path = "../runtime", default-features = false }
1715

1816
# Substrate Based Dependencies
19-
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2017
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
21-
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
22-
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
23-
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2418

2519
[features]
2620
default = ["std"]
2721
std = [
28-
"bp-messages/std",
2922
"bp-polkadot-core/std",
3023
"bp-runtime/std",
31-
"frame-support/std",
32-
"codec/std",
3324
"sp-api/std",
34-
"sp-runtime/std",
35-
"sp-std/std",
36-
"sp-version/std",
3725
]

primitives/chain-rococo/src/lib.rs

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,8 @@
1818
// RuntimeApi generated functions
1919
#![allow(clippy::too_many_arguments)]
2020

21-
use bp_messages::{
22-
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
23-
};
24-
use frame_support::weights::{
25-
Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
26-
};
27-
use sp_runtime::FixedU128;
28-
use sp_std::prelude::*;
29-
use sp_version::RuntimeVersion;
30-
3121
pub use bp_polkadot_core::*;
32-
use bp_runtime::decl_bridge_runtime_apis;
22+
use bp_runtime::decl_bridge_finality_runtime_apis;
3323

3424
/// Rococo Chain
3525
pub type Rococo = PolkadotLike;
@@ -41,50 +31,7 @@ pub type Rococo = PolkadotLike;
4131
/// conditions.
4232
pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
4333

44-
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
45-
pub const VERSION: RuntimeVersion = RuntimeVersion {
46-
spec_name: sp_version::create_runtime_str!("rococo"),
47-
impl_name: sp_version::create_runtime_str!("parity-rococo-v2.0"),
48-
authoring_version: 0,
49-
spec_version: 9200,
50-
impl_version: 0,
51-
apis: sp_version::create_apis_vec![[]],
52-
transaction_version: 0,
53-
state_version: 0,
54-
};
55-
56-
// NOTE: This needs to be kept up to date with the Rococo runtime found in the Polkadot repo.
57-
pub struct WeightToFee;
58-
impl WeightToFeePolynomial for WeightToFee {
59-
type Balance = Balance;
60-
fn polynomial() -> WeightToFeeCoefficients<Balance> {
61-
const CENTS: Balance = 1_000_000_000_000 / 100;
62-
let p = CENTS;
63-
let q = 10 * Balance::from(ExtrinsicBaseWeight::get());
64-
smallvec::smallvec![WeightToFeeCoefficient {
65-
degree: 1,
66-
negative: false,
67-
coeff_frac: Perbill::from_rational(p % q, q),
68-
coeff_integer: p / q,
69-
}]
70-
}
71-
}
72-
7334
/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
7435
pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
75-
/// Name of the With-Rococo messages pallet instance that is deployed at bridged chains.
76-
pub const WITH_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessages";
77-
78-
/// Existential deposit on Rococo.
79-
pub const EXISTENTIAL_DEPOSIT: Balance = 1_000_000_000_000 / 100;
80-
81-
/// Weight of pay-dispatch-fee operation for inbound messages at Rococo chain.
82-
///
83-
/// This value corresponds to the result of
84-
/// `pallet_bridge_messages::WeightInfoExt::pay_inbound_dispatch_fee_overhead()` call for your
85-
/// chain. Don't put too much reserve there, because it is used to **decrease**
86-
/// `DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT` cost. So putting large reserve would make delivery
87-
/// transactions cheaper.
88-
pub const PAY_INBOUND_DISPATCH_FEE_WEIGHT: Weight = 600_000_000;
8936

90-
decl_bridge_runtime_apis!(rococo);
37+
decl_bridge_finality_runtime_apis!(rococo);

0 commit comments

Comments
 (0)