diff --git a/Cargo.lock b/Cargo.lock index 0e30479db79e..322879c38b1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -859,6 +859,7 @@ version = "0.1.0" dependencies = [ "bp-polkadot-core", "bp-runtime", + "frame-support", "sp-api", ] @@ -914,6 +915,7 @@ name = "bp-wococo" version = "0.1.0" dependencies = [ "bp-polkadot-core", + "bp-rococo", "bp-runtime", "sp-api", ] @@ -8273,7 +8275,6 @@ dependencies = [ "sp-core", "sp-finality-grandpa", "sp-runtime", - "sp-version", ] [[package]] @@ -8289,7 +8290,6 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-version", ] [[package]] @@ -11311,6 +11311,7 @@ dependencies = [ "async-trait", "bp-bridge-hub-rococo", "bp-bridge-hub-wococo", + "bp-header-chain", "bp-messages", "bp-millau", "bp-polkadot-core", diff --git a/primitives/chain-rococo/Cargo.toml b/primitives/chain-rococo/Cargo.toml index 65d3f502db44..73a2450cd17d 100644 --- a/primitives/chain-rococo/Cargo.toml +++ b/primitives/chain-rococo/Cargo.toml @@ -14,6 +14,7 @@ bp-runtime = { path = "../runtime", default-features = false } # Substrate Based Dependencies sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } [features] default = ["std"] @@ -21,4 +22,5 @@ std = [ "bp-polkadot-core/std", "bp-runtime/std", "sp-api/std", + "frame-support/std", ] diff --git a/primitives/chain-rococo/src/lib.rs b/primitives/chain-rococo/src/lib.rs index 39188066dca4..3738a3ba2694 100644 --- a/primitives/chain-rococo/src/lib.rs +++ b/primitives/chain-rococo/src/lib.rs @@ -20,16 +20,24 @@ pub use bp_polkadot_core::*; use bp_runtime::decl_bridge_finality_runtime_apis; +use frame_support::parameter_types; /// Rococo Chain pub type Rococo = PolkadotLike; +parameter_types! { + pub const SS58Prefix: u8 = 42; +} + /// The target length of a session (how often authorities change) on Rococo measured in of number /// of blocks. /// /// Note that since this is a target sessions may change before/after this time depending on network /// conditions. -pub const SESSION_LENGTH: BlockNumber = time_units::HOURS; +pub const SESSION_LENGTH: BlockNumber = HOURS; + +/// Name of the parachains pallet in the Rococo runtime. +pub const PARAS_PALLET_NAME: &str = "Paras"; /// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains. pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa"; diff --git a/primitives/chain-wococo/Cargo.toml b/primitives/chain-wococo/Cargo.toml index 5a4c439e042a..6b741cd4b73c 100644 --- a/primitives/chain-wococo/Cargo.toml +++ b/primitives/chain-wococo/Cargo.toml @@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" # Bridge Dependencies bp-polkadot-core = { path = "../polkadot-core", default-features = false } bp-runtime = { path = "../runtime", default-features = false } +bp-rococo = { path = "../chain-rococo", default-features = false } # Substrate Based Dependencies sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -20,5 +21,6 @@ default = ["std"] std = [ "bp-polkadot-core/std", "bp-runtime/std", + "bp-rococo/std", "sp-api/std", ] diff --git a/primitives/chain-wococo/src/lib.rs b/primitives/chain-wococo/src/lib.rs index 2a417479d3b2..4a39d732cd55 100644 --- a/primitives/chain-wococo/src/lib.rs +++ b/primitives/chain-wococo/src/lib.rs @@ -19,6 +19,7 @@ #![allow(clippy::too_many_arguments)] pub use bp_polkadot_core::*; +pub use bp_rococo::{SS58Prefix, PARAS_PALLET_NAME}; use bp_runtime::decl_bridge_finality_runtime_apis; /// Wococo Chain @@ -29,7 +30,7 @@ pub type Wococo = PolkadotLike; /// /// Note that since this is a target sessions may change before/after this time depending on network /// conditions. -pub const SESSION_LENGTH: BlockNumber = time_units::MINUTES; +pub const SESSION_LENGTH: BlockNumber = MINUTES; /// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains. pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa"; diff --git a/relays/bin-substrate/Cargo.toml b/relays/bin-substrate/Cargo.toml index 78933208231f..38d3a7ad3fbc 100644 --- a/relays/bin-substrate/Cargo.toml +++ b/relays/bin-substrate/Cargo.toml @@ -22,6 +22,7 @@ strum = { version = "0.21.0", features = ["derive"] } bp-bridge-hub-rococo = { path = "../../primitives/chain-bridge-hub-rococo" } bp-bridge-hub-wococo = { path = "../../primitives/chain-bridge-hub-wococo" } +bp-header-chain = { path = "../../primitives/header-chain" } bp-messages = { path = "../../primitives/messages" } bp-millau = { path = "../../primitives/chain-millau" } bp-polkadot-core = { path = "../../primitives/polkadot-core" } diff --git a/relays/bin-substrate/src/chains/rococo.rs b/relays/bin-substrate/src/chains/rococo.rs index 62819b7646e6..b5d77c1e9aea 100644 --- a/relays/bin-substrate/src/chains/rococo.rs +++ b/relays/bin-substrate/src/chains/rococo.rs @@ -22,8 +22,7 @@ use relay_rococo_client::Rococo; use sp_version::RuntimeVersion; impl CliChain for Rococo { - // TODO: maybe not needed? - const RUNTIME_VERSION: RuntimeVersion = bp_rococo::VERSION; + const RUNTIME_VERSION: Option = None; type KeyPair = sp_core::sr25519::Pair; type MessagePayload = Vec; @@ -34,7 +33,7 @@ impl CliChain for Rococo { } impl CliChain for BridgeHubRococo { - const RUNTIME_VERSION: RuntimeVersion = relay_bridge_hub_rococo_client::runtime::VERSION; + const RUNTIME_VERSION: Option = None; type KeyPair = sp_core::sr25519::Pair; type MessagePayload = Vec; diff --git a/relays/bin-substrate/src/chains/wococo.rs b/relays/bin-substrate/src/chains/wococo.rs index e9c198fb254f..f0f37c37a6c8 100644 --- a/relays/bin-substrate/src/chains/wococo.rs +++ b/relays/bin-substrate/src/chains/wococo.rs @@ -22,7 +22,7 @@ use relay_wococo_client::Wococo; use sp_version::RuntimeVersion; impl CliChain for Wococo { - const RUNTIME_VERSION: RuntimeVersion = bp_wococo::VERSION; + const RUNTIME_VERSION: Option = None; type KeyPair = sp_core::sr25519::Pair; type MessagePayload = Vec; @@ -33,7 +33,7 @@ impl CliChain for Wococo { } impl CliChain for BridgeHubWococo { - const RUNTIME_VERSION: RuntimeVersion = relay_bridge_hub_wococo_client::runtime::VERSION; + const RUNTIME_VERSION: Option = None; type KeyPair = sp_core::sr25519::Pair; type MessagePayload = Vec; diff --git a/relays/client-bridge-hub-rococo/Cargo.toml b/relays/client-bridge-hub-rococo/Cargo.toml index 642b512d7885..7210f784ef94 100644 --- a/relays/client-bridge-hub-rococo/Cargo.toml +++ b/relays/client-bridge-hub-rococo/Cargo.toml @@ -25,7 +25,6 @@ bp-runtime = { path = "../../primitives/runtime" } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" } [dev-dependencies] sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/relays/client-bridge-hub-rococo/src/lib.rs b/relays/client-bridge-hub-rococo/src/lib.rs index c90e56d3aa12..ebee77147351 100644 --- a/relays/client-bridge-hub-rococo/src/lib.rs +++ b/relays/client-bridge-hub-rococo/src/lib.rs @@ -74,7 +74,6 @@ impl Chain for BridgeHubRococo { type SignedBlock = bp_bridge_hub_rococo::SignedBlock; type Call = runtime::Call; - type WeightToFee = bp_bridge_hub_rococo::WeightToFee; } impl TransactionSignScheme for BridgeHubRococo { diff --git a/relays/client-bridge-hub-rococo/src/runtime_wrapper.rs b/relays/client-bridge-hub-rococo/src/runtime_wrapper.rs index 6f2123432e53..6153b9b61ca7 100644 --- a/relays/client-bridge-hub-rococo/src/runtime_wrapper.rs +++ b/relays/client-bridge-hub-rococo/src/runtime_wrapper.rs @@ -21,28 +21,11 @@ use bp_polkadot_core::PolkadotLike; use codec::{Decode, Encode}; use scale_info::TypeInfo; -use sp_runtime::create_runtime_str; -use sp_version::RuntimeVersion; pub use bp_bridge_hub_rococo::SS58Prefix; use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId}; use bp_runtime::Chain; -// TODO: we meed to keep this up-to-date with -// [github.com/paritytech/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/lib.rs::VERSION] -/// This runtime version. -pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("bridge-hub-rococo"), - impl_name: create_runtime_str!("bridge-hub-rococo"), - authoring_version: 1, - spec_version: 1, - impl_version: 0, - // TODO:check-parameter - apis: /*RUNTIME_API_VERSIONS*/ sp_version::create_apis_vec![[]], - transaction_version: 1, - state_version: 1, -}; - // TODO:check-parameter - check SignedExtension /// Unchecked BridgeHubRococo extrinsic. pub type UncheckedExtrinsic = bp_bridge_hub_rococo::UncheckedExtrinsic; diff --git a/relays/client-bridge-hub-wococo/Cargo.toml b/relays/client-bridge-hub-wococo/Cargo.toml index fa989ea90591..6971ecf951da 100644 --- a/relays/client-bridge-hub-wococo/Cargo.toml +++ b/relays/client-bridge-hub-wococo/Cargo.toml @@ -21,4 +21,3 @@ relay-bridge-hub-rococo-client = { path = "../client-bridge-hub-rococo" } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/relays/client-bridge-hub-wococo/src/lib.rs b/relays/client-bridge-hub-wococo/src/lib.rs index e6d90f93a36d..d3d4cb88b55a 100644 --- a/relays/client-bridge-hub-wococo/src/lib.rs +++ b/relays/client-bridge-hub-wococo/src/lib.rs @@ -74,7 +74,6 @@ impl Chain for BridgeHubWococo { type SignedBlock = bp_bridge_hub_wococo::SignedBlock; type Call = runtime::Call; - type WeightToFee = bp_bridge_hub_wococo::WeightToFee; } impl TransactionSignScheme for BridgeHubWococo { diff --git a/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs b/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs index 85201c90db24..153ac03a25f3 100644 --- a/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs +++ b/relays/client-bridge-hub-wococo/src/runtime_wrapper.rs @@ -14,14 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -// TODO: join with primitives do we need this here or move to the primitives? +// TODO:check-parameter - join with primitives do we need this here or move to the primitives? //! Types that are specific to the BridgeHubWococo runtime. pub use bp_bridge_hub_wococo::SS58Prefix; // We reuse everything from rococo runtime wrapper -pub const VERSION: sp_version::RuntimeVersion = relay_bridge_hub_rococo_client::runtime::VERSION; pub type Call = relay_bridge_hub_rococo_client::runtime::Call; pub type UncheckedExtrinsic = bp_bridge_hub_wococo::UncheckedExtrinsic; pub type BridgeGrandpaRococoCall = relay_bridge_hub_rococo_client::runtime::BridgeGrandpaRococoCall;