Skip to content

Commit 267babc

Browse files
authored
Statemine primitives (paritytech#1625)
* Statemine primitives * ref issue in TODO * fix TODO
1 parent 2439a22 commit 267babc

File tree

22 files changed

+331
-81
lines changed

22 files changed

+331
-81
lines changed

Cargo.lock

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

primitives/chain-kusama/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ use bp_runtime::decl_bridge_finality_runtime_apis;
2424
/// Kusama Chain
2525
pub type Kusama = PolkadotLike;
2626

27-
/// The target length of a session (how often authorities change) on Kusama measured in of number of
28-
/// blocks.
29-
///
30-
/// Note that since this is a target sessions may change before/after this time depending on network
31-
/// conditions.
32-
pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
33-
3427
/// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains.
3528
pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa";
3629

primitives/chain-polkadot/Cargo.toml

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

99
[dependencies]
10-
smallvec = "1.7"
11-
1210
# Bridge Dependencies
1311

1412
bp-polkadot-core = { path = "../polkadot-core", default-features = false }

primitives/chain-polkadot/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ use bp_runtime::decl_bridge_finality_runtime_apis;
2424
/// Polkadot Chain
2525
pub type Polkadot = PolkadotLike;
2626

27-
/// The target length of a session (how often authorities change) on Polkadot measured in of number
28-
/// of blocks.
29-
///
30-
/// Note that since this is a target sessions may change before/after this time depending on network
31-
/// conditions.
32-
pub const SESSION_LENGTH: BlockNumber = 4 * time_units::HOURS;
33-
3427
/// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains.
3528
pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa";
3629

primitives/chain-rococo/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ use bp_runtime::decl_bridge_finality_runtime_apis;
2424
/// Rococo Chain
2525
pub type Rococo = PolkadotLike;
2626

27-
/// The target length of a session (how often authorities change) on Rococo measured in of number
28-
/// of blocks.
29-
///
30-
/// Note that since this is a target sessions may change before/after this time depending on network
31-
/// conditions.
32-
pub const SESSION_LENGTH: BlockNumber = time_units::HOURS;
33-
3427
/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
3528
pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
3629

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "bp-statemine"
3+
description = "Primitives of Statemine runtime."
4+
version = "0.1.0"
5+
authors = ["Parity Technologies <admin@parity.io>"]
6+
edition = "2021"
7+
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
8+
9+
[dependencies]
10+
11+
# Bridge Dependencies
12+
13+
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
14+
15+
# Substrate Based Dependencies
16+
17+
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
18+
19+
[features]
20+
default = ["std"]
21+
std = [
22+
"bp-polkadot-core/std",
23+
"sp-version/std",
24+
]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
2+
// This file is part of Parity Bridges Common.
3+
4+
// Parity Bridges Common is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Parity Bridges Common is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
16+
17+
#![cfg_attr(not(feature = "std"), no_std)]
18+
// RuntimeApi generated functions
19+
#![allow(clippy::too_many_arguments)]
20+
21+
pub use bp_polkadot_core::*;
22+
23+
use sp_version::RuntimeVersion;
24+
25+
/// Statemine Chain.
26+
pub type Statemine = PolkadotLike;
27+
28+
/// Known Statemine runtime version.
29+
pub const VERSION: RuntimeVersion = RuntimeVersion {
30+
spec_name: sp_version::create_runtime_str!("statemine"),
31+
impl_name: sp_version::create_runtime_str!("statemine"),
32+
authoring_version: 1,
33+
spec_version: 9300,
34+
impl_version: 0,
35+
apis: sp_version::create_apis_vec![[]],
36+
transaction_version: 8,
37+
state_version: 1,
38+
};

primitives/chain-westend/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ 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"] }
11-
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
1210

1311
# Bridge Dependencies
1412

@@ -18,15 +16,11 @@ bp-runtime = { path = "../runtime", default-features = false }
1816
# Substrate Based Dependencies
1917

2018
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 }
2219

2320
[features]
2421
default = ["std"]
2522
std = [
2623
"bp-polkadot-core/std",
2724
"bp-runtime/std",
28-
"codec/std",
29-
"scale-info/std",
3025
"sp-api/std",
31-
"sp-runtime/std",
3226
]

primitives/chain-westend/src/lib.rs

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

21-
use scale_info::TypeInfo;
22-
2321
pub use bp_polkadot_core::*;
2422
use bp_runtime::decl_bridge_finality_runtime_apis;
2523

2624
/// Westend Chain
2725
pub type Westend = PolkadotLike;
2826

29-
/// Westend Runtime `Call` enum.
30-
///
31-
/// We are not currently submitting any Westend transactions => it is empty.
32-
#[derive(codec::Encode, codec::Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
33-
pub enum Call {}
34-
35-
impl sp_runtime::traits::Dispatchable for Call {
36-
type RuntimeOrigin = ();
37-
type Config = ();
38-
type Info = ();
39-
type PostInfo = ();
40-
41-
fn dispatch(
42-
self,
43-
_origin: Self::RuntimeOrigin,
44-
) -> sp_runtime::DispatchResultWithInfo<Self::PostInfo> {
45-
unimplemented!("The Call is not expected to be dispatched.")
46-
}
47-
}
48-
4927
/// Name of the parachains pallet at the Westend runtime.
5028
pub const PARAS_PALLET_NAME: &str = "Paras";
5129

@@ -54,13 +32,6 @@ pub const WITH_WESTEND_GRANDPA_PALLET_NAME: &str = "BridgeWestendGrandpa";
5432
/// Name of the With-Westend parachains bridge pallet instance that is deployed at bridged chains.
5533
pub const WITH_WESTEND_BRIDGE_PARAS_PALLET_NAME: &str = "BridgeWestendParachains";
5634

57-
/// The target length of a session (how often authorities change) on Westend measured in of number
58-
/// of blocks.
59-
///
60-
/// Note that since this is a target sessions may change before/after this time depending on network
61-
/// conditions.
62-
pub const SESSION_LENGTH: BlockNumber = 10 * time_units::MINUTES;
63-
6435
/// Maximal number of GRANDPA authorities at Westend.
6536
///
6637
/// Corresponds to the `MaxAuthorities` constant value from the Westend runtime configuration.

primitives/chain-wococo/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ use bp_runtime::decl_bridge_finality_runtime_apis;
2424
/// Wococo Chain
2525
pub type Wococo = PolkadotLike;
2626

27-
/// The target length of a session (how often authorities change) on Wococo measured in of number
28-
/// of blocks.
29-
///
30-
/// Note that since this is a target sessions may change before/after this time depending on network
31-
/// conditions.
32-
pub const SESSION_LENGTH: BlockNumber = time_units::MINUTES;
33-
3427
/// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains.
3528
pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa";
3629

0 commit comments

Comments
 (0)