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