bp_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#![cfg_attr(not(feature = "std"), no_std)]
18// RuntimeApi generated functions
19#![allow(clippy::too_many_arguments)]
20
21pub use bp_polkadot_core::*;
22pub use bp_rococo::{
23	SS58Prefix, MAX_AUTHORITIES_COUNT, MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE, PARAS_PALLET_NAME,
24};
25
26use bp_header_chain::ChainWithGrandpa;
27use bp_runtime::{decl_bridge_finality_runtime_apis, Chain};
28use frame_support::weights::Weight;
29
30/// Wococo Chain
31pub struct Wococo;
32
33impl Chain for Wococo {
34	type BlockNumber = <PolkadotLike as Chain>::BlockNumber;
35	type Hash = <PolkadotLike as Chain>::Hash;
36	type Hasher = <PolkadotLike as Chain>::Hasher;
37	type Header = <PolkadotLike as Chain>::Header;
38
39	type AccountId = <PolkadotLike as Chain>::AccountId;
40	type Balance = <PolkadotLike as Chain>::Balance;
41	type Nonce = <PolkadotLike as Chain>::Nonce;
42	type Signature = <PolkadotLike as Chain>::Signature;
43
44	fn max_extrinsic_size() -> u32 {
45		PolkadotLike::max_extrinsic_size()
46	}
47
48	fn max_extrinsic_weight() -> Weight {
49		PolkadotLike::max_extrinsic_weight()
50	}
51}
52
53impl ChainWithGrandpa for Wococo {
54	const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_WOCOCO_GRANDPA_PALLET_NAME;
55	const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
56	const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
57		REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
58	const MAX_HEADER_SIZE: u32 = MAX_HEADER_SIZE;
59	const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = AVERAGE_HEADER_SIZE_IN_JUSTIFICATION;
60}
61
62// The SignedExtension used by Wococo.
63pub use bp_rococo::CommonSignedExtension as SignedExtension;
64
65/// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains.
66pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa";
67
68decl_bridge_finality_runtime_apis!(wococo, grandpa);