emulated_integration_tests_common/
lib.rs
1pub mod impls;
17pub mod macros;
18pub mod xcm_helpers;
19
20pub use xcm_emulator;
21pub use xcm_simulator;
22
23use frame_support::parameter_types;
25use sc_consensus_grandpa::AuthorityId as GrandpaId;
26use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
27use sp_consensus_babe::AuthorityId as BabeId;
28use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
29use sp_core::storage::Storage;
30use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
31use sp_runtime::{traits::AccountIdConversion, BuildStorage};
32
33use parachains_common::BlockNumber;
35use polkadot_parachain_primitives::primitives::Sibling;
36use polkadot_runtime_parachains::configuration::HostConfiguration;
37
38use parachains_common::{AccountId, AuraId};
40use polkadot_primitives::{AssignmentId, ValidatorId};
41
42pub const XCM_V2: u32 = 2;
43pub const XCM_V3: u32 = 3;
44pub const XCM_V4: u32 = 4;
45pub const XCM_V5: u32 = 5;
46pub const REF_TIME_THRESHOLD: u64 = 33;
47pub const PROOF_SIZE_THRESHOLD: u64 = 33;
48
49pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
51
52pub const RESERVABLE_ASSET_ID: u32 = 1;
54pub const TELEPORTABLE_ASSET_ID: u32 = 2;
56
57pub const USDT_ID: u32 = 1984;
59
60pub const PENPAL_A_ID: u32 = 2000;
61pub const PENPAL_B_ID: u32 = 2001;
62pub const ASSET_HUB_ROCOCO_ID: u32 = 1000;
63pub const ASSET_HUB_WESTEND_ID: u32 = 1000;
64pub const ASSETS_PALLET_ID: u8 = 50;
65
66parameter_types! {
67 pub PenpalATeleportableAssetLocation: xcm::v5::Location
68 = xcm::v5::Location::new(1, [
69 xcm::v5::Junction::Parachain(PENPAL_A_ID),
70 xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
71 xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
72 ]
73 );
74 pub PenpalBTeleportableAssetLocation: xcm::v5::Location
75 = xcm::v5::Location::new(1, [
76 xcm::v5::Junction::Parachain(PENPAL_B_ID),
77 xcm::v5::Junction::PalletInstance(ASSETS_PALLET_ID),
78 xcm::v5::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
79 ]
80 );
81 pub PenpalASiblingSovereignAccount: AccountId = Sibling::from(PENPAL_A_ID).into_account_truncating();
82 pub PenpalBSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_B_ID).into_account_truncating();
83}
84
85pub fn get_host_config() -> HostConfiguration<BlockNumber> {
86 HostConfiguration {
87 max_upward_queue_count: 10,
88 max_upward_queue_size: 51200,
89 max_upward_message_size: 51200,
90 max_upward_message_num_per_candidate: 10,
91 max_downward_message_size: 51200,
92 hrmp_sender_deposit: 0,
93 hrmp_recipient_deposit: 0,
94 hrmp_channel_max_capacity: 1000,
95 hrmp_channel_max_message_size: 102400,
96 hrmp_channel_max_total_size: 102400,
97 hrmp_max_parachain_outbound_channels: 30,
98 hrmp_max_parachain_inbound_channels: 30,
99 ..Default::default()
100 }
101}
102
103pub fn build_genesis_storage(builder: &dyn BuildStorage, code: &[u8]) -> Storage {
107 let mut storage = builder.build_storage().unwrap();
108 storage
109 .top
110 .insert(sp_core::storage::well_known_keys::CODE.to_vec(), code.into());
111 storage
112}
113
114pub mod accounts {
115 use super::*;
116 pub const ALICE: &str = "Alice";
117 pub const BOB: &str = "Bob";
118 pub const DUMMY_EMPTY: &str = "JohnDoe";
119
120 pub fn init_balances() -> Vec<AccountId> {
121 Sr25519Keyring::well_known().map(|k| k.to_account_id()).collect()
122 }
123}
124
125pub mod collators {
126 use super::*;
127
128 pub fn invulnerables() -> Vec<(AccountId, AuraId)> {
129 vec![
130 (Sr25519Keyring::Alice.to_account_id(), Sr25519Keyring::Alice.public().into()),
131 (Sr25519Keyring::Bob.to_account_id(), Sr25519Keyring::Bob.public().into()),
132 ]
133 }
134}
135
136pub mod validators {
137 use sp_consensus_beefy::test_utils::Keyring;
138
139 use super::*;
140
141 pub fn initial_authorities() -> Vec<(
142 AccountId,
143 AccountId,
144 BabeId,
145 GrandpaId,
146 ValidatorId,
147 AssignmentId,
148 AuthorityDiscoveryId,
149 BeefyId,
150 )> {
151 vec![(
152 Sr25519Keyring::AliceStash.to_account_id(),
153 Sr25519Keyring::Alice.to_account_id(),
154 BabeId::from(Sr25519Keyring::Alice.public()),
155 GrandpaId::from(Ed25519Keyring::Alice.public()),
156 ValidatorId::from(Sr25519Keyring::Alice.public()),
157 AssignmentId::from(Sr25519Keyring::Alice.public()),
158 AuthorityDiscoveryId::from(Sr25519Keyring::Alice.public()),
159 BeefyId::from(Keyring::<BeefyId>::Alice.public()),
160 )]
161 }
162}
163
164pub mod snowbridge {
165 use hex_literal::hex;
166 pub const WETH: [u8; 20] = hex!("fff9976782d46cc05630d1f6ebab18b2324d6b14");
168 pub const SEPOLIA_ID: u64 = 11155111;
170 pub const ETHER_MIN_BALANCE: u128 = 1000;
172}