referrerpolicy=no-referrer-when-downgrade

bp_rococo/
lib.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Bridge-related primitives of the Rococo chain.
17
18#![warn(missing_docs)]
19#![cfg_attr(not(feature = "std"), no_std)]
20
21pub use bp_polkadot_core::*;
22
23use bp_header_chain::ChainWithGrandpa;
24use bp_runtime::{decl_bridge_finality_runtime_apis, Chain, ChainId};
25use frame_support::{sp_runtime::StateVersion, weights::Weight};
26
27/// Rococo Chain
28pub struct Rococo;
29
30impl Chain for Rococo {
31	const ID: ChainId = *b"roco";
32
33	type BlockNumber = BlockNumber;
34	type Hash = Hash;
35	type Hasher = Hasher;
36	type Header = Header;
37
38	type AccountId = AccountId;
39	type Balance = Balance;
40	type Nonce = Nonce;
41	type Signature = Signature;
42
43	const STATE_VERSION: StateVersion = StateVersion::V1;
44
45	fn max_extrinsic_size() -> u32 {
46		max_extrinsic_size()
47	}
48
49	fn max_extrinsic_weight() -> Weight {
50		max_extrinsic_weight()
51	}
52}
53
54impl ChainWithGrandpa for Rococo {
55	const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_ROCOCO_GRANDPA_PALLET_NAME;
56	const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
57	const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
58		REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
59	const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
60	const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
61}
62
63// The TransactionExtension used by Rococo.
64pub use bp_polkadot_core::CommonTransactionExtension as TransactionExtension;
65
66/// Name of the parachains pallet in the Rococo runtime.
67pub const PARAS_PALLET_NAME: &str = "Paras";
68
69/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
70pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
71/// Name of the With-Rococo parachains pallet instance that is deployed at bridged chains.
72pub const WITH_ROCOCO_BRIDGE_PARACHAINS_PALLET_NAME: &str = "BridgeRococoParachains";
73
74/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Rococo
75/// parachains.
76///
77/// It includes the block number and state root, so it shall be near 40 bytes, but let's have some
78/// reserve.
79pub const MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE: u32 = 128;
80
81decl_bridge_finality_runtime_apis!(rococo, grandpa);