1
// Copyright 2025 Moonbeam foundation
2
// This file is part of Moonbeam.
3

            
4
// Moonbeam 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
// Moonbeam 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 Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
//! # Betanet bridge primitives
18

            
19
use bp_bridge_hub_cumulus::{
20
	BlockLength, BlockWeights, Hasher, Nonce, MAX_BRIDGE_HUB_HEADER_SIZE,
21
	MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
22
};
23
use bp_messages::{ChainWithMessages, MessageNonce, Weight};
24
use bp_runtime::{Chain, ChainId, Parachain};
25
use frame_support::dispatch::DispatchClass;
26
pub use moonbeam_core_primitives::{AccountId, Balance, BlockNumber, Hash, Header, Signature};
27
use sp_runtime::StateVersion;
28

            
29
pub const PARACHAIN_ID: u32 = 888;
30
/// Name of the messages pallet instance that is deployed at bridged chains.
31
pub const WITH_BRIDGE_MESSAGES_PALLET_NAME: &str = "BridgeMessages";
32

            
33
/// Betanet parachain.
34
pub struct Betanet;
35

            
36
impl Chain for Betanet {
37
	const ID: ChainId = *b"mnbb";
38

            
39
	type BlockNumber = BlockNumber;
40
	type Hash = Hash;
41
	type Hasher = Hasher;
42
	type Header = Header;
43

            
44
	type AccountId = AccountId;
45
	type Balance = Balance;
46
	type Nonce = Nonce;
47
	type Signature = Signature;
48

            
49
	const STATE_VERSION: StateVersion = StateVersion::V1;
50

            
51
	fn max_extrinsic_size() -> u32 {
52
		*BlockLength::get().max.get(DispatchClass::Normal)
53
	}
54

            
55
	fn max_extrinsic_weight() -> Weight {
56
		BlockWeights::get()
57
			.get(DispatchClass::Normal)
58
			.max_extrinsic
59
			.unwrap_or(Weight::MAX)
60
	}
61
}
62

            
63
impl Parachain for Betanet {
64
	const PARACHAIN_ID: u32 = PARACHAIN_ID;
65
	const MAX_HEADER_SIZE: u32 = MAX_BRIDGE_HUB_HEADER_SIZE;
66
}
67

            
68
impl ChainWithMessages for Betanet {
69
	const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = WITH_BRIDGE_MESSAGES_PALLET_NAME;
70

            
71
	const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce =
72
		MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
73
	const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce =
74
		MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
75
}