bp_bridge_hub_wococo/
lib.rs

1// Copyright (C) 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//! Module with configuration which reflects BridgeHubWococo runtime setup
18//! (AccountId, Headers, Hashes...)
19
20#![cfg_attr(not(feature = "std"), no_std)]
21
22pub use bp_bridge_hub_cumulus::*;
23use bp_messages::*;
24use bp_runtime::{
25	decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, Chain, Parachain,
26};
27use frame_support::dispatch::DispatchClass;
28use sp_runtime::RuntimeDebug;
29
30/// BridgeHubWococo parachain.
31#[derive(RuntimeDebug)]
32pub struct BridgeHubWococo;
33
34impl Chain for BridgeHubWococo {
35	type BlockNumber = BlockNumber;
36	type Hash = Hash;
37	type Hasher = Hasher;
38	type Header = Header;
39
40	type AccountId = AccountId;
41	type Balance = Balance;
42	type Nonce = Nonce;
43	type Signature = Signature;
44
45	fn max_extrinsic_size() -> u32 {
46		*BlockLength::get().max.get(DispatchClass::Normal)
47	}
48
49	fn max_extrinsic_weight() -> Weight {
50		BlockWeights::get()
51			.get(DispatchClass::Normal)
52			.max_extrinsic
53			.unwrap_or(Weight::MAX)
54	}
55}
56
57impl Parachain for BridgeHubWococo {
58	const PARACHAIN_ID: u32 = BRIDGE_HUB_WOCOCO_PARACHAIN_ID;
59}
60
61/// Identifier of BridgeHubWococo in the Wococo relay chain.
62pub const BRIDGE_HUB_WOCOCO_PARACHAIN_ID: u32 = 1014;
63
64/// Name of the With-BridgeHubWococo messages pallet instance that is deployed at bridged chains.
65pub const WITH_BRIDGE_HUB_ROCOCO_TO_WOCOCO_MESSAGES_PALLET_NAME: &str =
66	"BridgeRococoToWococoMessages";
67
68/// Name of the With-BridgeHubWococo bridge-relayers pallet instance that is deployed at bridged
69/// chains.
70pub const WITH_BRIDGE_HUB_WOCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";
71
72/// Pallet index of `BridgeWococoToRococoMessages: pallet_bridge_messages::<Instance2>`.
73pub const WITH_BRIDGE_WOCOCO_TO_ROCOCO_MESSAGES_PALLET_INDEX: u8 = 45;
74
75decl_bridge_finality_runtime_apis!(bridge_hub_wococo);
76decl_bridge_messages_runtime_apis!(bridge_hub_wococo);