From 6b2f98d0abb8a8077869824114a9b0380d9c64a9 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 6 Aug 2024 17:57:03 -0700 Subject: [PATCH 01/51] first steps --- pallets/registrar/src/lib.rs | 4 +++- pallets/registrar/src/mock.rs | 1 + primitives/traits/src/lib.rs | 28 ++++++++++++++++++++++-- runtime/dancebox/src/lib.rs | 1 + runtime/flashbox/src/lib.rs | 1 + solo-chains/runtime/starlight/src/lib.rs | 22 ++++++++++++++++++- 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index d77950eda..e96758b5f 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -65,7 +65,7 @@ use { tp_traits::{ GetCurrentContainerChains, GetSessionContainerChains, GetSessionIndex, ParaId, ParathreadParams as ParathreadParamsTy, RelayStorageRootProvider, SessionContainerChains, - SlotFrequency, + SlotFrequency, RegistrarHandler }, }; @@ -167,6 +167,8 @@ pub mod pallet { type RegistrarHooks: RegistrarHooks; + type InnerRegistrar: RegistrarHandler; + type WeightInfo: WeightInfo; } diff --git a/pallets/registrar/src/mock.rs b/pallets/registrar/src/mock.rs index f3ded871d..f354a8889 100644 --- a/pallets/registrar/src/mock.rs +++ b/pallets/registrar/src/mock.rs @@ -148,6 +148,7 @@ impl pallet_registrar::Config for Test { type DepositAmount = DepositAmount; type RuntimeHoldReason = RuntimeHoldReason; type RegistrarHooks = Mock; + type InnerRegistrar = (); type WeightInfo = (); } diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 4ae571845..34f325534 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -24,7 +24,7 @@ pub mod alias; pub use { alias::*, cumulus_primitives_core::{ - relay_chain::{BlockNumber, Slot}, + relay_chain::{BlockNumber, HeadData, Slot, ValidationCode}, ParaId, }, dp_chain_state_snapshot::{GenericStateProof, ReadEntryErr}, @@ -33,7 +33,7 @@ use { core::marker::PhantomData, frame_support::{ dispatch::DispatchErrorWithPostInfo, - pallet_prelude::{Decode, DispatchResultWithPostInfo, Encode, Get, MaxEncodedLen, Weight}, + pallet_prelude::{Decode, DispatchResultWithPostInfo, DispatchResult, Encode, Get, MaxEncodedLen, Weight}, BoundedVec, }, serde::{Deserialize, Serialize}, @@ -366,3 +366,27 @@ impl GenericStorageReader for NativeStorageReader { } } } + +pub trait RegistrarHandler { + fn register( + who: AccountId, + //deposit_override: Option, + id: ParaId, + genesis_head: HeadData, + validation_code: ValidationCode, + ensure_reserved: bool, + ) -> DispatchResult; +} + +impl RegistrarHandler for (){ + fn register( + _who: AccountId, + //deposit_override: Option, + _id: ParaId, + _genesis_head: HeadData, + _validation_code: ValidationCode, + _ensure_reserved: bool, + ) -> DispatchResult { + Ok(()) + } +} diff --git a/runtime/dancebox/src/lib.rs b/runtime/dancebox/src/lib.rs index 875ea6b7c..68d58a573 100644 --- a/runtime/dancebox/src/lib.rs +++ b/runtime/dancebox/src/lib.rs @@ -1257,6 +1257,7 @@ impl pallet_registrar::Config for Runtime { type DepositAmount = DepositAmount; type RegistrarHooks = DanceboxRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; + type InnerRegistrar = (); type WeightInfo = weights::pallet_registrar::SubstrateWeight; } diff --git a/runtime/flashbox/src/lib.rs b/runtime/flashbox/src/lib.rs index c3f6f0b2e..c6ead8bdf 100644 --- a/runtime/flashbox/src/lib.rs +++ b/runtime/flashbox/src/lib.rs @@ -1100,6 +1100,7 @@ impl pallet_registrar::Config for Runtime { type DepositAmount = DepositAmount; type RegistrarHooks = FlashboxRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; + type InnerRegistrar = (); type WeightInfo = weights::pallet_registrar::SubstrateWeight; } diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 8c1cd5a52..465a59109 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -52,6 +52,7 @@ use { VersionedLocationConverter, }, paras_registrar, paras_sudo_wrapper, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, + traits::Registrar as RegistrarInterface, }, runtime_parachains::{ assigner_coretime as parachains_assigner_coretime, @@ -77,7 +78,7 @@ use { prelude::*, }, starlight_runtime_constants::system_parachain::BROKER_ID, - tp_traits::{GetSessionContainerChains, Slot, SlotFrequency}, + tp_traits::{GetSessionContainerChains, Slot, SlotFrequency, RegistrarHandler}, }; #[cfg(any(feature = "std", test))] @@ -1354,6 +1355,24 @@ parameter_types! { pub const MaxLengthParaIds: u32 = 100u32; pub const MaxEncodedGenesisDataSize: u32 = 5_000_000u32; // 5MB } + +pub struct InnerRegistrarManager(sp_std::marker::PhantomData<(AccountId, RegistrarManager)>); +impl RegistrarHandler for InnerRegistrarManager +where + RegistrarManager: RegistrarInterface, +{ + fn register( + who: AccountId, + //deposit_override: Option, + id: ParaId, + genesis_head: tp_traits::HeadData, + validation_code: ValidationCode, + ensure_reserved: bool, + ) -> DispatchResult { + Ok(()) + } +} + impl pallet_registrar::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RegistrarOrigin = EnsureRoot; @@ -1369,6 +1388,7 @@ impl pallet_registrar::Config for Runtime { type DepositAmount = DepositAmount; type RegistrarHooks = StarlightRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; + type InnerRegistrar = (); type WeightInfo = pallet_registrar::weights::SubstrateWeight; } From a07c3ef60f34360b5b70bf52be3ee54a47e12684 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 14 Aug 2024 13:46:05 -0700 Subject: [PATCH 02/51] refactor and test --- Cargo.lock | 2 + pallets/registrar/src/lib.rs | 6 +- primitives/traits/Cargo.toml | 2 + primitives/traits/src/lib.rs | 25 +++---- solo-chains/runtime/starlight/Cargo.toml | 2 + solo-chains/runtime/starlight/src/lib.rs | 49 ++++++++---- .../starlight/tests/relay_registrar.rs | 75 ++++++++++++++++++- 7 files changed, 128 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2011def8..1e6644019 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16227,6 +16227,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", "dp-consensus", + "dp-container-chain-genesis-data", "frame-benchmarking", "frame-executive", "frame-remote-externalities", @@ -17779,6 +17780,7 @@ version = "0.1.0" dependencies = [ "cumulus-primitives-core", "dp-chain-state-snapshot", + "dp-container-chain-genesis-data", "frame-support", "impl-trait-for-tuples", "macro_rules_attribute", diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index e96758b5f..5785c489f 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -64,8 +64,8 @@ use { sp_std::{collections::btree_set::BTreeSet, prelude::*}, tp_traits::{ GetCurrentContainerChains, GetSessionContainerChains, GetSessionIndex, ParaId, - ParathreadParams as ParathreadParamsTy, RelayStorageRootProvider, SessionContainerChains, - SlotFrequency, RegistrarHandler + ParathreadParams as ParathreadParamsTy, RegistrarHandler, RelayStorageRootProvider, + SessionContainerChains, SlotFrequency, }, }; @@ -791,6 +791,8 @@ pub mod pallet { // Hold the deposit, we verified we can do this T::Currency::hold(&HoldReason::RegistrarDeposit.into(), &account, deposit)?; + T::InnerRegistrar::register(account.clone(), para_id, genesis_data.clone().storage)?; + // Update DepositInfo RegistrarDeposit::::insert( para_id, diff --git a/primitives/traits/Cargo.toml b/primitives/traits/Cargo.toml index 07f35a68f..55bc6a110 100644 --- a/primitives/traits/Cargo.toml +++ b/primitives/traits/Cargo.toml @@ -11,6 +11,7 @@ workspace = true [dependencies] dp-chain-state-snapshot = { workspace = true } +dp-container-chain-genesis-data = { workspace = true } frame-support = { workspace = true } impl-trait-for-tuples = { workspace = true } macro_rules_attribute = { workspace = true } @@ -29,6 +30,7 @@ default = [ "std" ] std = [ "cumulus-primitives-core/std", "dp-chain-state-snapshot/std", + "dp-container-chain-genesis-data/std", "frame-support/std", "parity-scale-codec/std", "scale-info/std", diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 34f325534..fa7f065d1 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -28,12 +28,15 @@ pub use { ParaId, }, dp_chain_state_snapshot::{GenericStateProof, ReadEntryErr}, + dp_container_chain_genesis_data::ContainerChainGenesisDataItem, }; use { core::marker::PhantomData, frame_support::{ dispatch::DispatchErrorWithPostInfo, - pallet_prelude::{Decode, DispatchResultWithPostInfo, DispatchResult, Encode, Get, MaxEncodedLen, Weight}, + pallet_prelude::{ + Decode, DispatchResult, DispatchResultWithPostInfo, Encode, Get, MaxEncodedLen, Weight, + }, BoundedVec, }, serde::{Deserialize, Serialize}, @@ -370,23 +373,17 @@ impl GenericStorageReader for NativeStorageReader { pub trait RegistrarHandler { fn register( who: AccountId, - //deposit_override: Option, - id: ParaId, - genesis_head: HeadData, - validation_code: ValidationCode, - ensure_reserved: bool, + id: ParaId, + genesis_storage: Vec, ) -> DispatchResult; } -impl RegistrarHandler for (){ +impl RegistrarHandler for () { fn register( - _who: AccountId, - //deposit_override: Option, - _id: ParaId, - _genesis_head: HeadData, - _validation_code: ValidationCode, - _ensure_reserved: bool, - ) -> DispatchResult { + _who: AccountId, + _id: ParaId, + _genesis_storage: Vec, + ) -> DispatchResult { Ok(()) } } diff --git a/solo-chains/runtime/starlight/Cargo.toml b/solo-chains/runtime/starlight/Cargo.toml index 3942649d4..4c0779c8d 100644 --- a/solo-chains/runtime/starlight/Cargo.toml +++ b/solo-chains/runtime/starlight/Cargo.toml @@ -120,6 +120,7 @@ cumulus-primitives-core = { workspace = true } # Tanssi dp-consensus = { workspace = true } +dp-container-chain-genesis-data = { workspace = true } tp-author-noting-inherent = { workspace = true } tp-traits = { workspace = true } @@ -159,6 +160,7 @@ std = [ "cumulus-pallet-parachain-system/std", "cumulus-primitives-core/std", "dp-consensus/std", + "dp-container-chain-genesis-data/std", "frame-benchmarking?/std", "frame-executive/std", "frame-support/std", diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 465a59109..4e929fda0 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -26,6 +26,8 @@ use { ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature}, mmr::{BeefyDataProvider, MmrLeafVersion}, }, + cumulus_primitives_core::relay_chain::{HeadData, ValidationCode}, + dp_container_chain_genesis_data::ContainerChainGenesisDataItem, frame_support::{ dispatch::DispatchResult, dynamic_params::{dynamic_pallet_params, dynamic_params}, @@ -42,7 +44,7 @@ use { CommittedCandidateReceipt, CoreIndex, CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, NodeFeatures, Nonce, OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, - SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, + SessionInfo, Signature, ValidationCodeHash, ValidatorId, ValidatorIndex, PARACHAIN_KEY_TYPE_ID, }, runtime_common::{ @@ -51,8 +53,9 @@ use { ContainsParts, LocatableAssetConverter, ToAuthor, VersionedLocatableAsset, VersionedLocationConverter, }, - paras_registrar, paras_sudo_wrapper, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, + paras_registrar, paras_sudo_wrapper, traits::Registrar as RegistrarInterface, + BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, }, runtime_parachains::{ assigner_coretime as parachains_assigner_coretime, @@ -71,14 +74,14 @@ use { }, scale_info::TypeInfo, sp_genesis_builder::PresetId, - sp_runtime::traits::BlockNumberProvider, + sp_runtime::{traits::BlockNumberProvider, DispatchError}, sp_std::{ cmp::Ordering, collections::{btree_map::BTreeMap, vec_deque::VecDeque}, prelude::*, }, starlight_runtime_constants::system_parachain::BROKER_ID, - tp_traits::{GetSessionContainerChains, Slot, SlotFrequency, RegistrarHandler}, + tp_traits::{GetSessionContainerChains, RegistrarHandler, Slot, SlotFrequency}, }; #[cfg(any(feature = "std", test))] @@ -1356,20 +1359,34 @@ parameter_types! { pub const MaxEncodedGenesisDataSize: u32 = 5_000_000u32; // 5MB } -pub struct InnerRegistrarManager(sp_std::marker::PhantomData<(AccountId, RegistrarManager)>); -impl RegistrarHandler for InnerRegistrarManager +pub struct InnerStarlightRegistrar( + sp_std::marker::PhantomData<(AccountId, RegistrarManager)>, +); +impl RegistrarHandler + for InnerStarlightRegistrar where - RegistrarManager: RegistrarInterface, + RegistrarManager: RegistrarInterface, { fn register( - who: AccountId, - //deposit_override: Option, - id: ParaId, - genesis_head: tp_traits::HeadData, - validation_code: ValidationCode, - ensure_reserved: bool, - ) -> DispatchResult { - Ok(()) + who: AccountId, + id: ParaId, + genesis_storage: Vec, + ) -> DispatchResult { + // Build HeadData + let key_values: Vec<(Vec, Vec)> = + genesis_storage.into_iter().map(|x| x.into()).collect(); + let genesis_head = HeadData(key_values.clone().encode()); + + // TODO: use well_known_keys::CODE + let kv_code = key_values.into_iter().find(|kv| kv.0 == b":code".to_vec()); + + if let None = kv_code { + return Err(DispatchError::Other("Chain code not found")); + } + + // Build ValidationCode + let validation_code = ValidationCode(kv_code.unwrap().1); + RegistrarManager::register(who, id, genesis_head, validation_code) } } @@ -1388,7 +1405,7 @@ impl pallet_registrar::Config for Runtime { type DepositAmount = DepositAmount; type RegistrarHooks = StarlightRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; - type InnerRegistrar = (); + type InnerRegistrar = InnerStarlightRegistrar; type WeightInfo = pallet_registrar::weights::SubstrateWeight; } diff --git a/solo-chains/runtime/starlight/tests/relay_registrar.rs b/solo-chains/runtime/starlight/tests/relay_registrar.rs index e8f275223..376eee5b7 100644 --- a/solo-chains/runtime/starlight/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/tests/relay_registrar.rs @@ -20,9 +20,13 @@ mod common; use { crate::common::*, frame_support::{assert_noop, assert_ok}, + pallet_registrar_runtime_api::{ + runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, + }, runtime_common::paras_registrar, + runtime_parachains::configuration as parachains_configuration, sp_std::vec, - starlight_runtime::{Paras, Registrar}, + starlight_runtime::{Configuration, ContainerRegistrar, Paras, Registrar}, }; const UNIT: Balance = 1_000_000_000_000_000_000; @@ -98,3 +102,72 @@ fn registrar_needs_a_reserved_para_id() { .is_parathread()); }); } + +#[test] +fn register_para_via_container_registrar() { + ExtBuilder::default() + .with_para_ids(vec![ + (1001, empty_genesis_data(), u32::MAX, u32::MAX).into(), + (1002, empty_genesis_data(), u32::MAX, u32::MAX).into(), + ]) + .build() + .execute_with(|| { + // In this test we're gonna register a para via ContainerRegistrar, + // which will internally use the InnerRegistrar type to also register the para + // in the relay Registrar pallet. + + assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + run_to_session(1u32); + + // Change max_head_data_size config. + assert_ok!( + Configuration::set_max_head_data_size(root_origin(), 20500), + () + ); + run_to_session(4u32); + assert_eq!( + parachains_configuration::ActiveConfig::::get().max_head_data_size, + 20500 + ); + + let validation_code = + vec![1u8; cumulus_primitives_core::relay_chain::MIN_CODE_SIZE as usize]; + let genesis_data_1003 = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1003.into(), + genesis_data_1003.clone() + ), + () + ); + + // Now let's check if the para was preoperly registered in the relay. + // Run to next session. + run_to_session(5); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be onboarding") + .is_onboarding()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + validation_code.into() + )); + run_to_session(7); + + // Now the para should be a parathread. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parathread") + .is_parathread()); + }); +} From 1345124c18bfb8884d25f0eee46f2cef2e922e5a Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 14 Aug 2024 14:13:29 -0700 Subject: [PATCH 03/51] add tuple conversion for ParaRegistrationParams in tests --- .../runtime/starlight/src/tests/common/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/solo-chains/runtime/starlight/src/tests/common/mod.rs b/solo-chains/runtime/starlight/src/tests/common/mod.rs index ed9ffc3cf..f345aa53a 100644 --- a/solo-chains/runtime/starlight/src/tests/common/mod.rs +++ b/solo-chains/runtime/starlight/src/tests/common/mod.rs @@ -238,6 +238,18 @@ pub struct ParaRegistrationParams { pub parathread_params: Option, } +impl From<(u32, ContainerChainGenesisData, u32, u32)> for ParaRegistrationParams { + fn from(value: (u32, ContainerChainGenesisData, u32, u32)) -> Self { + Self { + para_id: value.0, + genesis_data: value.1, + block_production_credits: value.2, + collator_assignment_credits: value.3, + parathread_params: None + } + } +} + pub fn default_config() -> pallet_configuration::HostConfiguration { pallet_configuration::HostConfiguration { max_collators: 100, From 14e02500b569458575d60d130bf9236f867d8620 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 14 Aug 2024 17:43:30 -0700 Subject: [PATCH 04/51] add changes for mark_valid_for_collating and deregister --- pallets/registrar/src/lib.rs | 3 +++ primitives/traits/src/lib.rs | 11 +++++++++++ solo-chains/runtime/starlight/src/lib.rs | 14 +++++++++++++- .../runtime/starlight/src/tests/common/mod.rs | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index e5c0af07c..50fb7fdeb 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -850,6 +850,7 @@ pub mod pallet { })?; // Mark this para id for cleanup later Self::schedule_parachain_cleanup(para_id)?; + T::InnerRegistrar::schedule_para_cleanup(para_id)?; Self::deposit_event(Event::ParaIdDeregistered { para_id }); } @@ -886,6 +887,8 @@ pub mod pallet { T::RegistrarHooks::para_marked_valid_for_collating(para_id); + T::InnerRegistrar::schedule_para_upgrade(para_id)?; + Ok(()) } diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index fa7f065d1..eccbbaa45 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -376,6 +376,9 @@ pub trait RegistrarHandler { id: ParaId, genesis_storage: Vec, ) -> DispatchResult; + + fn schedule_para_upgrade(id: ParaId) -> DispatchResult; + fn schedule_para_cleanup(id: ParaId) -> DispatchResult; } impl RegistrarHandler for () { @@ -386,4 +389,12 @@ impl RegistrarHandler for () { ) -> DispatchResult { Ok(()) } + + fn schedule_para_upgrade(_id: ParaId) -> DispatchResult { + Ok(()) + } + + fn schedule_para_cleanup(_id: ParaId) -> DispatchResult { + Ok(()) + } } diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index f82b94a5d..2acd6b0e1 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -82,7 +82,10 @@ use { marker::PhantomData, prelude::*, }, - tp_traits::{GetSessionContainerChains, RegistrarHandler, RemoveParaIdsWithNoCredits, Slot, SlotFrequency}, + tp_traits::{ + GetSessionContainerChains, RegistrarHandler, RemoveParaIdsWithNoCredits, Slot, + SlotFrequency, + }, }; #[cfg(any(feature = "std", test))] @@ -1510,6 +1513,15 @@ where let validation_code = ValidationCode(kv_code.unwrap().1); RegistrarManager::register(who, id, genesis_head, validation_code) } + + fn schedule_para_upgrade(id: ParaId) -> DispatchResult { + RegistrarManager::make_parachain(id) + } + + fn schedule_para_cleanup(id: ParaId) -> DispatchResult { + RegistrarManager::make_parathread(id)?; + RegistrarManager::deregister(id) + } } impl pallet_registrar::Config for Runtime { diff --git a/solo-chains/runtime/starlight/src/tests/common/mod.rs b/solo-chains/runtime/starlight/src/tests/common/mod.rs index f345aa53a..fad74d04c 100644 --- a/solo-chains/runtime/starlight/src/tests/common/mod.rs +++ b/solo-chains/runtime/starlight/src/tests/common/mod.rs @@ -245,7 +245,7 @@ impl From<(u32, ContainerChainGenesisData, u32, u32)> for ParaRegistrationParams genesis_data: value.1, block_production_credits: value.2, collator_assignment_credits: value.3, - parathread_params: None + parathread_params: None, } } } From 35d34b26848ae999fa279a4572021e4d055cfd6d Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 15 Aug 2024 16:50:58 -0700 Subject: [PATCH 05/51] modify RegistrarHandler trait and add more tests --- pallets/registrar/src/lib.rs | 3 +- primitives/traits/src/lib.rs | 11 +- solo-chains/runtime/starlight/src/lib.rs | 28 +- .../starlight/src/tests/relay_registrar.rs | 266 +++++++++++++++++- 4 files changed, 296 insertions(+), 12 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 50fb7fdeb..67dad5434 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -850,7 +850,7 @@ pub mod pallet { })?; // Mark this para id for cleanup later Self::schedule_parachain_cleanup(para_id)?; - T::InnerRegistrar::schedule_para_cleanup(para_id)?; + T::InnerRegistrar::schedule_para_downgrade(para_id)?; Self::deposit_event(Event::ParaIdDeregistered { para_id }); } @@ -1210,6 +1210,7 @@ pub mod pallet { ParaManager::::remove(para_id); T::RegistrarHooks::para_deregistered(para_id); + T::InnerRegistrar::deregister(para_id); } fn schedule_parachain_cleanup(para_id: ParaId) -> DispatchResult { diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index eccbbaa45..7848bb717 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -376,9 +376,10 @@ pub trait RegistrarHandler { id: ParaId, genesis_storage: Vec, ) -> DispatchResult; - + fn schedule_para_upgrade(id: ParaId) -> DispatchResult; - fn schedule_para_cleanup(id: ParaId) -> DispatchResult; + fn schedule_para_downgrade(id: ParaId) -> DispatchResult; + fn deregister(id: ParaId) -> Weight; } impl RegistrarHandler for () { @@ -394,7 +395,11 @@ impl RegistrarHandler for () { Ok(()) } - fn schedule_para_cleanup(_id: ParaId) -> DispatchResult { + fn schedule_para_downgrade(_id: ParaId) -> DispatchResult { Ok(()) } + + fn deregister(_id: ParaId) -> Weight { + Weight::default() + } } diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 2acd6b0e1..470b921be 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -74,6 +74,7 @@ use { shared as parachains_shared, }, scale_info::TypeInfo, + sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, sp_runtime::{traits::BlockNumberProvider, DispatchError}, sp_std::{ @@ -1485,7 +1486,7 @@ parameter_types! { } pub struct InnerStarlightRegistrar( - sp_std::marker::PhantomData<(AccountId, RegistrarManager)>, + PhantomData<(AccountId, RegistrarManager)>, ); impl RegistrarHandler for InnerStarlightRegistrar @@ -1502,11 +1503,13 @@ where genesis_storage.into_iter().map(|x| x.into()).collect(); let genesis_head = HeadData(key_values.clone().encode()); - // TODO: use well_known_keys::CODE - let kv_code = key_values.into_iter().find(|kv| kv.0 == b":code".to_vec()); + // Check if the wasm code is present in storage + let kv_code = key_values + .into_iter() + .find(|kv| kv.0 == StorageWellKnownKeys::CODE.to_vec()); if let None = kv_code { - return Err(DispatchError::Other("Chain code not found")); + return Err(DispatchError::Other("Code not found")); } // Build ValidationCode @@ -1518,9 +1521,20 @@ where RegistrarManager::make_parachain(id) } - fn schedule_para_cleanup(id: ParaId) -> DispatchResult { - RegistrarManager::make_parathread(id)?; - RegistrarManager::deregister(id) + fn schedule_para_downgrade(id: ParaId) -> DispatchResult { + RegistrarManager::make_parathread(id) + } + + fn deregister(id: ParaId) -> Weight { + if let Err(e) = RegistrarManager::deregister(id) { + log::warn!( + "Failed to deregister para id {} in relay chain: {:?}", + u32::from(id), + e, + ); + } + + Weight::default() } } diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 9c19b08e9..b8528283e 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -18,8 +18,9 @@ use { crate::tests::common::*, - crate::{Configuration, ContainerRegistrar, Paras, Registrar}, + crate::{Configuration, ContainerRegistrar, Paras, Registrar, System}, frame_support::{assert_noop, assert_ok}, + pallet_registrar::Event as ContainerRegistrarEvent, pallet_registrar_runtime_api::{ runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, }, @@ -168,3 +169,266 @@ fn register_para_via_container_registrar() { .is_parathread()); }); } + +#[test] +fn cannot_register_para_twice_in_relay() { + ExtBuilder::default() + .with_para_ids(vec![ + (1001, empty_genesis_data(), u32::MAX, u32::MAX).into(), + (1002, empty_genesis_data(), u32::MAX, u32::MAX).into(), + ]) + .build() + .execute_with(|| { + // In this test we're gonna confirm that a para cannot be registered in the relay + // after being already registered through ContainerRegistrar. + + assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + run_to_session(1u32); + + // Change max_head_data_size config. + assert_ok!( + Configuration::set_max_head_data_size(root_origin(), 20500), + () + ); + run_to_session(4u32); + assert_eq!( + parachains_configuration::ActiveConfig::::get().max_head_data_size, + 20500 + ); + + let validation_code = + vec![1u8; cumulus_primitives_core::relay_chain::MIN_CODE_SIZE as usize]; + let genesis_data_1003 = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1003.into(), + genesis_data_1003.clone() + ), + () + ); + + // Now let's check if the para was preoperly registered in the relay. + // Run to next session. + run_to_session(5); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be onboarding") + .is_onboarding()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + validation_code.clone().into() + )); + run_to_session(7); + + // Now the para should be a parathread. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parathread") + .is_parathread()); + + // We shouldn't be able to register the para again + assert_noop!( + Registrar::register( + origin_of(ALICE.into()), + 1003.into(), + vec![].into(), + validation_code.into() + ), + paras_registrar::Error::::AlreadyRegistered + ); + }); +} + +#[test] +fn mark_valid_for_collating_converts_to_parachain() { + ExtBuilder::default() + .with_para_ids(vec![ + (1001, empty_genesis_data(), u32::MAX, u32::MAX).into(), + (1002, empty_genesis_data(), u32::MAX, u32::MAX).into(), + ]) + .build() + .execute_with(|| { + // In this test we're gonna check that inside mark_valid_for_collating(), + // if we are passing a parathread, this one will be upgraded to a parachain + // at the end of the execution. + + assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + run_to_session(1u32); + + // Change max_head_data_size config. + assert_ok!( + Configuration::set_max_head_data_size(root_origin(), 20500), + () + ); + run_to_session(4u32); + assert_eq!( + parachains_configuration::ActiveConfig::::get().max_head_data_size, + 20500 + ); + + let validation_code = + vec![1u8; cumulus_primitives_core::relay_chain::MIN_CODE_SIZE as usize]; + let genesis_data_1003 = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1003.into(), + genesis_data_1003.clone() + ), + () + ); + + // Now let's check if the para was preoperly registered in the relay. + // Run to next session. + run_to_session(5); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be onboarding") + .is_onboarding()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + validation_code.into() + )); + run_to_session(7); + + // Now the para should be a parathread. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parathread") + .is_parathread()); + + // Call mark_valid_for_collating. + assert_ok!( + ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), + () + ); + + // The change should be applied after 2 sessions. + run_to_session(9); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parachain") + .is_parachain()); + }); +} + +#[test] +fn deregister_calls_schedule_para_cleanup() { + ExtBuilder::default() + .with_para_ids(vec![ + (1001, empty_genesis_data(), u32::MAX, u32::MAX).into(), + (1002, empty_genesis_data(), u32::MAX, u32::MAX).into(), + ]) + .build() + .execute_with(|| { + // In this test we're gonna check that when calling ContainerRegistrar::deregister(), + // the para is also offboarded from the relay. + + assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + run_to_session(1u32); + + // Change max_head_data_size config. + assert_ok!( + Configuration::set_max_head_data_size(root_origin(), 20500), + () + ); + run_to_session(4u32); + assert_eq!( + parachains_configuration::ActiveConfig::::get().max_head_data_size, + 20500 + ); + + let validation_code = + vec![1u8; cumulus_primitives_core::relay_chain::MIN_CODE_SIZE as usize]; + let genesis_data_1003 = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1003.into(), + genesis_data_1003.clone() + ), + () + ); + + // Now let's check if the para was preoperly registered in the relay. + // Run to next session. + run_to_session(5); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be onboarding") + .is_onboarding()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + validation_code.into() + )); + run_to_session(7); + + // Now the para should be a parathread. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parathread") + .is_parathread()); + + // Call mark_valid_for_collating. + assert_ok!( + ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), + () + ); + + // The change should be applied after 2 sessions. + run_to_session(9); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parachain") + .is_parachain()); + + assert_eq!( + Runtime::genesis_data(1003.into()).as_ref(), + Some(&genesis_data_1003) + ); + + assert_ok!(ContainerRegistrar::deregister(root_origin(), 1003.into())); + + // Assert that the ParaIdDeregistered event was properly deposited + System::assert_last_event( + ContainerRegistrarEvent::ParaIdDeregistered { + para_id: 1003.into(), + } + .into(), + ); + + run_to_session(11); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + + // Para should be offboarding after 2 sessions. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be offboarding") + .is_offboarding()); + }); +} From 4eb4a71d4361683f51c734039df3638999290422 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Mon, 19 Aug 2024 20:38:55 -0700 Subject: [PATCH 06/51] add TS test --- .../registrar/test-registrar.ts | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 test/suites/dev-tanssi-relay/registrar/test-registrar.ts diff --git a/test/suites/dev-tanssi-relay/registrar/test-registrar.ts b/test/suites/dev-tanssi-relay/registrar/test-registrar.ts new file mode 100644 index 000000000..9c244b866 --- /dev/null +++ b/test/suites/dev-tanssi-relay/registrar/test-registrar.ts @@ -0,0 +1,99 @@ +import { describeSuite, expect, beforeAll } from "@moonwall/cli"; +import { ApiPromise } from "@polkadot/api"; +import { KeyringPair } from "@moonwall/util"; +import { jumpSessions } from "../../../util/block"; + +describeSuite({ + id: "DT0107", + title: "ContainerRegistrar <> relay Registrar", + foundationMethods: "dev", + testCases: ({ it, context }) => { + let polkadotJs: ApiPromise; + let alice: KeyringPair; + + beforeAll(() => { + alice = context.keyring.alice; + polkadotJs = context.pjsApi; + }); + + it({ + id: "E01", + title: "should be able to register paraId", + test: async function () { + await context.createBlock(); + + // Code key: 0x3a636f6465 or [58, 99, 111, 100, 101] + const emptyGenesisData = () => { + const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { + storage: [ + { + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", + }, + ], + name: "0x436f6e7461696e657220436861696e2032303030", + id: "0x636f6e7461696e65722d636861696e2d32303030", + forkId: null, + extensions: "0x", + properties: { + tokenMetadata: { + tokenSymbol: "0x61626364", + ss58Format: 42, + tokenDecimals: 12, + }, + isEthereum: false, + }, + }); + return g; + }; + const containerChainGenesisData = emptyGenesisData(); + + const tx = await polkadotJs.tx.containerRegistrar + .register(2002, containerChainGenesisData) + .signAsync(alice); + + await context.createBlock([tx], { allowFailures: false }); + + await jumpSessions(context, 1); + + // Para should be onboarding now + const isOnboarding = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isOnboarding.toString()).to.eq("Onboarding"); + + // Accept validation code so that para is onboarded after 2 sessions + const tx2 = polkadotJs.tx.paras.addTrustedValidationCode("0x0102030405060708091011"); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2).signAsync(alice)], { + allowFailures: false, + }); + + await jumpSessions(context, 2); + + // Para should be a parathread now + const isParathread = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isParathread.toString()).to.eq("Parathread"); + + // Check that the on chain genesis data is set correctly + const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); + expect(emptyGenesisData().toJSON()).to.deep.equal(onChainGenesisData.toJSON()); + + // Mark the paraId valid for collating + const tx3 = polkadotJs.tx.containerRegistrar.markValidForCollating(2002); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx3).signAsync(alice)], { + allowFailures: false, + }); + + await jumpSessions(context, 2); + + // Para should be a parathread now + const isParachain = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isParachain.toString()).to.eq("Parachain"); + + // Expect all paraIds to be registered (genesis ones + 2002) + const parasRegistered = await polkadotJs.query.containerRegistrar.registeredParaIds(); + expect(parasRegistered.toJSON()).to.deep.equal([2000, 2001, 2002]); + }, + }); + }, +}); From 86afe09670d4ed54a98f1d5c3322df3a2e34687c Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 20 Aug 2024 17:41:54 -0700 Subject: [PATCH 07/51] add more TS tests --- .../registrar/test-registrar.ts | 99 ----------- .../registrar/test_registrars.ts | 154 ++++++++++++++++++ 2 files changed, 154 insertions(+), 99 deletions(-) delete mode 100644 test/suites/dev-tanssi-relay/registrar/test-registrar.ts create mode 100644 test/suites/dev-tanssi-relay/registrar/test_registrars.ts diff --git a/test/suites/dev-tanssi-relay/registrar/test-registrar.ts b/test/suites/dev-tanssi-relay/registrar/test-registrar.ts deleted file mode 100644 index 9c244b866..000000000 --- a/test/suites/dev-tanssi-relay/registrar/test-registrar.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { describeSuite, expect, beforeAll } from "@moonwall/cli"; -import { ApiPromise } from "@polkadot/api"; -import { KeyringPair } from "@moonwall/util"; -import { jumpSessions } from "../../../util/block"; - -describeSuite({ - id: "DT0107", - title: "ContainerRegistrar <> relay Registrar", - foundationMethods: "dev", - testCases: ({ it, context }) => { - let polkadotJs: ApiPromise; - let alice: KeyringPair; - - beforeAll(() => { - alice = context.keyring.alice; - polkadotJs = context.pjsApi; - }); - - it({ - id: "E01", - title: "should be able to register paraId", - test: async function () { - await context.createBlock(); - - // Code key: 0x3a636f6465 or [58, 99, 111, 100, 101] - const emptyGenesisData = () => { - const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { - storage: [ - { - // ":code" key - key: "0x3a636f6465", - // code value (must be at least 9 bytes length) - value: "0x0102030405060708091011", - }, - ], - name: "0x436f6e7461696e657220436861696e2032303030", - id: "0x636f6e7461696e65722d636861696e2d32303030", - forkId: null, - extensions: "0x", - properties: { - tokenMetadata: { - tokenSymbol: "0x61626364", - ss58Format: 42, - tokenDecimals: 12, - }, - isEthereum: false, - }, - }); - return g; - }; - const containerChainGenesisData = emptyGenesisData(); - - const tx = await polkadotJs.tx.containerRegistrar - .register(2002, containerChainGenesisData) - .signAsync(alice); - - await context.createBlock([tx], { allowFailures: false }); - - await jumpSessions(context, 1); - - // Para should be onboarding now - const isOnboarding = await polkadotJs.query.paras.paraLifecycles(2002); - expect(isOnboarding.toString()).to.eq("Onboarding"); - - // Accept validation code so that para is onboarded after 2 sessions - const tx2 = polkadotJs.tx.paras.addTrustedValidationCode("0x0102030405060708091011"); - await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2).signAsync(alice)], { - allowFailures: false, - }); - - await jumpSessions(context, 2); - - // Para should be a parathread now - const isParathread = await polkadotJs.query.paras.paraLifecycles(2002); - expect(isParathread.toString()).to.eq("Parathread"); - - // Check that the on chain genesis data is set correctly - const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); - expect(emptyGenesisData().toJSON()).to.deep.equal(onChainGenesisData.toJSON()); - - // Mark the paraId valid for collating - const tx3 = polkadotJs.tx.containerRegistrar.markValidForCollating(2002); - await context.createBlock([await polkadotJs.tx.sudo.sudo(tx3).signAsync(alice)], { - allowFailures: false, - }); - - await jumpSessions(context, 2); - - // Para should be a parathread now - const isParachain = await polkadotJs.query.paras.paraLifecycles(2002); - expect(isParachain.toString()).to.eq("Parachain"); - - // Expect all paraIds to be registered (genesis ones + 2002) - const parasRegistered = await polkadotJs.query.containerRegistrar.registeredParaIds(); - expect(parasRegistered.toJSON()).to.deep.equal([2000, 2001, 2002]); - }, - }); - }, -}); diff --git a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts new file mode 100644 index 000000000..a5a548f5b --- /dev/null +++ b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts @@ -0,0 +1,154 @@ +import { describeSuite, expect, beforeAll } from "@moonwall/cli"; +import { ApiPromise } from "@polkadot/api"; +import { KeyringPair } from "@moonwall/util"; +import { jumpSessions } from "../../../util/block"; + +describeSuite({ + id: "DT0107", + title: "ContainerRegistrar <> relay Registrar", + foundationMethods: "dev", + testCases: ({ it, context }) => { + let polkadotJs: ApiPromise; + let alice: KeyringPair; + let emptyGenesisData: any; + + beforeAll(() => { + alice = context.keyring.alice; + polkadotJs = context.pjsApi; + emptyGenesisData = () => { + const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { + // Code key: 0x3a636f6465 or [58, 99, 111, 100, 101] + storage: [ + { + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", + }, + ], + name: "0x436f6e7461696e657220436861696e2032303030", + id: "0x636f6e7461696e65722d636861696e2d32303030", + forkId: null, + extensions: "0x", + properties: { + tokenMetadata: { + tokenSymbol: "0x61626364", + ss58Format: 42, + tokenDecimals: 12, + }, + isEthereum: false, + }, + }); + return g; + }; + }); + + it({ + id: "E01", + title: "should be able to register paraId", + test: async function () { + await context.createBlock(); + const containerChainGenesisData = emptyGenesisData(); + + const tx = await polkadotJs.tx.containerRegistrar + .register(2002, containerChainGenesisData) + .signAsync(alice); + + await context.createBlock([tx], { allowFailures: false }); + + await jumpSessions(context, 1); + + // Para should be onboarding now + const isOnboarding = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isOnboarding.toString()).to.eq("Onboarding"); + + // Accept validation code so that para is onboarded after 2 sessions + const tx2 = polkadotJs.tx.paras.addTrustedValidationCode("0x0102030405060708091011"); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2).signAsync(alice)], { + allowFailures: false, + }); + + await jumpSessions(context, 2); + + // Para should be a parathread now + const isParathread = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isParathread.toString()).to.eq("Parathread"); + + // Check that the on chain genesis data is set correctly + const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); + expect(emptyGenesisData().toJSON()).to.deep.equal(onChainGenesisData.toJSON()); + + // Mark the paraId valid for collating + const tx3 = polkadotJs.tx.containerRegistrar.markValidForCollating(2002); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx3).signAsync(alice)], { + allowFailures: false, + }); + + await jumpSessions(context, 2); + + // Para should be a parachain now + const isParachain = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isParachain.toString()).to.eq("Parachain"); + + // Expect all paraIds to be registered (genesis ones + 2002) + const parasRegistered = await polkadotJs.query.containerRegistrar.registeredParaIds(); + expect(parasRegistered.toJSON()).to.deep.equal([2000, 2001, 2002]); + }, + }); + + it({ + id: "E02", + title: "should not be able to register paraId twice", + test: async function () { + const containerChainGenesisData = emptyGenesisData(); + + // Check we can't register via ContainerRegistrar + const tx = await polkadotJs.tx.containerRegistrar + .register(2002, containerChainGenesisData) + .signAsync(alice); + + const { result } = await context.createBlock([tx]); + expect(result[0].successful).to.be.false; + expect(result[0].error.section).to.eq("containerRegistrar"); + expect(result[0].error.name).to.eq("ParaIdAlreadyRegistered"); + + // Check we can't register via relay Registrar + const tx2 = polkadotJs.tx.registrar.register(2002, "0x", "0x0102030405060708091011").signAsync(alice); + let { result: result2 } = await context.createBlock([tx2]); + expect(result2[0].successful).to.be.false; + expect(result2[0].error.section).to.eq("registrar"); + expect(result2[0].error.name).to.eq("AlreadyRegistered"); + }, + }); + + it({ + id: "E03", + title: "ContainerRegistrar::deregister should offboard the paraId", + test: async function () { + // Para should still be a parachain + const isParachain = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isParachain.toString()).to.eq("Parachain"); + + const onChainGenesisDataBefore = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); + console.log("ON CHAIN GEN: ", onChainGenesisDataBefore.toHuman()); + + const tx = polkadotJs.tx.containerRegistrar.deregister(2002); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx).signAsync(alice)], { + allowFailures: false, + }); + + await jumpSessions(context, 2); + await context.createBlock(); + + // Check that the on chain genesis data is now empty + const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); + expect(onChainGenesisData).to.be.null; + + // Para should be offboarding + // TODO: check why this is failing and not behaving the same as in rust tests + const isOffboarding = await polkadotJs.query.paras.paraLifecycles(2002); + expect(isOffboarding.toString()).to.eq("OffboardingParathread"); + }, + }); + }, +}); From 9e93f7286179bbb31f9b91832a3806d9597c800f Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 21 Aug 2024 05:57:34 -0700 Subject: [PATCH 08/51] fix syntax --- solo-chains/runtime/starlight/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index d1c42b172..4f00f7360 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1516,13 +1516,13 @@ where .into_iter() .find(|kv| kv.0 == StorageWellKnownKeys::CODE.to_vec()); - if let None = kv_code { + if let Some((_, code)) = kv_code { + // Build ValidationCode + let validation_code = ValidationCode(code); + RegistrarManager::register(who, id, genesis_head, validation_code) + } else { return Err(DispatchError::Other("Code not found")); } - - // Build ValidationCode - let validation_code = ValidationCode(kv_code.unwrap().1); - RegistrarManager::register(who, id, genesis_head, validation_code) } fn schedule_para_upgrade(id: ParaId) -> DispatchResult { From 138f6db710184711cd36ad185b93e996984c00f7 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 21 Aug 2024 06:24:04 -0700 Subject: [PATCH 09/51] remove clone --- solo-chains/runtime/starlight/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 4f00f7360..4beb9ca61 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1509,7 +1509,7 @@ where // Build HeadData let key_values: Vec<(Vec, Vec)> = genesis_storage.into_iter().map(|x| x.into()).collect(); - let genesis_head = HeadData(key_values.clone().encode()); + let genesis_head = HeadData(key_values.encode()); // Check if the wasm code is present in storage let kv_code = key_values From b645892446fe4c50dd5b71ce149eaa68edaae570 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 13:40:18 -0700 Subject: [PATCH 10/51] modify MaxEncodedGenesisDataSize --- primitives/traits/src/lib.rs | 2 +- solo-chains/runtime/starlight/src/lib.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 7848bb717..33ff68334 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -376,7 +376,7 @@ pub trait RegistrarHandler { id: ParaId, genesis_storage: Vec, ) -> DispatchResult; - + fn schedule_para_upgrade(id: ParaId) -> DispatchResult; fn schedule_para_downgrade(id: ParaId) -> DispatchResult; fn deregister(id: ParaId) -> Weight; diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 4beb9ca61..785bb986a 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1490,7 +1490,7 @@ parameter_types! { pub const DepositAmount: Balance = 100 * UNITS; #[derive(Clone)] pub const MaxLengthParaIds: u32 = 100u32; - pub const MaxEncodedGenesisDataSize: u32 = 5_000_000u32; // 5MB + pub const MaxEncodedGenesisDataSize: u32 = 1_000_000u32; // 1MB } pub struct InnerStarlightRegistrar( @@ -1526,11 +1526,17 @@ where } fn schedule_para_upgrade(id: ParaId) -> DispatchResult { - RegistrarManager::make_parachain(id) + if !RegistrarManager::is_parachain(id) { + return RegistrarManager::make_parachain(id); + } + Ok(()) } fn schedule_para_downgrade(id: ParaId) -> DispatchResult { - RegistrarManager::make_parathread(id) + if !RegistrarManager::is_parathread(id) { + return RegistrarManager::make_parathread(id); + } + Ok(()) } fn deregister(id: ParaId) -> Weight { From 997547112c313a6478b919c45839af88dbd799d8 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 16:26:04 -0700 Subject: [PATCH 11/51] add BufferedParasToDeregister --- pallets/registrar/src/lib.rs | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 67dad5434..c508b98f7 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -232,6 +232,27 @@ pub mod pallet { ValueQuery, >; + /// This storage aims to act as a 'buffer' for paraIds that must be deregistered at the + /// end of the block execution by calling 'T::InnerRegistrar::deregister()' implementation. + /// + /// We need this buffer because when we are using this pallet on a relay-chain environment + /// like Starlight (where 'T::InnerRegistrar' implementation is usually the + /// 'paras_registrar' pallet) we need to deregister (via 'paras_registrar::deregister') + /// the same paraIds we have in 'PendingToRemove', and we need to do this deregistration + /// process inside 'on_finalize' hook. + /// + /// It can be the case that some paraIds need to be downgraded to a parathread before + /// deregistering on 'paras_registrar'. This process usually takes 2 sessions, + /// and the actual downgrade happens when the block finalizes. + /// + /// Therefore, if we tried to perform this relay deregistration process at the beginning + /// of the session/block inside ('on_initialize') initializer_on_new_session() as we do + /// for this pallet, it would fail due to the downgrade process could have not taken + /// place yet. + #[pallet::storage] + pub type BufferedParasToDeregister = + StorageValue<_, BoundedVec, ValueQuery>; + pub type DepositBalanceOf = <::Currency as Inspect<::AccountId>>::Balance; @@ -315,6 +336,11 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { + fn on_initialize(_n: BlockNumberFor) -> Weight { + // Account for on_finalize weight + Weight::zero().saturating_add(T::DbWeight::get().reads(1)) + } + #[cfg(feature = "try-runtime")] fn try_state(_n: BlockNumberFor) -> Result<(), sp_runtime::TryRuntimeError> { use {scale_info::prelude::format, sp_std::collections::btree_set::BTreeSet}; @@ -416,6 +442,12 @@ pub mod pallet { Ok(()) } + + fn on_finalize(_: BlockNumberFor) { + if let Some(para_id) = BufferedParasToDeregister::::take().pop() { + T::InnerRegistrar::deregister(para_id); + } + } } #[pallet::call] @@ -825,6 +857,14 @@ pub mod pallet { Self::deposit_event(Event::ParaIdDeregistered { para_id }); // Cleanup immediately Self::cleanup_deregistered_para_id(para_id); + if let Err(id) = BufferedParasToDeregister::::try_mutate(|v| v.try_push(para_id)) + { + log::error!( + target: LOG_TARGET, + "Failed to add paraId {:?} to deregistration list", + id + ); + } } else { Self::schedule_paused_parachain_change(|para_ids, paused| { // We have to find out where, in the sorted vec the para id is, if anywhere. @@ -1168,6 +1208,15 @@ pub mod pallet { for para_id in new_paras { Self::cleanup_deregistered_para_id(*para_id); removed_para_ids.insert(*para_id); + if let Err(id) = + BufferedParasToDeregister::::try_mutate(|v| v.try_push(*para_id)) + { + log::error!( + target: LOG_TARGET, + "Failed to add paraId {:?} to deregistration list", + id + ); + } } } @@ -1210,7 +1259,6 @@ pub mod pallet { ParaManager::::remove(para_id); T::RegistrarHooks::para_deregistered(para_id); - T::InnerRegistrar::deregister(para_id); } fn schedule_parachain_cleanup(para_id: ParaId) -> DispatchResult { From dca620e40e176904b773e30ec45c1a0865d1e6c6 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 16:28:09 -0700 Subject: [PATCH 12/51] fix deregistration rust test --- .../runtime/starlight/src/tests/common/mod.rs | 3 ++- .../starlight/src/tests/relay_registrar.rs | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/common/mod.rs b/solo-chains/runtime/starlight/src/tests/common/mod.rs index fad74d04c..0fe3d76bf 100644 --- a/solo-chains/runtime/starlight/src/tests/common/mod.rs +++ b/solo-chains/runtime/starlight/src/tests/common/mod.rs @@ -58,7 +58,7 @@ use { pub use crate::{ genesis_config_presets::get_authority_keys_from_seed, AccountId, AuthorNoting, Babe, Balance, - Grandpa, Initializer, Runtime, Session, System, TanssiAuthorityAssignment, + ContainerRegistrar, Grandpa, Initializer, Runtime, Session, System, TanssiAuthorityAssignment, TanssiCollatorAssignment, TransactionPayment, }; @@ -221,6 +221,7 @@ pub fn end_block() { Session::on_finalize(System::block_number()); Initializer::on_finalize(System::block_number()); TransactionPayment::on_finalize(System::block_number()); + ContainerRegistrar::on_finalize(System::block_number()); } pub fn run_block() { diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index b8528283e..41297a908 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -17,8 +17,7 @@ #![cfg(test)] use { - crate::tests::common::*, - crate::{Configuration, ContainerRegistrar, Paras, Registrar, System}, + crate::{tests::common::*, Configuration, ContainerRegistrar, Paras, Registrar, System}, frame_support::{assert_noop, assert_ok}, pallet_registrar::Event as ContainerRegistrarEvent, pallet_registrar_runtime_api::{ @@ -351,6 +350,13 @@ fn deregister_calls_schedule_para_cleanup() { Configuration::set_max_head_data_size(root_origin(), 20500), () ); + + // Call end_block() to ensure that parachains_shared::CurrentSessionIndex + // storage gets updated properly inside on_finalize() and + // matches the one inside pallet_session::CurrentIndex. + end_block(); + start_block(); + run_to_session(4u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, @@ -376,6 +382,8 @@ fn deregister_calls_schedule_para_cleanup() { ), () ); + end_block(); + start_block(); // Now let's check if the para was preoperly registered in the relay. // Run to next session. @@ -389,6 +397,9 @@ fn deregister_calls_schedule_para_cleanup() { root_origin(), validation_code.into() )); + end_block(); + start_block(); + run_to_session(7); // Now the para should be a parathread. @@ -401,6 +412,8 @@ fn deregister_calls_schedule_para_cleanup() { ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), () ); + end_block(); + start_block(); // The change should be applied after 2 sessions. run_to_session(9); @@ -422,8 +435,12 @@ fn deregister_calls_schedule_para_cleanup() { } .into(), ); + end_block(); + start_block(); run_to_session(11); + end_block(); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); // Para should be offboarding after 2 sessions. From 749b44fed55548861a9c250383e3717f6c29d61d Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 16:28:31 -0700 Subject: [PATCH 13/51] TS tests now working --- .../dev-tanssi-relay/registrar/test_registrars.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts index a5a548f5b..251f339db 100644 --- a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts +++ b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts @@ -4,7 +4,7 @@ import { KeyringPair } from "@moonwall/util"; import { jumpSessions } from "../../../util/block"; describeSuite({ - id: "DT0107", + id: "DT0102", title: "ContainerRegistrar <> relay Registrar", foundationMethods: "dev", testCases: ({ it, context }) => { @@ -129,23 +129,18 @@ describeSuite({ const isParachain = await polkadotJs.query.paras.paraLifecycles(2002); expect(isParachain.toString()).to.eq("Parachain"); - const onChainGenesisDataBefore = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); - console.log("ON CHAIN GEN: ", onChainGenesisDataBefore.toHuman()); - const tx = polkadotJs.tx.containerRegistrar.deregister(2002); await context.createBlock([await polkadotJs.tx.sudo.sudo(tx).signAsync(alice)], { allowFailures: false, }); await jumpSessions(context, 2); - await context.createBlock(); // Check that the on chain genesis data is now empty - const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); - expect(onChainGenesisData).to.be.null; + const onChainGenesisDataAfter = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); + expect(onChainGenesisDataAfter.toHuman()).to.be.null; // Para should be offboarding - // TODO: check why this is failing and not behaving the same as in rust tests const isOffboarding = await polkadotJs.query.paras.paraLifecycles(2002); expect(isOffboarding.toString()).to.eq("OffboardingParathread"); }, From b9c069ab8027eaaca10d227376b0787af8751a78 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 16:32:31 -0700 Subject: [PATCH 14/51] fmt --- pallets/registrar/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index c508b98f7..585f94f9e 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -232,7 +232,7 @@ pub mod pallet { ValueQuery, >; - /// This storage aims to act as a 'buffer' for paraIds that must be deregistered at the + /// This storage aims to act as a 'buffer' for paraIds that must be deregistered at the /// end of the block execution by calling 'T::InnerRegistrar::deregister()' implementation. /// /// We need this buffer because when we are using this pallet on a relay-chain environment From f0d0decab41a49392ecbfaedd502452e6f77ffa2 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 22 Aug 2024 16:34:31 -0700 Subject: [PATCH 15/51] TS lint --- test/suites/dev-tanssi-relay/registrar/test_registrars.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts index 251f339db..8b1e04689 100644 --- a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts +++ b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts @@ -114,7 +114,7 @@ describeSuite({ // Check we can't register via relay Registrar const tx2 = polkadotJs.tx.registrar.register(2002, "0x", "0x0102030405060708091011").signAsync(alice); - let { result: result2 } = await context.createBlock([tx2]); + const { result: result2 } = await context.createBlock([tx2]); expect(result2[0].successful).to.be.false; expect(result2[0].error.section).to.eq("registrar"); expect(result2[0].error.name).to.eq("AlreadyRegistered"); From 7a92da109dd58fdfdc8b389695c532080712521b Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 23 Aug 2024 06:04:51 -0700 Subject: [PATCH 16/51] use run_block() instead --- .../starlight/src/tests/relay_registrar.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 41297a908..586eaba94 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -351,11 +351,10 @@ fn deregister_calls_schedule_para_cleanup() { () ); - // Call end_block() to ensure that parachains_shared::CurrentSessionIndex + // Call run_block() to ensure that parachains_shared::CurrentSessionIndex // storage gets updated properly inside on_finalize() and // matches the one inside pallet_session::CurrentIndex. - end_block(); - start_block(); + run_block(); run_to_session(4u32); assert_eq!( @@ -382,8 +381,7 @@ fn deregister_calls_schedule_para_cleanup() { ), () ); - end_block(); - start_block(); + run_block(); // Now let's check if the para was preoperly registered in the relay. // Run to next session. @@ -397,8 +395,7 @@ fn deregister_calls_schedule_para_cleanup() { root_origin(), validation_code.into() )); - end_block(); - start_block(); + run_block(); run_to_session(7); @@ -412,8 +409,7 @@ fn deregister_calls_schedule_para_cleanup() { ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), () ); - end_block(); - start_block(); + run_block(); // The change should be applied after 2 sessions. run_to_session(9); @@ -435,8 +431,7 @@ fn deregister_calls_schedule_para_cleanup() { } .into(), ); - end_block(); - start_block(); + run_block(); run_to_session(11); end_block(); From 88c54c905564b35ca4db881c0d94959530a62b76 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 23 Aug 2024 06:15:05 -0700 Subject: [PATCH 17/51] at the end run_block is not needed in test --- .../runtime/starlight/src/tests/relay_registrar.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 586eaba94..0c0339d8a 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -351,11 +351,6 @@ fn deregister_calls_schedule_para_cleanup() { () ); - // Call run_block() to ensure that parachains_shared::CurrentSessionIndex - // storage gets updated properly inside on_finalize() and - // matches the one inside pallet_session::CurrentIndex. - run_block(); - run_to_session(4u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, @@ -381,7 +376,6 @@ fn deregister_calls_schedule_para_cleanup() { ), () ); - run_block(); // Now let's check if the para was preoperly registered in the relay. // Run to next session. @@ -395,7 +389,6 @@ fn deregister_calls_schedule_para_cleanup() { root_origin(), validation_code.into() )); - run_block(); run_to_session(7); @@ -409,7 +402,6 @@ fn deregister_calls_schedule_para_cleanup() { ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), () ); - run_block(); // The change should be applied after 2 sessions. run_to_session(9); @@ -431,7 +423,6 @@ fn deregister_calls_schedule_para_cleanup() { } .into(), ); - run_block(); run_to_session(11); end_block(); From 2f0a142be0c68c02c15fef5aa01c3f7de99f174a Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 23 Aug 2024 06:29:50 -0700 Subject: [PATCH 18/51] PR suggestions in pallet_registrar --- pallets/registrar/src/lib.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 585f94f9e..105ff900f 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -337,6 +337,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { fn on_initialize(_n: BlockNumberFor) -> Weight { + // TODO: account proper weight here // Account for on_finalize weight Weight::zero().saturating_add(T::DbWeight::get().reads(1)) } @@ -444,7 +445,8 @@ pub mod pallet { } fn on_finalize(_: BlockNumberFor) { - if let Some(para_id) = BufferedParasToDeregister::::take().pop() { + let buffered_paras = BufferedParasToDeregister::::take(); + for para_id in buffered_paras { T::InnerRegistrar::deregister(para_id); } } @@ -857,14 +859,9 @@ pub mod pallet { Self::deposit_event(Event::ParaIdDeregistered { para_id }); // Cleanup immediately Self::cleanup_deregistered_para_id(para_id); - if let Err(id) = BufferedParasToDeregister::::try_mutate(|v| v.try_push(para_id)) - { - log::error!( - target: LOG_TARGET, - "Failed to add paraId {:?} to deregistration list", - id - ); - } + BufferedParasToDeregister::::try_mutate(|v| v.try_push(para_id)).map_err( + |_e| DispatchError::Other("Failed to add paraId to deregistration list: buffer is full"), + )?; } else { Self::schedule_paused_parachain_change(|para_ids, paused| { // We have to find out where, in the sorted vec the para id is, if anywhere. From ea7e01867e846dcbcb92852d9089b0db7e402b5c Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 23 Aug 2024 06:35:12 -0700 Subject: [PATCH 19/51] add comment --- solo-chains/runtime/starlight/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 785bb986a..a2f1b9df0 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1490,6 +1490,7 @@ parameter_types! { pub const DepositAmount: Balance = 100 * UNITS; #[derive(Clone)] pub const MaxLengthParaIds: u32 = 100u32; + // This value should match the maximum allowed for max_head_data_size pub const MaxEncodedGenesisDataSize: u32 = 1_000_000u32; // 1MB } From 427d0483a806ab6bca0bcaec4e6d510f33bb4c72 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 23 Aug 2024 08:56:13 -0700 Subject: [PATCH 20/51] account for proper weight inside on_initialize() --- pallets/registrar/src/lib.rs | 9 +++++++-- primitives/traits/src/lib.rs | 7 +++++-- solo-chains/runtime/starlight/src/lib.rs | 20 ++++++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 105ff900f..2aef64ae4 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -337,9 +337,14 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { fn on_initialize(_n: BlockNumberFor) -> Weight { - // TODO: account proper weight here // Account for on_finalize weight - Weight::zero().saturating_add(T::DbWeight::get().reads(1)) + let mut weight = Weight::zero().saturating_add(T::DbWeight::get().reads(1)); + + let buffered_paras = BufferedParasToDeregister::::get(); + for _para_id in buffered_paras { + weight += T::InnerRegistrar::deregister_weight(); + } + weight } #[cfg(feature = "try-runtime")] diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 33ff68334..ee60ab8fd 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -379,7 +379,8 @@ pub trait RegistrarHandler { fn schedule_para_upgrade(id: ParaId) -> DispatchResult; fn schedule_para_downgrade(id: ParaId) -> DispatchResult; - fn deregister(id: ParaId) -> Weight; + fn deregister(id: ParaId); + fn deregister_weight() -> Weight; } impl RegistrarHandler for () { @@ -399,7 +400,9 @@ impl RegistrarHandler for () { Ok(()) } - fn deregister(_id: ParaId) -> Weight { + fn deregister(_id: ParaId){} + + fn deregister_weight() -> Weight { Weight::default() } } diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index a2f1b9df0..00e748b33 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -21,7 +21,7 @@ #![recursion_limit = "512"] // Fix compile error in impl_runtime_weights! macro -use runtime_common as polkadot_runtime_common; +use runtime_common::{self as polkadot_runtime_common}; use { authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId, @@ -1494,13 +1494,14 @@ parameter_types! { pub const MaxEncodedGenesisDataSize: u32 = 1_000_000u32; // 1MB } -pub struct InnerStarlightRegistrar( - PhantomData<(AccountId, RegistrarManager)>, +pub struct InnerStarlightRegistrar( + PhantomData<(AccountId, RegistrarManager, RegistrarWeightInfo)>, ); -impl RegistrarHandler - for InnerStarlightRegistrar +impl RegistrarHandler + for InnerStarlightRegistrar where RegistrarManager: RegistrarInterface, + RegistrarWeightInfo: paras_registrar::WeightInfo { fn register( who: AccountId, @@ -1540,7 +1541,7 @@ where Ok(()) } - fn deregister(id: ParaId) -> Weight { + fn deregister(id: ParaId) { if let Err(e) = RegistrarManager::deregister(id) { log::warn!( "Failed to deregister para id {} in relay chain: {:?}", @@ -1548,8 +1549,10 @@ where e, ); } + } - Weight::default() + fn deregister_weight() -> Weight { + RegistrarWeightInfo::deregister() } } @@ -1568,7 +1571,8 @@ impl pallet_registrar::Config for Runtime { type DepositAmount = DepositAmount; type RegistrarHooks = StarlightRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; - type InnerRegistrar = InnerStarlightRegistrar; + // TODO: replace TestWeightInfo when we use proper weights on paras_registrar + type InnerRegistrar = InnerStarlightRegistrar; type WeightInfo = pallet_registrar::weights::SubstrateWeight; } From c0b4efe5fd542d3e166505c908111f3085bc1d0f Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Sat, 24 Aug 2024 12:18:16 -0700 Subject: [PATCH 21/51] add test for deregistering two paras --- .../starlight/src/tests/relay_registrar.rs | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 0c0339d8a..d5a2ad02f 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -435,3 +435,156 @@ fn deregister_calls_schedule_para_cleanup() { .is_offboarding()); }); } + +#[test] +fn deregister_two_paras_in_the_same_block() { + ExtBuilder::default() + .with_para_ids(vec![ + (1001, empty_genesis_data(), u32::MAX, u32::MAX).into(), + (1002, empty_genesis_data(), u32::MAX, u32::MAX).into(), + ]) + .build() + .execute_with(|| { + // In this test we're gonna check that when calling ContainerRegistrar::deregister(), + // two paraIds are properly offboarded from the relay. + + assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + assert_eq!(Runtime::genesis_data(1004.into()).as_ref(), None); + run_to_session(1u32); + + // Change max_head_data_size config. + assert_ok!( + Configuration::set_max_head_data_size(root_origin(), 20500), + () + ); + + run_to_session(4u32); + assert_eq!( + parachains_configuration::ActiveConfig::::get().max_head_data_size, + 20500 + ); + + let validation_code = + vec![1u8; cumulus_primitives_core::relay_chain::MIN_CODE_SIZE as usize]; + let genesis_data_1003_and_1004 = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + + // Register paraId 1003 + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1003.into(), + genesis_data_1003_and_1004.clone() + ), + () + ); + + // Register paraId 1004 + assert_ok!( + ContainerRegistrar::register( + origin_of(ALICE.into()), + 1004.into(), + genesis_data_1003_and_1004.clone() + ), + () + ); + + // Now let's check if the paras were preoperly registered in the relay. + // Run to next session. + run_to_session(5); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be onboarding") + .is_onboarding()); + + assert!(Paras::lifecycle(1004.into()) + .expect("para should be onboarding") + .is_onboarding()); + + // We need to accept the validation code, so that paras are onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + validation_code.into() + )); + + run_to_session(7); + + // Now paras should be parathreads. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parathread") + .is_parathread()); + assert!(Paras::lifecycle(1004.into()) + .expect("para should be parathread") + .is_parathread()); + + // Call mark_valid_for_collating. + assert_ok!( + ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), + () + ); + + assert_ok!( + ContainerRegistrar::mark_valid_for_collating(root_origin(), 1004.into()), + () + ); + + // The change should be applied after 2 sessions. + run_to_session(9); + assert!(Paras::lifecycle(1003.into()) + .expect("para should be parachain") + .is_parachain()); + + assert!(Paras::lifecycle(1004.into()) + .expect("para should be parachain") + .is_parachain()); + + assert_eq!( + Runtime::genesis_data(1003.into()).as_ref(), + Some(&genesis_data_1003_and_1004) + ); + + assert_eq!( + Runtime::genesis_data(1004.into()).as_ref(), + Some(&genesis_data_1003_and_1004) + ); + + assert_ok!(ContainerRegistrar::deregister(root_origin(), 1003.into())); + + // Assert that the ParaIdDeregistered event was properly deposited + System::assert_last_event( + ContainerRegistrarEvent::ParaIdDeregistered { + para_id: 1003.into(), + } + .into(), + ); + + assert_ok!(ContainerRegistrar::deregister(root_origin(), 1004.into())); + System::assert_last_event( + ContainerRegistrarEvent::ParaIdDeregistered { + para_id: 1004.into(), + } + .into(), + ); + + run_to_session(11); + end_block(); + + assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); + assert_eq!(Runtime::genesis_data(1004.into()).as_ref(), None); + + // Paras should be offboarding after 2 sessions. + assert!(Paras::lifecycle(1003.into()) + .expect("para should be offboarding") + .is_offboarding()); + + assert!(Paras::lifecycle(1004.into()) + .expect("para should be offboarding") + .is_offboarding()); + }); +} From 146ec2dfb7c5e78578d72bb15ce48cfa75a295fd Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Sat, 24 Aug 2024 12:18:30 -0700 Subject: [PATCH 22/51] fmt --- pallets/registrar/src/lib.rs | 6 +++++- primitives/traits/src/lib.rs | 2 +- solo-chains/runtime/starlight/src/lib.rs | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 2aef64ae4..19825b657 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -865,7 +865,11 @@ pub mod pallet { // Cleanup immediately Self::cleanup_deregistered_para_id(para_id); BufferedParasToDeregister::::try_mutate(|v| v.try_push(para_id)).map_err( - |_e| DispatchError::Other("Failed to add paraId to deregistration list: buffer is full"), + |_e| { + DispatchError::Other( + "Failed to add paraId to deregistration list: buffer is full", + ) + }, )?; } else { Self::schedule_paused_parachain_change(|para_ids, paused| { diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index ee60ab8fd..54cf023e6 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -400,7 +400,7 @@ impl RegistrarHandler for () { Ok(()) } - fn deregister(_id: ParaId){} + fn deregister(_id: ParaId) {} fn deregister_weight() -> Weight { Weight::default() diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 00e748b33..0ab89b7b0 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1501,7 +1501,7 @@ impl RegistrarHandler where RegistrarManager: RegistrarInterface, - RegistrarWeightInfo: paras_registrar::WeightInfo + RegistrarWeightInfo: paras_registrar::WeightInfo, { fn register( who: AccountId, @@ -1572,7 +1572,8 @@ impl pallet_registrar::Config for Runtime { type RegistrarHooks = StarlightRegistrarHooks; type RuntimeHoldReason = RuntimeHoldReason; // TODO: replace TestWeightInfo when we use proper weights on paras_registrar - type InnerRegistrar = InnerStarlightRegistrar; + type InnerRegistrar = + InnerStarlightRegistrar; type WeightInfo = pallet_registrar::weights::SubstrateWeight; } From 4edc2ff3ef6c8425c1ba672e6dd1660f79090050 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 27 Aug 2024 16:30:19 -0700 Subject: [PATCH 23/51] make all trait functions to behave as hooks --- pallets/registrar/src/lib.rs | 6 +-- primitives/traits/src/lib.rs | 18 ++++---- solo-chains/runtime/starlight/src/lib.rs | 52 +++++++++++++++++++----- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 19825b657..6c28d0818 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -839,7 +839,7 @@ pub mod pallet { // Hold the deposit, we verified we can do this T::Currency::hold(&HoldReason::RegistrarDeposit.into(), &account, deposit)?; - T::InnerRegistrar::register(account.clone(), para_id, genesis_data.clone().storage)?; + T::InnerRegistrar::register(account.clone(), para_id, genesis_data.clone().storage); // Update DepositInfo RegistrarDeposit::::insert( @@ -896,7 +896,7 @@ pub mod pallet { })?; // Mark this para id for cleanup later Self::schedule_parachain_cleanup(para_id)?; - T::InnerRegistrar::schedule_para_downgrade(para_id)?; + T::InnerRegistrar::schedule_para_downgrade(para_id); Self::deposit_event(Event::ParaIdDeregistered { para_id }); } @@ -933,7 +933,7 @@ pub mod pallet { T::RegistrarHooks::para_marked_valid_for_collating(para_id); - T::InnerRegistrar::schedule_para_upgrade(para_id)?; + T::InnerRegistrar::schedule_para_upgrade(para_id); Ok(()) } diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 54cf023e6..9c606aaee 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -375,10 +375,10 @@ pub trait RegistrarHandler { who: AccountId, id: ParaId, genesis_storage: Vec, - ) -> DispatchResult; + ) -> Weight; - fn schedule_para_upgrade(id: ParaId) -> DispatchResult; - fn schedule_para_downgrade(id: ParaId) -> DispatchResult; + fn schedule_para_upgrade(id: ParaId) -> Weight; + fn schedule_para_downgrade(id: ParaId) -> Weight; fn deregister(id: ParaId); fn deregister_weight() -> Weight; } @@ -388,16 +388,16 @@ impl RegistrarHandler for () { _who: AccountId, _id: ParaId, _genesis_storage: Vec, - ) -> DispatchResult { - Ok(()) + ) -> Weight { + Weight::default() } - fn schedule_para_upgrade(_id: ParaId) -> DispatchResult { - Ok(()) + fn schedule_para_upgrade(_id: ParaId) -> Weight { + Weight::default() } - fn schedule_para_downgrade(_id: ParaId) -> DispatchResult { - Ok(()) + fn schedule_para_downgrade(_id: ParaId) -> Weight { + Weight::default() } fn deregister(_id: ParaId) {} diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 0ab89b7b0..dc97f8f33 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1507,8 +1507,18 @@ where who: AccountId, id: ParaId, genesis_storage: Vec, - ) -> DispatchResult { - // Build HeadData + ) -> Weight { + /* // Build HeadData + let mut genesis_head = HeadData(vec![]); + if let Some(data) = head_data { + genesis_head = HeadData(data); + } else { + log::warn!( + "Failed to register para id {} in relay chain: HeadData not specified!", + u32::from(id), + ); + } */ + let key_values: Vec<(Vec, Vec)> = genesis_storage.into_iter().map(|x| x.into()).collect(); let genesis_head = HeadData(key_values.encode()); @@ -1521,24 +1531,46 @@ where if let Some((_, code)) = kv_code { // Build ValidationCode let validation_code = ValidationCode(code); - RegistrarManager::register(who, id, genesis_head, validation_code) + if let Err(e) = RegistrarManager::register(who, id, genesis_head, validation_code) { + log::warn!( + "Failed to register para id {} in relay chain: {:?}", + u32::from(id), + e + ); + } } else { - return Err(DispatchError::Other("Code not found")); + log::warn!( + "Failed to register para id {} in relay chain: Code not found", + u32::from(id), + ); } + Weight::default() } - fn schedule_para_upgrade(id: ParaId) -> DispatchResult { + fn schedule_para_upgrade(id: ParaId) -> Weight { if !RegistrarManager::is_parachain(id) { - return RegistrarManager::make_parachain(id); + if let Err(e) = RegistrarManager::make_parachain(id) { + log::warn!( + "Failed to upgrade para id {} in relay chain: {:?}", + u32::from(id), + e + ); + } } - Ok(()) + Weight::default() } - fn schedule_para_downgrade(id: ParaId) -> DispatchResult { + fn schedule_para_downgrade(id: ParaId) -> Weight { if !RegistrarManager::is_parathread(id) { - return RegistrarManager::make_parathread(id); + if let Err(e) = RegistrarManager::make_parathread(id) { + log::warn!( + "Failed to downgrade para id {} in relay chain: {:?}", + u32::from(id), + e + ); + } } - Ok(()) + Weight::default() } fn deregister(id: ParaId) { From 4f0a4a5eacd6fa7b0167557f95bba551dbdb64e5 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 27 Aug 2024 16:32:11 -0700 Subject: [PATCH 24/51] set MaxGenesisDataSize to 5MB again --- solo-chains/runtime/starlight/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index dc97f8f33..3c76d7481 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1490,8 +1490,7 @@ parameter_types! { pub const DepositAmount: Balance = 100 * UNITS; #[derive(Clone)] pub const MaxLengthParaIds: u32 = 100u32; - // This value should match the maximum allowed for max_head_data_size - pub const MaxEncodedGenesisDataSize: u32 = 1_000_000u32; // 1MB + pub const MaxEncodedGenesisDataSize: u32 = 5_000_000u32; // 5MB } pub struct InnerStarlightRegistrar( From 2299e619e7e82c99fc538bf299759317cecb8cdd Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 27 Aug 2024 17:31:00 -0700 Subject: [PATCH 25/51] add head_data param to register functions --- pallets/registrar/src/lib.rs | 18 +++++++-- primitives/traits/src/lib.rs | 2 + solo-chains/runtime/starlight/src/lib.rs | 50 +++++++++++++----------- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 6c28d0818..49043f510 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -43,6 +43,7 @@ pub use weights::WeightInfo; pub use pallet::*; use { + cumulus_primitives_core::relay_chain::HeadData, dp_chain_state_snapshot::GenericStateProof, dp_container_chain_genesis_data::ContainerChainGenesisData, frame_support::{ @@ -466,9 +467,10 @@ pub mod pallet { origin: OriginFor, para_id: ParaId, genesis_data: ContainerChainGenesisData, + head_data: Option, ) -> DispatchResult { let account = ensure_signed(origin)?; - Self::do_register(account, para_id, genesis_data)?; + Self::do_register(account, para_id, genesis_data, head_data)?; Self::deposit_event(Event::ParaIdRegistered { para_id }); Ok(()) @@ -572,9 +574,10 @@ pub mod pallet { para_id: ParaId, slot_frequency: SlotFrequency, genesis_data: ContainerChainGenesisData, + head_data: Option, ) -> DispatchResult { let account = ensure_signed(origin)?; - Self::do_register(account, para_id, genesis_data)?; + Self::do_register(account, para_id, genesis_data, head_data)?; // Insert parathread params let params = ParathreadParamsTy { slot_frequency }; ParathreadParams::::insert(para_id, params); @@ -639,6 +642,7 @@ pub mod pallet { relay_storage_proof: sp_trie::StorageProof, manager_signature: cumulus_primitives_core::relay_chain::Signature, genesis_data: ContainerChainGenesisData, + head_data: Option, ) -> DispatchResult { let account = T::RegisterWithRelayProofOrigin::ensure_origin(origin)?; let relay_storage_root = @@ -667,7 +671,7 @@ pub mod pallet { return Err(Error::::InvalidRelayManagerSignature.into()); } - Self::do_register(account, para_id, genesis_data)?; + Self::do_register(account, para_id, genesis_data, head_data)?; // Insert parathread params if let Some(parathread_params) = parathread_params { ParathreadParams::::insert(para_id, parathread_params); @@ -801,6 +805,7 @@ pub mod pallet { account: T::AccountId, para_id: ParaId, genesis_data: ContainerChainGenesisData, + head_data: Option, ) -> DispatchResult { let deposit = T::DepositAmount::get(); // Verify we can hold @@ -839,7 +844,12 @@ pub mod pallet { // Hold the deposit, we verified we can do this T::Currency::hold(&HoldReason::RegistrarDeposit.into(), &account, deposit)?; - T::InnerRegistrar::register(account.clone(), para_id, genesis_data.clone().storage); + T::InnerRegistrar::register( + account.clone(), + para_id, + genesis_data.clone().storage, + head_data, + ); // Update DepositInfo RegistrarDeposit::::insert( diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 9c606aaee..b79db9fef 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -375,6 +375,7 @@ pub trait RegistrarHandler { who: AccountId, id: ParaId, genesis_storage: Vec, + head_data: Option, ) -> Weight; fn schedule_para_upgrade(id: ParaId) -> Weight; @@ -388,6 +389,7 @@ impl RegistrarHandler for () { _who: AccountId, _id: ParaId, _genesis_storage: Vec, + _head_data: Option, ) -> Weight { Weight::default() } diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 3c76d7481..55296a239 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1506,43 +1506,47 @@ where who: AccountId, id: ParaId, genesis_storage: Vec, + head_data: Option, ) -> Weight { - /* // Build HeadData - let mut genesis_head = HeadData(vec![]); - if let Some(data) = head_data { - genesis_head = HeadData(data); - } else { - log::warn!( - "Failed to register para id {} in relay chain: HeadData not specified!", - u32::from(id), - ); - } */ + // Return early if head_data is not specified + let genesis_head = match head_data { + Some(data) => data, + None => { + log::warn!( + "Failed to register para id {} in relay chain: HeadData not specified!", + u32::from(id), + ); + return Weight::default(); + } + }; let key_values: Vec<(Vec, Vec)> = - genesis_storage.into_iter().map(|x| x.into()).collect(); - let genesis_head = HeadData(key_values.encode()); + genesis_storage.into_iter().map(Into::into).collect(); // Check if the wasm code is present in storage - let kv_code = key_values + let validation_code = match key_values .into_iter() - .find(|kv| kv.0 == StorageWellKnownKeys::CODE.to_vec()); - - if let Some((_, code)) = kv_code { - // Build ValidationCode - let validation_code = ValidationCode(code); - if let Err(e) = RegistrarManager::register(who, id, genesis_head, validation_code) { + .find(|(key, _)| key == &StorageWellKnownKeys::CODE.to_vec()) + { + Some((_, code)) => ValidationCode(code), + None => { log::warn!( - "Failed to register para id {} in relay chain: {:?}", + "Failed to register para id {} in relay chain: Code not found", u32::from(id), - e ); + return Weight::default(); } - } else { + }; + + // Try to register the parachain + if let Err(e) = RegistrarManager::register(who, id, genesis_head, validation_code) { log::warn!( - "Failed to register para id {} in relay chain: Code not found", + "Failed to register para id {} in relay chain: {:?}", u32::from(id), + e ); } + Weight::default() } From de0933fe70888ee093995c2c4c5d922b5d4babcf Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 27 Aug 2024 17:31:10 -0700 Subject: [PATCH 26/51] fix tests --- pallets/registrar/src/tests.rs | 135 ++++++++++++------ .../src/tests/common/xcm/core_buyer_common.rs | 3 +- .../dancebox/src/tests/integration_test.rs | 75 ++++++---- .../flashbox/src/tests/integration_test.rs | 75 ++++++---- .../src/tests/collator_assignment_tests.rs | 50 ++++--- .../src/tests/core_scheduling_tests.rs | 3 +- .../starlight/src/tests/integration_test.rs | 4 +- .../starlight/src/tests/relay_registrar.rs | 19 ++- .../starlight/src/tests/services_payment.rs | 3 +- 9 files changed, 248 insertions(+), 119 deletions(-) diff --git a/pallets/registrar/src/tests.rs b/pallets/registrar/src/tests.rs index bf4fccecc..05221092d 100644 --- a/pallets/registrar/src/tests.rs +++ b/pallets/registrar/src/tests.rs @@ -35,7 +35,8 @@ fn register_para_id_42() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Assert that the correct event was deposited System::assert_last_event(Event::ParaIdRegistered { para_id: 42.into() }.into()); @@ -64,13 +65,15 @@ fn register_para_id_42_twice() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_noop!( ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None ), Error::::ParaIdAlreadyRegistered ); @@ -90,7 +93,7 @@ fn register_para_id_42_genesis_data_size_too_big() { properties: Default::default(), }; assert_noop!( - ParaRegistrar::register(RuntimeOrigin::signed(ALICE), 42.into(), genesis_data,), + ParaRegistrar::register(RuntimeOrigin::signed(ALICE), 42.into(), genesis_data, None), Error::::GenesisDataTooBig, ); }); @@ -114,7 +117,8 @@ fn deregister_para_id_42_after_0_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -150,7 +154,8 @@ fn deregister_para_id_42_after_1_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -199,7 +204,8 @@ fn deregister_para_id_42_after_2_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -242,7 +248,8 @@ fn deregister_para_id_42_twice() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -280,6 +287,7 @@ fn deregister_para_id_removes_genesis_data() { RuntimeOrigin::signed(ALICE), 42.into(), genesis_data.clone(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -321,7 +329,7 @@ fn register_para_id_bad_origin() { new_test_ext().execute_with(|| { run_to_block(1); assert_noop!( - ParaRegistrar::register(RuntimeOrigin::root(), 42.into(), empty_genesis_data()), + ParaRegistrar::register(RuntimeOrigin::root(), 42.into(), empty_genesis_data(), None), DispatchError::BadOrigin ); }); @@ -356,7 +364,8 @@ fn pause_para_id_42_works() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Enable the container-chain for the first time @@ -397,7 +406,8 @@ fn pause_para_id_42_twice_fails() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Enable the container-chain for collating @@ -457,7 +467,8 @@ fn unpause_para_id_that_is_not_paused_fails() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Enable the container-chain for collating @@ -488,7 +499,8 @@ fn unpause_para_id_42_twice_fails() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Enable the container-chain for collating @@ -607,7 +619,8 @@ fn register_without_mark_valid_for_collating() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Assert that the correct event was deposited System::assert_last_event(Event::ParaIdRegistered { para_id: 42.into() }.into()); @@ -627,7 +640,8 @@ fn mark_valid_for_collating_twice() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -658,7 +672,8 @@ fn mark_valid_for_collating_already_valid_para_id() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Assert that the correct event was deposited System::assert_last_event(Event::ParaIdRegistered { para_id: 42.into() }.into()); @@ -684,7 +699,8 @@ fn mark_valid_for_collating_calls_registered_hook() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_eq!(Mock::mock().called_hooks, vec![]); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -707,7 +723,8 @@ fn deregister_returns_bond_immediately_if_not_marked_as_valid() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_eq!(Balances::free_balance(ALICE), balance_before - bond); @@ -727,7 +744,8 @@ fn deregister_returns_bond_after_2_sessions_if_marked_as_valid() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -751,7 +769,8 @@ fn can_deregister_before_valid_for_collating() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::deregister(RuntimeOrigin::root(), 42.into(),)); @@ -766,7 +785,8 @@ fn can_deregister_paused_para_id_after_0_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -800,7 +820,8 @@ fn can_deregister_paused_para_id_after_1_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -840,7 +861,8 @@ fn can_deregister_paused_para_id_after_2_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -882,7 +904,8 @@ fn cannot_register_same_para_id_while_deregister_is_pending() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -894,6 +917,7 @@ fn cannot_register_same_para_id_while_deregister_is_pending() { RuntimeOrigin::signed(ALICE), 42.into(), empty_genesis_data(), + None ), Error::::ParaIdAlreadyRegistered, ); @@ -903,6 +927,7 @@ fn cannot_register_same_para_id_while_deregister_is_pending() { RuntimeOrigin::signed(ALICE), 42.into(), empty_genesis_data(), + None ), Error::::ParaIdAlreadyRegistered, ); @@ -910,7 +935,8 @@ fn cannot_register_same_para_id_while_deregister_is_pending() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); }); } @@ -922,7 +948,8 @@ fn register_deregister_register_in_same_block() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_eq!( ParaRegistrar::para_genesis_data(ParaId::from(42)).as_ref(), @@ -945,6 +972,7 @@ fn register_deregister_register_in_same_block() { RuntimeOrigin::signed(ALICE), 42.into(), new_genesis_data.clone(), + None )); assert_eq!( ParaRegistrar::para_genesis_data(ParaId::from(42)).as_ref(), @@ -965,12 +993,14 @@ fn deregister_2_container_chains_in_same_block() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 43.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -1033,12 +1063,14 @@ fn deregister_2_container_chains_in_consecutive_sessions() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 43.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), @@ -1134,7 +1166,8 @@ fn deposit_removed_on_deregister_if_not_marked_as_valid() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert!(ParaRegistrar::para_genesis_data(ParaId::from(42)).is_some()); @@ -1154,7 +1187,8 @@ fn deposit_removed_after_2_sessions_if_marked_as_valid() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1183,7 +1217,8 @@ fn parathread_change_params_after_two_sessions() { RuntimeOrigin::signed(ALICE), 42.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1217,7 +1252,8 @@ fn parathread_params_cannot_be_set_for_parachains() { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1243,7 +1279,8 @@ fn parathread_register_change_params_deregister() { RuntimeOrigin::signed(ALICE), 42.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1279,7 +1316,8 @@ fn parathread_register_deregister_change_params() { RuntimeOrigin::signed(ALICE), 42.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1353,6 +1391,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None )); System::assert_last_event(Event::ParaIdRegistered { para_id: 42.into() }.into()); @@ -1397,6 +1436,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::RelayStorageRootNotFound ); @@ -1447,6 +1487,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::InvalidRelayStorageProof ); @@ -1483,6 +1524,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::InvalidRelayStorageProof ); @@ -1531,6 +1573,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::InvalidRelayManagerSignature ); @@ -1579,6 +1622,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::InvalidRelayStorageProof ); @@ -1629,6 +1673,7 @@ mod register_with_relay_proof { proof, signature, empty_genesis_data(), + None ), Error::::InvalidRelayManagerSignature ); @@ -1647,7 +1692,8 @@ mod deregister_with_relay_proof { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1706,7 +1752,8 @@ mod deregister_with_relay_proof { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_eq!( @@ -1762,7 +1809,8 @@ mod deregister_with_relay_proof { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1795,7 +1843,8 @@ mod deregister_with_relay_proof { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1843,7 +1892,8 @@ mod deregister_with_relay_proof { assert_ok!(ParaRegistrar::register( RuntimeOrigin::signed(ALICE), 42.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert!(ParaRegistrar::registrar_deposit(ParaId::from(42)).is_some()); assert_ok!(ParaRegistrar::mark_valid_for_collating( @@ -1881,7 +1931,8 @@ fn weights_assigned_to_extrinsics_are_correct() { assert_eq!( crate::Call::::register { para_id: 42.into(), - genesis_data: empty_genesis_data() + genesis_data: empty_genesis_data(), + head_data: None } .get_dispatch_info() .weight, diff --git a/runtime/dancebox/src/tests/common/xcm/core_buyer_common.rs b/runtime/dancebox/src/tests/common/xcm/core_buyer_common.rs index 5642ad872..6fece11f9 100644 --- a/runtime/dancebox/src/tests/common/xcm/core_buyer_common.rs +++ b/runtime/dancebox/src/tests/common/xcm/core_buyer_common.rs @@ -224,7 +224,8 @@ pub fn do_test( alice_origin.clone(), PARATHREAD_ID.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(alice_origin, PARATHREAD_ID.into()); let root_origin = ::RuntimeOrigin::root(); diff --git a/runtime/dancebox/src/tests/integration_test.rs b/runtime/dancebox/src/tests/integration_test.rs index bbbccad7e..94859b910 100644 --- a/runtime/dancebox/src/tests/integration_test.rs +++ b/runtime/dancebox/src/tests/integration_test.rs @@ -240,7 +240,8 @@ fn genesis_para_registrar_container_chain_genesis_data_runtime_api() { Registrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + None ), () ); @@ -493,7 +494,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -508,7 +510,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1002.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -578,7 +581,8 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -642,7 +646,8 @@ fn test_paras_registered_but_zero_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -700,7 +705,8 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -779,7 +785,8 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4153,7 +4160,8 @@ fn test_cannot_mark_valid_para_with_no_bootnodes() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_noop!( Registrar::mark_valid_for_collating(root_origin(), 1001.into()), @@ -4217,7 +4225,8 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4257,7 +4266,8 @@ fn test_deregister_and_register_again_does_not_give_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None ),); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4286,7 +4296,8 @@ fn test_deregister_and_register_again_does_not_give_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None ),); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4478,7 +4489,8 @@ fn test_register_parathread() { origin_of(ALICE.into()), 3001.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 3001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4571,7 +4583,8 @@ fn test_ed_plus_block_credit_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4667,7 +4680,8 @@ fn test_ed_plus_block_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4734,7 +4748,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4842,7 +4857,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -4941,7 +4957,8 @@ fn test_block_credits_with_purchase_can_be_combined() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5078,7 +5095,8 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5173,7 +5191,8 @@ fn test_ed_plus_collator_assignment_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5240,7 +5259,8 @@ fn test_collator_assignment_credits_with_purchase_can_be_combined() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5311,7 +5331,8 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5373,7 +5394,8 @@ fn test_migration_services_collator_assignment_payment() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5384,7 +5406,8 @@ fn test_migration_services_collator_assignment_payment() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1002.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -5961,12 +5984,14 @@ fn test_migration_data_preservers_assignments() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(Registrar::register( origin_of(BOB.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Set bootnodes in old storage diff --git a/runtime/flashbox/src/tests/integration_test.rs b/runtime/flashbox/src/tests/integration_test.rs index 84005af93..3d84e0669 100644 --- a/runtime/flashbox/src/tests/integration_test.rs +++ b/runtime/flashbox/src/tests/integration_test.rs @@ -252,7 +252,8 @@ fn genesis_para_registrar_container_chain_genesis_data_runtime_api() { Registrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + None ), () ); @@ -505,7 +506,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -520,7 +522,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1002.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -590,7 +593,8 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -654,7 +658,8 @@ fn test_paras_registered_but_zero_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -712,7 +717,8 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -791,7 +797,8 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2368,7 +2375,8 @@ fn test_cannot_mark_valid_para_with_no_bootnodes() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_noop!( Registrar::mark_valid_for_collating(root_origin(), 1001.into()), @@ -2432,7 +2440,8 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2472,7 +2481,8 @@ fn test_deregister_and_register_again_does_not_give_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None ),); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2501,7 +2511,8 @@ fn test_deregister_and_register_again_does_not_give_free_credits() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None ),); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2541,7 +2552,8 @@ fn test_register_parathread() { origin_of(ALICE.into()), 3001.into(), SlotFrequency { min: 1, max: 1 }, - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 3001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2634,7 +2646,8 @@ fn test_ed_plus_block_credit_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2730,7 +2743,8 @@ fn test_ed_plus_block_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2797,7 +2811,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -2905,7 +2920,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3004,7 +3020,8 @@ fn test_credits_with_purchase_can_be_combined() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3141,7 +3158,8 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3236,7 +3254,8 @@ fn test_ed_plus_collator_assignment_credit_session_minus_1_purchase_fails() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3303,7 +3322,8 @@ fn test_collator_assignment_credits_with_purchase_can_be_combined() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3374,7 +3394,8 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3436,7 +3457,8 @@ fn test_migration_services_collator_assignment_payment() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3447,7 +3469,8 @@ fn test_migration_services_collator_assignment_payment() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); set_dummy_boot_node(origin_of(ALICE.into()), 1002.into()); assert_ok!(Registrar::mark_valid_for_collating( @@ -3936,12 +3959,14 @@ fn test_migration_data_preservers_assignments() { assert_ok!(Registrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(Registrar::register( origin_of(BOB.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // Set bootnodes in old storage diff --git a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs index dc0682a7d..6bedb41d9 100644 --- a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs @@ -22,7 +22,7 @@ use { Balances, CollatorConfiguration, ContainerRegistrar, ServicesPayment, TanssiAuthorityMapping, TanssiInvulnerables, }, - cumulus_primitives_core::ParaId, + cumulus_primitives_core::{relay_chain::HeadData, ParaId}, frame_support::assert_ok, parity_scale_codec::Encode, sp_consensus_aura::AURA_ENGINE_ID, @@ -594,7 +594,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -613,7 +614,8 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -669,7 +671,8 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -717,7 +720,8 @@ fn test_paras_registered_but_zero_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -763,7 +767,8 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -830,7 +835,8 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1001,7 +1007,8 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1037,7 +1044,8 @@ fn test_ed_plus_block_credit_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1122,7 +1130,8 @@ fn test_ed_plus_block_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1178,7 +1187,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1276,7 +1286,8 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1364,7 +1375,8 @@ fn test_credits_with_purchase_can_be_combined() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1422,7 +1434,8 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1505,7 +1518,8 @@ fn test_ed_plus_collator_assignment_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1560,7 +1574,8 @@ fn test_collator_assignment_credits_with_purchase_can_be_combined() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers @@ -1619,7 +1634,8 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + Some(HeadData(vec![1u8, 1u8, 1u8])) )); // TODO: uncomment when we add DataPreservers diff --git a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs index 5ee62f30e..44c6a0f68 100644 --- a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs @@ -522,7 +522,8 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1000.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(ContainerRegistrar::mark_valid_for_collating( root_origin(), diff --git a/solo-chains/runtime/starlight/src/tests/integration_test.rs b/solo-chains/runtime/starlight/src/tests/integration_test.rs index 9ae29f28d..e157ecd93 100644 --- a/solo-chains/runtime/starlight/src/tests/integration_test.rs +++ b/solo-chains/runtime/starlight/src/tests/integration_test.rs @@ -19,6 +19,7 @@ use { crate::tests::common::*, crate::{Balances, CollatorConfiguration, ContainerRegistrar}, + cumulus_primitives_core::relay_chain::HeadData, frame_support::{assert_ok, BoundedVec}, pallet_registrar_runtime_api::{ runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, @@ -201,7 +202,8 @@ fn genesis_para_registrar_container_chain_genesis_data_runtime_api() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index d5a2ad02f..34d2d83c0 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -18,6 +18,7 @@ use { crate::{tests::common::*, Configuration, ContainerRegistrar, Paras, Registrar, System}, + cumulus_primitives_core::relay_chain::HeadData, frame_support::{assert_noop, assert_ok}, pallet_registrar::Event as ContainerRegistrarEvent, pallet_registrar_runtime_api::{ @@ -143,7 +144,8 @@ fn register_para_via_container_registrar() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); @@ -211,7 +213,8 @@ fn cannot_register_para_twice_in_relay() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); @@ -291,7 +294,8 @@ fn mark_valid_for_collating_converts_to_parachain() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); @@ -372,7 +376,8 @@ fn deregister_calls_schedule_para_cleanup() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone() + genesis_data_1003.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); @@ -481,7 +486,8 @@ fn deregister_two_paras_in_the_same_block() { ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003_and_1004.clone() + genesis_data_1003_and_1004.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); @@ -491,7 +497,8 @@ fn deregister_two_paras_in_the_same_block() { ContainerRegistrar::register( origin_of(ALICE.into()), 1004.into(), - genesis_data_1003_and_1004.clone() + genesis_data_1003_and_1004.clone(), + Some(HeadData(vec![1u8, 1u8, 1u8])) ), () ); diff --git a/solo-chains/runtime/starlight/src/tests/services_payment.rs b/solo-chains/runtime/starlight/src/tests/services_payment.rs index 4fbc68e3a..68366ebb9 100644 --- a/solo-chains/runtime/starlight/src/tests/services_payment.rs +++ b/solo-chains/runtime/starlight/src/tests/services_payment.rs @@ -123,7 +123,8 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); // TODO: uncomment when we add DataPreservers From be84061195141dd29af170008d076b57a218a9a4 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 27 Aug 2024 18:49:50 -0700 Subject: [PATCH 27/51] fmt --- primitives/traits/src/lib.rs | 4 +--- solo-chains/runtime/starlight/src/lib.rs | 6 +++--- solo-chains/runtime/starlight/src/tests/common/mod.rs | 4 ++-- .../runtime/starlight/src/tests/integration_test.rs | 8 +++++--- test/suites/dev-tanssi-relay/registrar/test_registrars.ts | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 030d64d7d..85ada356a 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -34,9 +34,7 @@ use { core::marker::PhantomData, frame_support::{ dispatch::DispatchErrorWithPostInfo, - pallet_prelude::{ - Decode, DispatchResult, DispatchResultWithPostInfo, Encode, Get, MaxEncodedLen, Weight, - }, + pallet_prelude::{Decode, DispatchResultWithPostInfo, Encode, Get, MaxEncodedLen, Weight}, BoundedVec, }, serde::{Deserialize, Serialize}, diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index ea39f23a5..d54749a34 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -77,8 +77,8 @@ use { shared as parachains_shared, }, scale_info::TypeInfo, - sp_core::storage::well_known_keys as StorageWellKnownKeys, serde::{Deserialize, Serialize}, + sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, sp_runtime::{traits::BlockNumberProvider, DispatchError}, sp_std::{ @@ -88,8 +88,8 @@ use { prelude::*, }, tp_traits::{ - apply, derive_storage_traits, RegistrarHandler, GetSessionContainerChains, RemoveParaIdsWithNoCredits, Slot, - SlotFrequency, + apply, derive_storage_traits, GetSessionContainerChains, RegistrarHandler, + RemoveParaIdsWithNoCredits, Slot, SlotFrequency, }, }; diff --git a/solo-chains/runtime/starlight/src/tests/common/mod.rs b/solo-chains/runtime/starlight/src/tests/common/mod.rs index 92be952d3..129cf5d2c 100644 --- a/solo-chains/runtime/starlight/src/tests/common/mod.rs +++ b/solo-chains/runtime/starlight/src/tests/common/mod.rs @@ -58,8 +58,8 @@ use { pub use crate::{ genesis_config_presets::get_authority_keys_from_seed, AccountId, AuthorNoting, Babe, Balance, - ContainerRegistrar, DataPreservers, Grandpa, Initializer, Runtime, RuntimeOrigin, Session, System, - TanssiAuthorityAssignment, TanssiCollatorAssignment, TransactionPayment, + ContainerRegistrar, DataPreservers, Grandpa, Initializer, Runtime, RuntimeOrigin, Session, + System, TanssiAuthorityAssignment, TanssiCollatorAssignment, TransactionPayment, }; pub const UNIT: Balance = 1_000_000_000_000_000_000; diff --git a/solo-chains/runtime/starlight/src/tests/integration_test.rs b/solo-chains/runtime/starlight/src/tests/integration_test.rs index 3fc8dca14..7791608ec 100644 --- a/solo-chains/runtime/starlight/src/tests/integration_test.rs +++ b/solo-chains/runtime/starlight/src/tests/integration_test.rs @@ -19,7 +19,7 @@ use { crate::tests::common::*, crate::{Balances, CollatorConfiguration, ContainerRegistrar, DataPreservers}, - cumulus_primitives_core::{ParaId, relay_chain::HeadData}, + cumulus_primitives_core::{relay_chain::HeadData, ParaId}, frame_support::{assert_noop, assert_ok, BoundedVec}, pallet_registrar_runtime_api::{ runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, @@ -301,7 +301,8 @@ fn test_cannot_mark_valid_para_with_no_bootnodes() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data() + empty_genesis_data(), + None )); assert_noop!( ContainerRegistrar::mark_valid_for_collating(root_origin(), 1001.into()), @@ -336,7 +337,8 @@ fn test_container_deregister_unassign_data_preserver() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), para_id, - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(DataPreservers::create_profile( diff --git a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts index 8b1e04689..ea2f1ee80 100644 --- a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts +++ b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts @@ -51,7 +51,7 @@ describeSuite({ const containerChainGenesisData = emptyGenesisData(); const tx = await polkadotJs.tx.containerRegistrar - .register(2002, containerChainGenesisData) + .register(2002, containerChainGenesisData, "0x111") .signAsync(alice); await context.createBlock([tx], { allowFailures: false }); @@ -104,7 +104,7 @@ describeSuite({ // Check we can't register via ContainerRegistrar const tx = await polkadotJs.tx.containerRegistrar - .register(2002, containerChainGenesisData) + .register(2002, containerChainGenesisData, "0x111") .signAsync(alice); const { result } = await context.createBlock([tx]); From 7ebedb7fca1addece3e8ec30219727f745824fed Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 28 Aug 2024 05:15:47 -0700 Subject: [PATCH 28/51] fix build --- solo-chains/runtime/starlight/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index d54749a34..a8fbfeeac 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -80,7 +80,7 @@ use { serde::{Deserialize, Serialize}, sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, - sp_runtime::{traits::BlockNumberProvider, DispatchError}, + sp_runtime::{traits::BlockNumberProvider}, sp_std::{ cmp::Ordering, collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, From 5cc9f782a3ed523dd8b4795c48fd15d9ebd62570 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 28 Aug 2024 05:16:53 -0700 Subject: [PATCH 29/51] fmt --- solo-chains/runtime/starlight/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index a8fbfeeac..4a96e7f88 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -80,7 +80,7 @@ use { serde::{Deserialize, Serialize}, sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, - sp_runtime::{traits::BlockNumberProvider}, + sp_runtime::traits::BlockNumberProvider, sp_std::{ cmp::Ordering, collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, From 8ad6dc31c2c3e72b8b38421345affa996da0c01c Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 28 Aug 2024 08:23:29 -0700 Subject: [PATCH 30/51] make trait functions fallible again --- pallets/registrar/src/lib.rs | 6 +-- primitives/traits/src/lib.rs | 20 +++---- .../dancebox/src/tests/integration_test.rs | 3 +- .../flashbox/src/tests/integration_test.rs | 3 +- solo-chains/runtime/starlight/src/lib.rs | 54 ++++--------------- 5 files changed, 28 insertions(+), 58 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index d3eb38ae2..26a039cca 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -856,7 +856,7 @@ pub mod pallet { para_id, genesis_data.clone().storage, head_data, - ); + )?; // Update DepositInfo RegistrarDeposit::::insert( @@ -913,7 +913,7 @@ pub mod pallet { })?; // Mark this para id for cleanup later Self::schedule_parachain_cleanup(para_id)?; - T::InnerRegistrar::schedule_para_downgrade(para_id); + T::InnerRegistrar::schedule_para_downgrade(para_id)?; Self::deposit_event(Event::ParaIdDeregistered { para_id }); } @@ -950,7 +950,7 @@ pub mod pallet { T::RegistrarHooks::para_marked_valid_for_collating(para_id); - T::InnerRegistrar::schedule_para_upgrade(para_id); + T::InnerRegistrar::schedule_para_upgrade(para_id)?; Ok(()) } diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 85ada356a..dbdbcd0ff 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -42,7 +42,7 @@ use { sp_runtime::{ app_crypto::sp_core, traits::{CheckedAdd, CheckedMul}, - ArithmeticError, + ArithmeticError, DispatchResult }, sp_std::{collections::btree_set::BTreeSet, vec::Vec}, }; @@ -392,10 +392,10 @@ pub trait RegistrarHandler { id: ParaId, genesis_storage: Vec, head_data: Option, - ) -> Weight; + ) -> DispatchResult; - fn schedule_para_upgrade(id: ParaId) -> Weight; - fn schedule_para_downgrade(id: ParaId) -> Weight; + fn schedule_para_upgrade(id: ParaId) -> DispatchResult; + fn schedule_para_downgrade(id: ParaId) -> DispatchResult; fn deregister(id: ParaId); fn deregister_weight() -> Weight; } @@ -406,16 +406,16 @@ impl RegistrarHandler for () { _id: ParaId, _genesis_storage: Vec, _head_data: Option, - ) -> Weight { - Weight::default() + ) -> DispatchResult { + Ok(()) } - fn schedule_para_upgrade(_id: ParaId) -> Weight { - Weight::default() + fn schedule_para_upgrade(_id: ParaId) -> DispatchResult { + Ok(()) } - fn schedule_para_downgrade(_id: ParaId) -> Weight { - Weight::default() + fn schedule_para_downgrade(_id: ParaId) -> DispatchResult { + Ok(()) } fn deregister(_id: ParaId) {} diff --git a/runtime/dancebox/src/tests/integration_test.rs b/runtime/dancebox/src/tests/integration_test.rs index 099ccd1ae..465c435e1 100644 --- a/runtime/dancebox/src/tests/integration_test.rs +++ b/runtime/dancebox/src/tests/integration_test.rs @@ -6175,7 +6175,8 @@ fn test_container_deregister_unassign_data_preserver() { assert_ok!(Registrar::register( origin_of(ALICE.into()), para_id, - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(DataPreservers::create_profile( diff --git a/runtime/flashbox/src/tests/integration_test.rs b/runtime/flashbox/src/tests/integration_test.rs index de69bd218..7e3593aea 100644 --- a/runtime/flashbox/src/tests/integration_test.rs +++ b/runtime/flashbox/src/tests/integration_test.rs @@ -4150,7 +4150,8 @@ fn test_container_deregister_unassign_data_preserver() { assert_ok!(Registrar::register( origin_of(ALICE.into()), para_id, - empty_genesis_data() + empty_genesis_data(), + None )); assert_ok!(DataPreservers::create_profile( diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 4a96e7f88..46648d526 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -80,7 +80,7 @@ use { serde::{Deserialize, Serialize}, sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, - sp_runtime::traits::BlockNumberProvider, + sp_runtime::{traits::BlockNumberProvider, DispatchError}, sp_std::{ cmp::Ordering, collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, @@ -1624,17 +1624,11 @@ where id: ParaId, genesis_storage: Vec, head_data: Option, - ) -> Weight { + ) -> DispatchResult { // Return early if head_data is not specified let genesis_head = match head_data { Some(data) => data, - None => { - log::warn!( - "Failed to register para id {} in relay chain: HeadData not specified!", - u32::from(id), - ); - return Weight::default(); - } + None => return Err(DispatchError::Other("HeadData not specified!")) }; let key_values: Vec<(Vec, Vec)> = @@ -1646,51 +1640,25 @@ where .find(|(key, _)| key == &StorageWellKnownKeys::CODE.to_vec()) { Some((_, code)) => ValidationCode(code), - None => { - log::warn!( - "Failed to register para id {} in relay chain: Code not found", - u32::from(id), - ); - return Weight::default(); - } + None => return Err(DispatchError::Other("Code not found")) }; // Try to register the parachain - if let Err(e) = RegistrarManager::register(who, id, genesis_head, validation_code) { - log::warn!( - "Failed to register para id {} in relay chain: {:?}", - u32::from(id), - e - ); - } - - Weight::default() + RegistrarManager::register(who, id, genesis_head, validation_code) } - fn schedule_para_upgrade(id: ParaId) -> Weight { + fn schedule_para_upgrade(id: ParaId) -> DispatchResult { if !RegistrarManager::is_parachain(id) { - if let Err(e) = RegistrarManager::make_parachain(id) { - log::warn!( - "Failed to upgrade para id {} in relay chain: {:?}", - u32::from(id), - e - ); - } + return RegistrarManager::make_parachain(id); } - Weight::default() + Ok(()) } - fn schedule_para_downgrade(id: ParaId) -> Weight { + fn schedule_para_downgrade(id: ParaId) -> DispatchResult { if !RegistrarManager::is_parathread(id) { - if let Err(e) = RegistrarManager::make_parathread(id) { - log::warn!( - "Failed to downgrade para id {} in relay chain: {:?}", - u32::from(id), - e - ); - } + return RegistrarManager::make_parathread(id); } - Weight::default() + Ok(()) } fn deregister(id: ParaId) { From 59cef344772bc5a691dc20acfcbf7427d05bf31f Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 28 Aug 2024 21:52:33 -0700 Subject: [PATCH 31/51] fix rust tests --- primitives/traits/src/lib.rs | 2 +- solo-chains/runtime/starlight/src/lib.rs | 6 +- .../src/tests/collator_assignment_tests.rs | 315 +++++++++++++----- .../runtime/starlight/src/tests/common/mod.rs | 22 +- .../src/tests/core_scheduling_tests.rs | 52 +-- .../starlight/src/tests/integration_test.rs | 20 +- .../starlight/src/tests/relay_registrar.rs | 7 + .../starlight/src/tests/services_payment.rs | 17 +- 8 files changed, 309 insertions(+), 132 deletions(-) diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index dbdbcd0ff..0f50137c1 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -42,7 +42,7 @@ use { sp_runtime::{ app_crypto::sp_core, traits::{CheckedAdd, CheckedMul}, - ArithmeticError, DispatchResult + ArithmeticError, DispatchResult, }, sp_std::{collections::btree_set::BTreeSet, vec::Vec}, }; diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 46648d526..f0113f208 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1628,7 +1628,7 @@ where // Return early if head_data is not specified let genesis_head = match head_data { Some(data) => data, - None => return Err(DispatchError::Other("HeadData not specified!")) + None => return Err(DispatchError::Other("HeadData not specified!")), }; let key_values: Vec<(Vec, Vec)> = @@ -1640,7 +1640,7 @@ where .find(|(key, _)| key == &StorageWellKnownKeys::CODE.to_vec()) { Some((_, code)) => ValidationCode(code), - None => return Err(DispatchError::Other("Code not found")) + None => return Err(DispatchError::Other("Code not found")), }; // Try to register the parachain @@ -1656,7 +1656,7 @@ where fn schedule_para_downgrade(id: ParaId) -> DispatchResult { if !RegistrarManager::is_parathread(id) { - return RegistrarManager::make_parathread(id); + return RegistrarManager::make_parathread(id); } Ok(()) } diff --git a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs index ff8e1d5ef..6658272ed 100644 --- a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs @@ -19,7 +19,7 @@ use { crate::tests::common::*, crate::{ - Balances, CollatorConfiguration, ContainerRegistrar, ServicesPayment, + Balances, CollatorConfiguration, ContainerRegistrar, Paras, ServicesPayment, TanssiAuthorityMapping, TanssiInvulnerables, }, cumulus_primitives_core::{relay_chain::HeadData, ParaId}, @@ -594,10 +594,21 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( root_origin(), @@ -613,10 +624,13 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1002.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + // Assignment should happen after 2 sessions + run_to_session(6); + set_dummy_boot_node(origin_of(ALICE.into()), 1002.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( root_origin(), @@ -629,12 +643,6 @@ fn test_authors_paras_inserted_a_posteriori() { block_credits_to_required_balance(1000, 1002.into()) )); - // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); - // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -669,10 +677,23 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -686,10 +707,7 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob are now assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); @@ -717,10 +735,23 @@ fn test_paras_registered_but_zero_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -735,10 +766,7 @@ fn test_paras_registered_but_zero_credits() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); @@ -763,10 +791,23 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -788,10 +829,7 @@ fn test_paras_registered_but_not_enough_credits() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None); @@ -803,7 +841,7 @@ fn test_paras_registered_but_not_enough_credits() { credits_1001 + 1 )); - run_to_session(4u32); + run_to_session(8u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -830,10 +868,23 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -855,10 +906,7 @@ fn test_paras_registered_but_only_credits_for_1_session() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -897,7 +945,7 @@ fn test_paras_registered_but_only_credits_for_1_session() { .unwrap_or_default(); assert_eq!(credits, credits_1001 - 1); - run_to_session(4u32); + run_to_session(8u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1001,10 +1049,20 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1037,10 +1095,22 @@ fn test_ed_plus_block_credit_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1064,11 +1134,7 @@ fn test_ed_plus_block_credit_session_purchase_works() { credits_1001 )); - // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1098,7 +1164,7 @@ fn test_ed_plus_block_credit_session_purchase_works() { run_block(); // After this it should not be assigned anymore, since credits are not payable - run_to_session(3u32); + run_to_session(7u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1122,10 +1188,24 @@ fn test_ed_plus_block_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1150,11 +1230,7 @@ fn test_ed_plus_block_credit_session_minus_1_purchase_fails() { credits_1001 )); - // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should not be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1178,10 +1254,24 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1208,11 +1298,7 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1242,7 +1328,7 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { run_block(); // Session 3 should still be assigned - run_to_session(3u32); + run_to_session(7u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1251,7 +1337,7 @@ fn test_reassignment_ed_plus_two_block_credit_session_purchase_works() { ); // After this it should not be assigned anymore, since credits are not payable - run_to_session(4u32); + run_to_session(8u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); @@ -1276,10 +1362,24 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1306,11 +1406,7 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1340,7 +1436,7 @@ fn test_reassignment_ed_plus_two_block_credit_session_minus_1_purchase_fails() { run_block(); // After this it should not be assigned anymore, since credits are not payable - run_to_session(3u32); + run_to_session(7u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1364,10 +1460,23 @@ fn test_credits_with_purchase_can_be_combined() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1392,10 +1501,7 @@ fn test_credits_with_purchase_can_be_combined() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1422,10 +1528,23 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1449,10 +1568,7 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1481,7 +1597,7 @@ fn test_ed_plus_collator_assignment_session_purchase_works() { run_block(); // After this it should not be assigned anymore, since credits are not payable - run_to_session(4u32); + run_to_session(8u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1505,10 +1621,23 @@ fn test_ed_plus_collator_assignment_credit_session_minus_1_purchase_fails() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1533,10 +1662,7 @@ fn test_ed_plus_collator_assignment_credit_session_minus_1_purchase_fails() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); - let assignment = TanssiCollatorAssignment::collator_container_chain(); - assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should not be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); @@ -1560,10 +1686,19 @@ fn test_collator_assignment_credits_with_purchase_can_be_combined() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( @@ -1589,10 +1724,10 @@ fn test_collator_assignment_credits_with_purchase_can_be_combined() { )); // Assignment should happen after 2 sessions - run_to_session(1u32); + run_to_session(5u32); let assignment = TanssiCollatorAssignment::collator_container_chain(); assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1619,10 +1754,21 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) )); + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( root_origin(), @@ -1657,12 +1803,11 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { + block_production_credits + crate::EXISTENTIAL_DEPOSIT )); - - // Assignment should happen after 2 sessions - run_to_session(1u32); let assignment = TanssiCollatorAssignment::collator_container_chain(); assert!(assignment.container_chains.is_empty()); - run_to_session(2u32); + + // Assignment should happen after 2 sessions + run_to_session(6u32); // Alice and Bob should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!( @@ -1671,7 +1816,7 @@ fn test_block_credits_and_collator_assignation_credits_through_tank() { ); // After this it should not be assigned anymore, since credits are not payable - run_to_session(4u32); + run_to_session(8u32); // Nobody should be assigned to para 1001 let assignment = TanssiCollatorAssignment::collator_container_chain(); assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); diff --git a/solo-chains/runtime/starlight/src/tests/common/mod.rs b/solo-chains/runtime/starlight/src/tests/common/mod.rs index 129cf5d2c..f16736698 100644 --- a/solo-chains/runtime/starlight/src/tests/common/mod.rs +++ b/solo-chains/runtime/starlight/src/tests/common/mod.rs @@ -129,6 +129,19 @@ pub fn run_to_block(n: u32) { } } +pub fn get_genesis_data_with_validation_code() -> (ContainerChainGenesisData, Vec) { + let validation_code = mock_validation_code().0; + let genesis_data = ContainerChainGenesisData { + storage: vec![(b":code".to_vec(), validation_code.clone()).into()], + name: Default::default(), + id: Default::default(), + fork_id: Default::default(), + extensions: vec![], + properties: Default::default(), + }; + (genesis_data, validation_code) +} + pub fn insert_authorities_and_slot_digests(slot: u64) { let pre_digest = Digest { logs: vec![DigestItem::PreRuntime( @@ -298,7 +311,12 @@ impl Default for ExtBuilder { sudo: Default::default(), para_ids: Default::default(), config: default_config(), - relay_config: Default::default(), + relay_config: runtime_parachains::configuration::HostConfiguration::< + BlockNumberFor, + > { + max_head_data_size: 20500, + ..Default::default() + }, own_para_id: Default::default(), next_free_para_id: Default::default(), keystore: None, @@ -692,7 +710,7 @@ pub(crate) struct ParasInherentTestBuilder ValidationCode { - ValidationCode(vec![1, 2, 3]) + ValidationCode(vec![1; 10]) } #[allow(dead_code)] diff --git a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs index fd80e9f06..0c7c56d78 100644 --- a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs @@ -17,15 +17,16 @@ #![cfg(test)] use { - crate::tests::common::*, - crate::{ContainerRegistrar, OnDemandAssignmentProvider, Paras, ParasSudoWrapper, Session}, + crate::{ + tests::common::*, ContainerRegistrar, OnDemandAssignmentProvider, Paras, ParasShared, + Session, + }, cumulus_primitives_core::relay_chain::{ - vstaging::SchedulerParams, AsyncBackingParams, CoreIndex, + vstaging::SchedulerParams, AsyncBackingParams, CoreIndex, HeadData, }, frame_support::assert_ok, frame_system::pallet_prelude::BlockNumberFor, primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV11, - runtime_parachains::paras::{ParaGenesisArgs, ParaKind}, sp_core::{Decode, Encode}, sp_keystore::testing::MemoryKeystore, sp_std::{collections::btree_map::BTreeMap, vec}, @@ -508,6 +509,13 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { // this is, 1000 will go first, then 1001. Since we want 1000 to use core 0, // the only way to achieve this is by assigning the parathread a higher para-id run_to_block(2); + + // Coordinate both ParasShared and Session CurrentIndex storages. + // If we don't do this, the one inside ParasShared is configured to + // one session before, and we want the to be the same for later checking in + // session 6. + ParasShared::set_session_index(Session::current_index()); + // Now the parathread should be there assert!(Paras::is_parathread(1001u32.into())); let alice_keys = @@ -522,36 +530,34 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1000.into(), - empty_genesis_data(), - None + get_genesis_data_with_validation_code().0, + Some(HeadData(vec![1u8, 1u8, 1u8])) )); - set_dummy_boot_node(origin_of(ALICE.into()), 1000.into()); - assert_ok!(ContainerRegistrar::mark_valid_for_collating( - root_origin(), - 1000.into() - )); - assert_ok!(ParasSudoWrapper::sudo_schedule_para_initialize( + run_to_session(2); + ParasShared::set_session_index(Session::current_index()); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( root_origin(), - 1000.into(), - ParaGenesisArgs { - genesis_head: ParasInherentTestBuilder::::mock_head_data(), - validation_code: mock_validation_code(), - para_kind: ParaKind::Parachain, - }, + get_genesis_data_with_validation_code().1.into() )); - assert_ok!(Paras::add_trusted_validation_code( + run_to_session(4); + ParasShared::set_session_index(Session::current_index()); + + set_dummy_boot_node(origin_of(ALICE.into()), 1000.into()); + assert_ok!(ContainerRegistrar::mark_valid_for_collating( root_origin(), - mock_validation_code() + 1000.into() )); // The parathread now uses core 0 but once the parachain is onboarded (and gets collators) // it should use core 1. - // let's just go to the block right before edge of session 2. + // let's just go to the block right before edge of session 6. let epoch_duration = EpochDurationInBlocks::get(); - run_to_block(2 * epoch_duration - 1); + run_to_block(6 * epoch_duration - 1); // we are not a parachain yet assert!(!Paras::is_parachain(1000u32.into())); // we dont have authorities @@ -595,7 +601,7 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { // let's run to right after the edge // We need one more run block to trigger the on_finalize - run_to_session(2); + run_to_session(6); run_block(); // Now the parachain should be there assert!(Paras::is_parachain(1000u32.into())); diff --git a/solo-chains/runtime/starlight/src/tests/integration_test.rs b/solo-chains/runtime/starlight/src/tests/integration_test.rs index 7791608ec..1f9c15683 100644 --- a/solo-chains/runtime/starlight/src/tests/integration_test.rs +++ b/solo-chains/runtime/starlight/src/tests/integration_test.rs @@ -190,19 +190,11 @@ fn genesis_para_registrar_container_chain_genesis_data_runtime_api() { assert_eq!(Runtime::genesis_data(1002.into()).as_ref(), Some(&genesis_data_1002), "Deregistered container chain genesis data should not be removed until after 2 sessions"); - let genesis_data_1003 = ContainerChainGenesisData { - storage: vec![(b"key3".to_vec(), b"value3".to_vec()).into()], - name: Default::default(), - id: Default::default(), - fork_id: Default::default(), - extensions: vec![], - properties: Default::default(), - }; assert_ok!( ContainerRegistrar::register( origin_of(ALICE.into()), 1003.into(), - genesis_data_1003.clone(), + get_genesis_data_with_validation_code().0, Some(HeadData(vec![1u8, 1u8, 1u8])) ), () @@ -211,7 +203,7 @@ fn genesis_para_registrar_container_chain_genesis_data_runtime_api() { // Registered container chains are inserted immediately assert_eq!( Runtime::genesis_data(1003.into()).as_ref(), - Some(&genesis_data_1003) + Some(&get_genesis_data_with_validation_code().0) ); // Deregistered container chain genesis data is removed after 2 sessions @@ -301,8 +293,8 @@ fn test_cannot_mark_valid_para_with_no_bootnodes() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), - None + get_genesis_data_with_validation_code().0, + Some(HeadData(vec![1u8, 1u8, 1u8])) )); assert_noop!( ContainerRegistrar::mark_valid_for_collating(root_origin(), 1001.into()), @@ -337,8 +329,8 @@ fn test_container_deregister_unassign_data_preserver() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), para_id, - empty_genesis_data(), - None + get_genesis_data_with_validation_code().0, + Some(HeadData(vec![1u8, 1u8, 1u8])) )); assert_ok!(DataPreservers::create_profile( diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 34d2d83c0..1a0c8a38e 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -319,6 +319,8 @@ fn mark_valid_for_collating_converts_to_parachain() { .expect("para should be parathread") .is_parathread()); + set_dummy_boot_node(origin_of(ALICE.into()), 1003.into()); + // Call mark_valid_for_collating. assert_ok!( ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), @@ -402,6 +404,8 @@ fn deregister_calls_schedule_para_cleanup() { .expect("para should be parathread") .is_parathread()); + set_dummy_boot_node(origin_of(ALICE.into()), 1003.into()); + // Call mark_valid_for_collating. assert_ok!( ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), @@ -530,6 +534,9 @@ fn deregister_two_paras_in_the_same_block() { .expect("para should be parathread") .is_parathread()); + set_dummy_boot_node(origin_of(ALICE.into()), 1003.into()); + set_dummy_boot_node(origin_of(ALICE.into()), 1004.into()); + // Call mark_valid_for_collating. assert_ok!( ContainerRegistrar::mark_valid_for_collating(root_origin(), 1003.into()), diff --git a/solo-chains/runtime/starlight/src/tests/services_payment.rs b/solo-chains/runtime/starlight/src/tests/services_payment.rs index f88673490..3fdc0a3f7 100644 --- a/solo-chains/runtime/starlight/src/tests/services_payment.rs +++ b/solo-chains/runtime/starlight/src/tests/services_payment.rs @@ -18,8 +18,8 @@ use { crate::tests::common::*, - crate::{ContainerRegistrar, ServicesPayment}, - cumulus_primitives_core::ParaId, + crate::{ContainerRegistrar, Paras, ServicesPayment}, + cumulus_primitives_core::{relay_chain::HeadData, ParaId}, frame_support::assert_ok, sp_std::vec, }; @@ -123,10 +123,19 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ContainerRegistrar::register( origin_of(ALICE.into()), 1001.into(), - empty_genesis_data(), - None + get_genesis_data_with_validation_code().0, + Some(HeadData(vec![1u8, 2u8, 3u8])) )); + run_to_session(2); + + // We need to accept the validation code, so that the para is onboarded after 2 sessions. + assert_ok!(Paras::add_trusted_validation_code( + root_origin(), + get_genesis_data_with_validation_code().1.into() + )); + run_to_session(4); + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( From cc6e79241a38fd5e95be36d09e21ef7fd110d471 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 06:52:53 -0700 Subject: [PATCH 32/51] fix dancebox and flashbox TS tests --- .../test_pallet_data_preservers.ts | 15 ++++++++++----- .../registrar/test_registrar_para_manager.ts | 2 +- .../registrar/test_registrar_proxy.ts | 4 ++-- .../registrar/test_registrar_register.ts | 2 +- .../test_registrar_register_parathread.ts | 7 ++++++- .../test_deregister_with_relay_proof.ts | 2 +- .../test_register_with_relay_proof.ts | 3 ++- .../xcm-core-buyer/test_xcm_core_buyer.ts | 7 ++++++- 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/test/suites/common-tanssi/pallet-data-preservers/test_pallet_data_preservers.ts b/test/suites/common-tanssi/pallet-data-preservers/test_pallet_data_preservers.ts index cb72712b6..55a086f3d 100644 --- a/test/suites/common-tanssi/pallet-data-preservers/test_pallet_data_preservers.ts +++ b/test/suites/common-tanssi/pallet-data-preservers/test_pallet_data_preservers.ts @@ -293,7 +293,8 @@ describeSuite({ const registerTx = polkadotJs.tx.registrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + null ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -365,7 +366,8 @@ describeSuite({ const registerTx = polkadotJs.tx.registrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + null ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -437,7 +439,8 @@ describeSuite({ const registerTx = polkadotJs.tx.registrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + null ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -512,7 +515,8 @@ describeSuite({ const registerTx = polkadotJs.tx.registrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + null ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -586,7 +590,8 @@ describeSuite({ const registerTx = polkadotJs.tx.registrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + null ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); diff --git a/test/suites/common-tanssi/registrar/test_registrar_para_manager.ts b/test/suites/common-tanssi/registrar/test_registrar_para_manager.ts index 223be2997..dafbcaf24 100644 --- a/test/suites/common-tanssi/registrar/test_registrar_para_manager.ts +++ b/test/suites/common-tanssi/registrar/test_registrar_para_manager.ts @@ -51,7 +51,7 @@ describeSuite({ const containerChainGenesisData = emptyGenesisData(); await context.createBlock([ - await polkadotJs.tx.registrar.register(paraId, containerChainGenesisData).signAsync(alice), + await polkadotJs.tx.registrar.register(paraId, containerChainGenesisData, null).signAsync(alice), ]); // Bob still not a manager, extrinsic requiring ManagerOrigin should fail diff --git a/test/suites/common-tanssi/registrar/test_registrar_proxy.ts b/test/suites/common-tanssi/registrar/test_registrar_proxy.ts index 19a41ea29..f65e94c57 100644 --- a/test/suites/common-tanssi/registrar/test_registrar_proxy.ts +++ b/test/suites/common-tanssi/registrar/test_registrar_proxy.ts @@ -79,7 +79,7 @@ describeSuite({ const tx2 = polkadotJs.tx.proxy.proxy( bob.address, null, - polkadotJs.tx.registrar.register(2002, containerChainGenesisData) + polkadotJs.tx.registrar.register(2002, containerChainGenesisData, null) ); await context.createBlock([await tx2.signAsync(charlie)]); // Check that the on chain genesis data is set correctly @@ -168,7 +168,7 @@ describeSuite({ }; const containerChainGenesisData = emptyGenesisData(); - const tx2 = polkadotJs.tx.registrar.register(2002, containerChainGenesisData); + const tx2 = polkadotJs.tx.registrar.register(2002, containerChainGenesisData, null); const tx3 = polkadotJs.tx.registrar.markValidForCollating(2002); const nonce = await polkadotJs.rpc.system.accountNextIndex(alice.publicKey); await context.createBlock([ diff --git a/test/suites/common-tanssi/registrar/test_registrar_register.ts b/test/suites/common-tanssi/registrar/test_registrar_register.ts index abeee2f81..658ea485e 100644 --- a/test/suites/common-tanssi/registrar/test_registrar_register.ts +++ b/test/suites/common-tanssi/registrar/test_registrar_register.ts @@ -67,7 +67,7 @@ describeSuite({ }; const containerChainGenesisData = emptyGenesisData(); - const tx = polkadotJs.tx.registrar.register(2002, containerChainGenesisData); + const tx = polkadotJs.tx.registrar.register(2002, containerChainGenesisData, null); const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); const profileTx = polkadotJs.tx.dataPreservers.createProfile({ diff --git a/test/suites/common-tanssi/registrar/test_registrar_register_parathread.ts b/test/suites/common-tanssi/registrar/test_registrar_register_parathread.ts index 359b5e467..028211409 100644 --- a/test/suites/common-tanssi/registrar/test_registrar_register_parathread.ts +++ b/test/suites/common-tanssi/registrar/test_registrar_register_parathread.ts @@ -69,7 +69,12 @@ describeSuite({ }; const containerChainGenesisData = emptyGenesisData(); - const tx = polkadotJs.tx.registrar.registerParathread(2002, slotFrequency, containerChainGenesisData); + const tx = polkadotJs.tx.registrar.registerParathread( + 2002, + slotFrequency, + containerChainGenesisData, + null + ); const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); const tx2 = polkadotJs.tx.dataPreservers.createProfile({ diff --git a/test/suites/dev-tanssi/register-with-relay-proof/test_deregister_with_relay_proof.ts b/test/suites/dev-tanssi/register-with-relay-proof/test_deregister_with_relay_proof.ts index 24c35dd16..6237eadb1 100644 --- a/test/suites/dev-tanssi/register-with-relay-proof/test_deregister_with_relay_proof.ts +++ b/test/suites/dev-tanssi/register-with-relay-proof/test_deregister_with_relay_proof.ts @@ -54,7 +54,7 @@ describeSuite({ }; const containerChainGenesisData = emptyGenesisData(); - const tx = polkadotJs.tx.registrar.register(2003, containerChainGenesisData); + const tx = polkadotJs.tx.registrar.register(2003, containerChainGenesisData, null); const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); const profileTx = polkadotJs.tx.dataPreservers.createProfile({ diff --git a/test/suites/dev-tanssi/register-with-relay-proof/test_register_with_relay_proof.ts b/test/suites/dev-tanssi/register-with-relay-proof/test_register_with_relay_proof.ts index bd7cf5442..4be39a433 100644 --- a/test/suites/dev-tanssi/register-with-relay-proof/test_register_with_relay_proof.ts +++ b/test/suites/dev-tanssi/register-with-relay-proof/test_register_with_relay_proof.ts @@ -102,7 +102,8 @@ describeSuite({ relayProofBlockNumber, relayStorageProof, managerSignature, - containerChainGenesisData + containerChainGenesisData, + null ); const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); diff --git a/test/suites/dev-tanssi/xcm-core-buyer/test_xcm_core_buyer.ts b/test/suites/dev-tanssi/xcm-core-buyer/test_xcm_core_buyer.ts index 7e1251894..d43c7d777 100644 --- a/test/suites/dev-tanssi/xcm-core-buyer/test_xcm_core_buyer.ts +++ b/test/suites/dev-tanssi/xcm-core-buyer/test_xcm_core_buyer.ts @@ -91,7 +91,12 @@ describeSuite({ // Let's disable all other parachains and set parathread collator to 4 // this will make every collator including the one we are registering being assigned to our parathread - const tx = polkadotJs.tx.registrar.registerParathread(2002, slotFrequency, containerChainGenesisData); + const tx = polkadotJs.tx.registrar.registerParathread( + 2002, + slotFrequency, + containerChainGenesisData, + null + ); const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); const profileTx = polkadotJs.tx.dataPreservers.createProfile({ From 150dd7b4ef933b54a1e7687707d49e2b24429b37 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 15:44:19 -0700 Subject: [PATCH 33/51] fix dev_tanssi_relay TS tests --- .../test_pallet_data_preservers.ts | 45 ++++++++++++------- .../registrar/test_registrars.ts | 28 ++++++++++-- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/test/suites/dev-tanssi-relay/pallet-data-preservers/test_pallet_data_preservers.ts b/test/suites/dev-tanssi-relay/pallet-data-preservers/test_pallet_data_preservers.ts index 68f9d633b..54ebd961a 100644 --- a/test/suites/dev-tanssi-relay/pallet-data-preservers/test_pallet_data_preservers.ts +++ b/test/suites/dev-tanssi-relay/pallet-data-preservers/test_pallet_data_preservers.ts @@ -268,8 +268,10 @@ describeSuite({ const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { storage: [ { - key: "0x636f6465", - value: "0x010203040506", + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", }, ], name: "0x436f6e7461696e657220436861696e2032303030", @@ -292,7 +294,8 @@ describeSuite({ const registerTx = polkadotJs.tx.containerRegistrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + "0x010203" ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -340,8 +343,10 @@ describeSuite({ const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { storage: [ { - key: "0x636f6465", - value: "0x010203040506", + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", }, ], name: "0x436f6e7461696e657220436861696e2032303030", @@ -364,7 +369,8 @@ describeSuite({ const registerTx = polkadotJs.tx.containerRegistrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + "0x010203" ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -412,8 +418,10 @@ describeSuite({ const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { storage: [ { - key: "0x636f6465", - value: "0x010203040506", + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", }, ], name: "0x436f6e7461696e657220436861696e2032303030", @@ -436,7 +444,8 @@ describeSuite({ const registerTx = polkadotJs.tx.containerRegistrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + "0x010203" ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -486,8 +495,10 @@ describeSuite({ const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { storage: [ { - key: "0x636f6465", - value: "0x010203040506", + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", }, ], name: "0x436f6e7461696e657220436861696e2032303030", @@ -510,7 +521,8 @@ describeSuite({ const registerTx = polkadotJs.tx.containerRegistrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + "0x010203" ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); @@ -560,8 +572,10 @@ describeSuite({ const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { storage: [ { - key: "0x636f6465", - value: "0x010203040506", + // ":code" key + key: "0x3a636f6465", + // code value (must be at least 9 bytes length) + value: "0x0102030405060708091011", }, ], name: "0x436f6e7461696e657220436861696e2032303030", @@ -584,7 +598,8 @@ describeSuite({ const registerTx = polkadotJs.tx.containerRegistrar.registerParathread( paraId, slotFrequency, - containerChainGenesisData + containerChainGenesisData, + "0x010203" ); await context.createBlock([await registerTx.signAsync(sudo_alice)]); diff --git a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts index ea2f1ee80..3d9c7b75b 100644 --- a/test/suites/dev-tanssi-relay/registrar/test_registrars.ts +++ b/test/suites/dev-tanssi-relay/registrar/test_registrars.ts @@ -10,10 +10,12 @@ describeSuite({ testCases: ({ it, context }) => { let polkadotJs: ApiPromise; let alice: KeyringPair; + let charlie: KeyringPair; let emptyGenesisData: any; beforeAll(() => { alice = context.keyring.alice; + charlie = context.keyring.alice; polkadotJs = context.pjsApi; emptyGenesisData = () => { const g = polkadotJs.createType("DpContainerChainGenesisDataContainerChainGenesisData", { @@ -78,12 +80,30 @@ describeSuite({ const onChainGenesisData = await polkadotJs.query.containerRegistrar.paraGenesisData(2002); expect(emptyGenesisData().toJSON()).to.deep.equal(onChainGenesisData.toJSON()); - // Mark the paraId valid for collating - const tx3 = polkadotJs.tx.containerRegistrar.markValidForCollating(2002); - await context.createBlock([await polkadotJs.tx.sudo.sudo(tx3).signAsync(alice)], { - allowFailures: false, + const profileId = await polkadotJs.query.dataPreservers.nextProfileId(); + const profileTx = polkadotJs.tx.dataPreservers.createProfile({ + url: "/ip4/127.0.0.1/tcp/33051/ws/p2p/12D3KooWSDsmAa7iFbHdQW4X8B2KbeRYPDLarK6EbevUSYfGkeQw", + paraIds: "AnyParaId", + mode: "Bootnode", + assignmentRequest: "Free", }); + const tx3 = polkadotJs.tx.dataPreservers.startAssignment(profileId, 2002, "Free"); + + // Mark the paraId valid for collating + const tx4 = polkadotJs.tx.containerRegistrar.markValidForCollating(2002); + const nonce = await polkadotJs.rpc.system.accountNextIndex(alice.publicKey); + await context.createBlock( + [ + await profileTx.signAsync(charlie), + await tx3.signAsync(alice, { nonce: nonce.addn(1) }), + await polkadotJs.tx.sudo.sudo(tx4).signAsync(alice, { nonce: nonce.addn(2) }), + ], + { + allowFailures: false, + } + ); + await jumpSessions(context, 2); // Para should be a parachain now From 37758491bdf44698e51b8fa5a7f7f40fecb3bfc4 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 16:24:48 -0700 Subject: [PATCH 34/51] fix zombie tests --- test/suites/para/test_tanssi_containers.ts | 2 +- test/suites/parathreads/test_tanssi_parathreads.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/suites/para/test_tanssi_containers.ts b/test/suites/para/test_tanssi_containers.ts index 505eb11f4..184feae22 100644 --- a/test/suites/para/test_tanssi_containers.ts +++ b/test/suites/para/test_tanssi_containers.ts @@ -241,7 +241,7 @@ describeSuite({ const chainSpec2002 = JSON.parse(spec2002); const containerChainGenesisData = chainSpecToContainerChainGenesisData(paraApi, chainSpec2002); - const tx1 = paraApi.tx.registrar.register(2002, containerChainGenesisData); + const tx1 = paraApi.tx.registrar.register(2002, containerChainGenesisData, null); const purchasedCredits = 100000n; const requiredBalance = purchasedCredits * 1_000_000n; const tx2 = paraApi.tx.servicesPayment.purchaseCredits(2002, requiredBalance); diff --git a/test/suites/parathreads/test_tanssi_parathreads.ts b/test/suites/parathreads/test_tanssi_parathreads.ts index bc5b4ea8e..a9a133750 100644 --- a/test/suites/parathreads/test_tanssi_parathreads.ts +++ b/test/suites/parathreads/test_tanssi_parathreads.ts @@ -466,7 +466,7 @@ function createCollatorKeyToNameMap(paraApi, collatorNames: string[]): Record Date: Thu, 29 Aug 2024 17:08:58 -0700 Subject: [PATCH 35/51] clippy --- pallets/registrar/src/benchmarks.rs | 15 ++++++++++++++- pallets/registrar/src/lib.rs | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pallets/registrar/src/benchmarks.rs b/pallets/registrar/src/benchmarks.rs index a047db874..ff11f1aa6 100644 --- a/pallets/registrar/src/benchmarks.rs +++ b/pallets/registrar/src/benchmarks.rs @@ -119,7 +119,7 @@ mod benchmarks { create_funded_user::("caller", 0, T::DepositAmount::get()); #[extrinsic_call] - Pallet::::register(RawOrigin::Signed(caller), Default::default(), storage); + Pallet::::register(RawOrigin::Signed(caller), Default::default(), storage, None); // verification code assert_eq!(pending_verification_len::(), 1usize); @@ -165,6 +165,7 @@ mod benchmarks { proof, signature, storage, + None ); // verification code @@ -188,6 +189,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); // Do not call mark_valid_for_collating, to ensure that the deregister call also executes the cleanup hooks @@ -224,6 +226,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); // Call mark_valid_for_collating to ensure that the deregister call @@ -273,6 +276,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); // Do not call mark_valid_for_collating, to ensure that the deregister call also executes the cleanup hooks @@ -326,6 +330,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); // Call mark_valid_for_collating to ensure that the deregister call @@ -393,6 +398,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); } @@ -406,6 +412,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -445,6 +452,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -461,6 +469,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); @@ -509,6 +518,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -525,6 +535,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); @@ -568,6 +579,7 @@ mod benchmarks { Default::default(), slot_frequency, storage, + None ); // verification code @@ -596,6 +608,7 @@ mod benchmarks { i.into(), slot_frequency.clone(), storage.clone(), + None ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 26a039cca..62191a5ec 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -795,7 +795,7 @@ pub mod pallet { (T::Currency::minimum_balance() + T::DepositAmount::get()) * 2u32.into(); let account = create_funded_user::("caller", 1000, new_balance).0; let origin = RawOrigin::Signed(account); - assert_ok!(Self::register(origin.into(), *para_id, Default::default())); + assert_ok!(Self::register(origin.into(), *para_id, Default::default(), None)); } let deposit_info = RegistrarDeposit::::get(para_id).expect("Cannot return signed origin for a container chain that was registered by root. Try using a different para id"); From d952d1eccb6ee049953e6ee3b5aeb854f879b8de Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 17:10:00 -0700 Subject: [PATCH 36/51] fmt --- pallets/registrar/src/benchmarks.rs | 26 +++++++++++++------------- pallets/registrar/src/lib.rs | 7 ++++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pallets/registrar/src/benchmarks.rs b/pallets/registrar/src/benchmarks.rs index ff11f1aa6..6b504811b 100644 --- a/pallets/registrar/src/benchmarks.rs +++ b/pallets/registrar/src/benchmarks.rs @@ -165,7 +165,7 @@ mod benchmarks { proof, signature, storage, - None + None, ); // verification code @@ -189,7 +189,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); // Do not call mark_valid_for_collating, to ensure that the deregister call also executes the cleanup hooks @@ -226,7 +226,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); // Call mark_valid_for_collating to ensure that the deregister call @@ -276,7 +276,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); // Do not call mark_valid_for_collating, to ensure that the deregister call also executes the cleanup hooks @@ -330,7 +330,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); // Call mark_valid_for_collating to ensure that the deregister call @@ -398,7 +398,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); } @@ -412,7 +412,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -452,7 +452,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -469,7 +469,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); @@ -518,7 +518,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), k.into(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(k.into()); @@ -535,7 +535,7 @@ mod benchmarks { RawOrigin::Signed(caller.clone()).into(), i.into(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); @@ -579,7 +579,7 @@ mod benchmarks { Default::default(), slot_frequency, storage, - None + None, ); // verification code @@ -608,7 +608,7 @@ mod benchmarks { i.into(), slot_frequency.clone(), storage.clone(), - None + None, ) .unwrap(); T::RegistrarHooks::benchmarks_ensure_valid_for_collating(i.into()); diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 62191a5ec..abbfcee2d 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -795,7 +795,12 @@ pub mod pallet { (T::Currency::minimum_balance() + T::DepositAmount::get()) * 2u32.into(); let account = create_funded_user::("caller", 1000, new_balance).0; let origin = RawOrigin::Signed(account); - assert_ok!(Self::register(origin.into(), *para_id, Default::default(), None)); + assert_ok!(Self::register( + origin.into(), + *para_id, + Default::default(), + None + )); } let deposit_info = RegistrarDeposit::::get(para_id).expect("Cannot return signed origin for a container chain that was registered by root. Try using a different para id"); From 67b8a88525c9f6dcb7e673e754233365cd071dc7 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 17:11:07 -0700 Subject: [PATCH 37/51] generate new api-augment interfaces --- .../dancebox/interfaces/augment-api-query.ts | 18 ++ .../src/dancebox/interfaces/augment-api-tx.ts | 16 +- .../src/dancebox/interfaces/lookup.ts | 297 +++++++++--------- .../src/dancebox/interfaces/types-lookup.ts | 297 +++++++++--------- .../flashbox/interfaces/augment-api-query.ts | 18 ++ .../src/flashbox/interfaces/augment-api-tx.ts | 16 +- .../src/flashbox/interfaces/lookup.ts | 167 +++++----- .../src/flashbox/interfaces/types-lookup.ts | 167 +++++----- 8 files changed, 526 insertions(+), 470 deletions(-) diff --git a/typescript-api/src/dancebox/interfaces/augment-api-query.ts b/typescript-api/src/dancebox/interfaces/augment-api-query.ts index 858c1f49a..af9d1b167 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-query.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-query.ts @@ -980,6 +980,24 @@ declare module "@polkadot/api-base/types/storage" { [key: string]: QueryableStorageEntry; }; registrar: { + /** + * This storage aims to act as a 'buffer' for paraIds that must be deregistered at the end of the block execution + * by calling 'T::InnerRegistrar::deregister()' implementation. + * + * We need this buffer because when we are using this pallet on a relay-chain environment like Starlight (where + * 'T::InnerRegistrar' implementation is usually the 'paras_registrar' pallet) we need to deregister (via + * 'paras_registrar::deregister') the same paraIds we have in 'PendingToRemove', and we need to do this + * deregistration process inside 'on_finalize' hook. + * + * It can be the case that some paraIds need to be downgraded to a parathread before deregistering on + * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block finalizes. + * + * Therefore, if we tried to perform this relay deregistration process at the beginning of the session/block + * inside ('on_initialize') initializer_on_new_session() as we do for this pallet, it would fail due to the + * downgrade process could have not taken place yet. + */ + bufferedParasToDeregister: AugmentedQuery Observable>, []> & + QueryableStorageEntry; paraGenesisData: AugmentedQuery< ApiType, ( diff --git a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts index dcdd32071..e0028b5ca 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts @@ -2953,9 +2953,10 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, - [u32, DpContainerChainGenesisDataContainerChainGenesisData] + [u32, DpContainerChainGenesisDataContainerChainGenesisData, Option] >; /** Register parathread */ registerParathread: AugmentedSubmittable< @@ -2966,9 +2967,10 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, - [u32, TpTraitsSlotFrequency, DpContainerChainGenesisDataContainerChainGenesisData] + [u32, TpTraitsSlotFrequency, DpContainerChainGenesisDataContainerChainGenesisData, Option] >; /** Register parachain or parathread */ registerWithRelayProof: AugmentedSubmittable< @@ -2994,7 +2996,8 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, [ u32, @@ -3002,7 +3005,8 @@ declare module "@polkadot/api-base/types/submittable" { u32, SpTrieStorageProof, SpRuntimeMultiSignature, - DpContainerChainGenesisDataContainerChainGenesisData + DpContainerChainGenesisDataContainerChainGenesisData, + Option ] >; setParaManager: AugmentedSubmittable< diff --git a/typescript-api/src/dancebox/interfaces/lookup.ts b/typescript-api/src/dancebox/interfaces/lookup.ts index f96606216..5a53a7b28 100644 --- a/typescript-api/src/dancebox/interfaces/lookup.ts +++ b/typescript-api/src/dancebox/interfaces/lookup.ts @@ -2613,6 +2613,7 @@ export default { register: { paraId: "u32", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, deregister: { paraId: "u32", @@ -2631,6 +2632,7 @@ export default { paraId: "u32", slotFrequency: "TpTraitsSlotFrequency", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, set_parathread_params: { paraId: "u32", @@ -2647,6 +2649,7 @@ export default { relayStorageProof: "SpTrieStorageProof", managerSignature: "SpRuntimeMultiSignature", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, deregister_with_relay_proof: { paraId: "u32", @@ -2680,16 +2683,16 @@ export default { ss58Format: "u32", tokenDecimals: "u32", }, - /** Lookup299: tp_traits::SlotFrequency */ + /** Lookup300: tp_traits::SlotFrequency */ TpTraitsSlotFrequency: { min: "u32", max: "u32", }, - /** Lookup301: tp_traits::ParathreadParams */ + /** Lookup302: tp_traits::ParathreadParams */ TpTraitsParathreadParams: { slotFrequency: "TpTraitsSlotFrequency", }, - /** Lookup302: pallet_configuration::pallet::Call */ + /** Lookup303: pallet_configuration::pallet::Call */ PalletConfigurationCall: { _enum: { set_max_collators: { @@ -2784,9 +2787,9 @@ export default { }, }, }, - /** Lookup304: pallet_collator_assignment::pallet::Call */ + /** Lookup305: pallet_collator_assignment::pallet::Call */ PalletCollatorAssignmentCall: "Null", - /** Lookup305: pallet_author_noting::pallet::Call */ + /** Lookup306: pallet_author_noting::pallet::Call */ PalletAuthorNotingCall: { _enum: { set_latest_author_data: { @@ -2803,13 +2806,13 @@ export default { }, }, }, - /** Lookup306: tp_author_noting_inherent::OwnParachainInherentData */ + /** Lookup307: tp_author_noting_inherent::OwnParachainInherentData */ TpAuthorNotingInherentOwnParachainInherentData: { relayStorageProof: "SpTrieStorageProof", }, - /** Lookup307: pallet_authority_assignment::pallet::Call */ + /** Lookup308: pallet_authority_assignment::pallet::Call */ PalletAuthorityAssignmentCall: "Null", - /** Lookup308: pallet_services_payment::pallet::Call */ + /** Lookup309: pallet_services_payment::pallet::Call */ PalletServicesPaymentCall: { _enum: { purchase_credits: { @@ -2842,7 +2845,7 @@ export default { }, }, }, - /** Lookup309: pallet_data_preservers::pallet::Call */ + /** Lookup310: pallet_data_preservers::pallet::Call */ PalletDataPreserversCall: { _enum: { __Unused0: "Null", @@ -2883,14 +2886,14 @@ export default { }, }, }, - /** Lookup310: pallet_data_preservers::types::Profile */ + /** Lookup311: pallet_data_preservers::types::Profile */ PalletDataPreserversProfile: { url: "Bytes", paraIds: "PalletDataPreserversParaIdsFilter", mode: "PalletDataPreserversProfileMode", assignmentRequest: "DanceboxRuntimePreserversAssignementPaymentRequest", }, - /** Lookup312: pallet_data_preservers::types::ParaIdsFilter */ + /** Lookup313: pallet_data_preservers::types::ParaIdsFilter */ PalletDataPreserversParaIdsFilter: { _enum: { AnyParaId: "Null", @@ -2898,7 +2901,7 @@ export default { Blacklist: "BTreeSet", }, }, - /** Lookup315: pallet_data_preservers::types::ProfileMode */ + /** Lookup316: pallet_data_preservers::types::ProfileMode */ PalletDataPreserversProfileMode: { _enum: { Bootnode: "Null", @@ -2907,19 +2910,19 @@ export default { }, }, }, - /** Lookup316: dancebox_runtime::PreserversAssignementPaymentRequest */ + /** Lookup317: dancebox_runtime::PreserversAssignementPaymentRequest */ DanceboxRuntimePreserversAssignementPaymentRequest: { _enum: ["Free"], }, - /** Lookup317: dancebox_runtime::PreserversAssignementPaymentExtra */ + /** Lookup318: dancebox_runtime::PreserversAssignementPaymentExtra */ DanceboxRuntimePreserversAssignementPaymentExtra: { _enum: ["Free"], }, - /** Lookup318: dancebox_runtime::PreserversAssignementPaymentWitness */ + /** Lookup319: dancebox_runtime::PreserversAssignementPaymentWitness */ DanceboxRuntimePreserversAssignementPaymentWitness: { _enum: ["Free"], }, - /** Lookup319: pallet_invulnerables::pallet::Call */ + /** Lookup320: pallet_invulnerables::pallet::Call */ PalletInvulnerablesCall: { _enum: { __Unused0: "Null", @@ -2931,7 +2934,7 @@ export default { }, }, }, - /** Lookup320: pallet_session::pallet::Call */ + /** Lookup321: pallet_session::pallet::Call */ PalletSessionCall: { _enum: { set_keys: { @@ -2944,17 +2947,17 @@ export default { purge_keys: "Null", }, }, - /** Lookup321: dancebox_runtime::SessionKeys */ + /** Lookup322: dancebox_runtime::SessionKeys */ DanceboxRuntimeSessionKeys: { nimbus: "NimbusPrimitivesNimbusCryptoPublic", }, - /** Lookup322: nimbus_primitives::nimbus_crypto::Public */ + /** Lookup323: nimbus_primitives::nimbus_crypto::Public */ NimbusPrimitivesNimbusCryptoPublic: "[u8;32]", - /** Lookup323: pallet_author_inherent::pallet::Call */ + /** Lookup324: pallet_author_inherent::pallet::Call */ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"], }, - /** Lookup324: pallet_pooled_staking::pallet::Call */ + /** Lookup325: pallet_pooled_staking::pallet::Call */ PalletPooledStakingCall: { _enum: { rebalance_hold: { @@ -2988,16 +2991,16 @@ export default { }, }, }, - /** Lookup325: pallet_pooled_staking::pallet::AllTargetPool */ + /** Lookup326: pallet_pooled_staking::pallet::AllTargetPool */ PalletPooledStakingAllTargetPool: { _enum: ["Joining", "AutoCompounding", "ManualRewards", "Leaving"], }, - /** Lookup327: pallet_pooled_staking::pallet::PendingOperationQuery */ + /** Lookup328: pallet_pooled_staking::pallet::PendingOperationQuery */ PalletPooledStakingPendingOperationQuery: { delegator: "AccountId32", operation: "PalletPooledStakingPendingOperationKey", }, - /** Lookup328: pallet_pooled_staking::pallet::PendingOperationKey */ + /** Lookup329: pallet_pooled_staking::pallet::PendingOperationKey */ PalletPooledStakingPendingOperationKey: { _enum: { JoiningAutoCompounding: { @@ -3014,14 +3017,14 @@ export default { }, }, }, - /** Lookup329: pallet_pooled_staking::pallet::SharesOrStake */ + /** Lookup330: pallet_pooled_staking::pallet::SharesOrStake */ PalletPooledStakingSharesOrStake: { _enum: { Shares: "u128", Stake: "u128", }, }, - /** Lookup332: pallet_treasury::pallet::Call */ + /** Lookup333: pallet_treasury::pallet::Call */ PalletTreasuryCall: { _enum: { __Unused0: "Null", @@ -3051,7 +3054,7 @@ export default { }, }, }, - /** Lookup333: cumulus_pallet_xcmp_queue::pallet::Call */ + /** Lookup334: cumulus_pallet_xcmp_queue::pallet::Call */ CumulusPalletXcmpQueueCall: { _enum: { __Unused0: "Null", @@ -3077,7 +3080,7 @@ export default { }, }, }, - /** Lookup334: pallet_xcm::pallet::Call */ + /** Lookup335: pallet_xcm::pallet::Call */ PalletXcmCall: { _enum: { send: { @@ -3152,7 +3155,7 @@ export default { }, }, }, - /** Lookup335: xcm::VersionedXcm */ + /** Lookup336: xcm::VersionedXcm */ XcmVersionedXcm: { _enum: { __Unused0: "Null", @@ -3162,9 +3165,9 @@ export default { V4: "StagingXcmV4Xcm", }, }, - /** Lookup336: xcm::v2::Xcm */ + /** Lookup337: xcm::v2::Xcm */ XcmV2Xcm: "Vec", - /** Lookup338: xcm::v2::Instruction */ + /** Lookup339: xcm::v2::Instruction */ XcmV2Instruction: { _enum: { WithdrawAsset: "XcmV2MultiassetMultiAssets", @@ -3260,7 +3263,7 @@ export default { UnsubscribeVersion: "Null", }, }, - /** Lookup339: xcm::v2::Response */ + /** Lookup340: xcm::v2::Response */ XcmV2Response: { _enum: { Null: "Null", @@ -3269,7 +3272,7 @@ export default { Version: "u32", }, }, - /** Lookup342: xcm::v2::traits::Error */ + /** Lookup343: xcm::v2::traits::Error */ XcmV2TraitsError: { _enum: { Overflow: "Null", @@ -3300,18 +3303,18 @@ export default { WeightNotComputable: "Null", }, }, - /** Lookup343: xcm::v2::OriginKind */ + /** Lookup344: xcm::v2::OriginKind */ XcmV2OriginKind: { _enum: ["Native", "SovereignAccount", "Superuser", "Xcm"], }, - /** Lookup344: xcm::v2::multiasset::MultiAssetFilter */ + /** Lookup345: xcm::v2::multiasset::MultiAssetFilter */ XcmV2MultiassetMultiAssetFilter: { _enum: { Definite: "XcmV2MultiassetMultiAssets", Wild: "XcmV2MultiassetWildMultiAsset", }, }, - /** Lookup345: xcm::v2::multiasset::WildMultiAsset */ + /** Lookup346: xcm::v2::multiasset::WildMultiAsset */ XcmV2MultiassetWildMultiAsset: { _enum: { All: "Null", @@ -3321,20 +3324,20 @@ export default { }, }, }, - /** Lookup346: xcm::v2::multiasset::WildFungibility */ + /** Lookup347: xcm::v2::multiasset::WildFungibility */ XcmV2MultiassetWildFungibility: { _enum: ["Fungible", "NonFungible"], }, - /** Lookup347: xcm::v2::WeightLimit */ + /** Lookup348: xcm::v2::WeightLimit */ XcmV2WeightLimit: { _enum: { Unlimited: "Null", Limited: "Compact", }, }, - /** Lookup348: xcm::v3::Xcm */ + /** Lookup349: xcm::v3::Xcm */ XcmV3Xcm: "Vec", - /** Lookup350: xcm::v3::Instruction */ + /** Lookup351: xcm::v3::Instruction */ XcmV3Instruction: { _enum: { WithdrawAsset: "XcmV3MultiassetMultiAssets", @@ -3474,7 +3477,7 @@ export default { }, }, }, - /** Lookup351: xcm::v3::Response */ + /** Lookup352: xcm::v3::Response */ XcmV3Response: { _enum: { Null: "Null", @@ -3485,7 +3488,7 @@ export default { DispatchResult: "XcmV3MaybeErrorCode", }, }, - /** Lookup353: xcm::v3::PalletInfo */ + /** Lookup354: xcm::v3::PalletInfo */ XcmV3PalletInfo: { index: "Compact", name: "Bytes", @@ -3494,20 +3497,20 @@ export default { minor: "Compact", patch: "Compact", }, - /** Lookup357: xcm::v3::QueryResponseInfo */ + /** Lookup358: xcm::v3::QueryResponseInfo */ XcmV3QueryResponseInfo: { destination: "StagingXcmV3MultiLocation", queryId: "Compact", maxWeight: "SpWeightsWeightV2Weight", }, - /** Lookup358: xcm::v3::multiasset::MultiAssetFilter */ + /** Lookup359: xcm::v3::multiasset::MultiAssetFilter */ XcmV3MultiassetMultiAssetFilter: { _enum: { Definite: "XcmV3MultiassetMultiAssets", Wild: "XcmV3MultiassetWildMultiAsset", }, }, - /** Lookup359: xcm::v3::multiasset::WildMultiAsset */ + /** Lookup360: xcm::v3::multiasset::WildMultiAsset */ XcmV3MultiassetWildMultiAsset: { _enum: { All: "Null", @@ -3523,11 +3526,11 @@ export default { }, }, }, - /** Lookup360: xcm::v3::multiasset::WildFungibility */ + /** Lookup361: xcm::v3::multiasset::WildFungibility */ XcmV3MultiassetWildFungibility: { _enum: ["Fungible", "NonFungible"], }, - /** Lookup372: staging_xcm_executor::traits::asset_transfer::TransferType */ + /** Lookup373: staging_xcm_executor::traits::asset_transfer::TransferType */ StagingXcmExecutorAssetTransferTransferType: { _enum: { Teleport: "Null", @@ -3536,7 +3539,7 @@ export default { RemoteReserve: "XcmVersionedLocation", }, }, - /** Lookup373: xcm::VersionedAssetId */ + /** Lookup374: xcm::VersionedAssetId */ XcmVersionedAssetId: { _enum: { __Unused0: "Null", @@ -3546,7 +3549,7 @@ export default { V4: "StagingXcmV4AssetAssetId", }, }, - /** Lookup374: pallet_assets::pallet::Call */ + /** Lookup375: pallet_assets::pallet::Call */ PalletAssetsCall: { _enum: { create: { @@ -3696,7 +3699,7 @@ export default { }, }, }, - /** Lookup375: pallet_foreign_asset_creator::pallet::Call */ + /** Lookup376: pallet_foreign_asset_creator::pallet::Call */ PalletForeignAssetCreatorCall: { _enum: { create_foreign_asset: { @@ -3718,7 +3721,7 @@ export default { }, }, }, - /** Lookup376: pallet_asset_rate::pallet::Call */ + /** Lookup377: pallet_asset_rate::pallet::Call */ PalletAssetRateCall: { _enum: { create: { @@ -3734,7 +3737,7 @@ export default { }, }, }, - /** Lookup377: pallet_message_queue::pallet::Call */ + /** Lookup378: pallet_message_queue::pallet::Call */ PalletMessageQueueCall: { _enum: { reap_page: { @@ -3749,7 +3752,7 @@ export default { }, }, }, - /** Lookup378: pallet_xcm_core_buyer::pallet::Call */ + /** Lookup379: pallet_xcm_core_buyer::pallet::Call */ PalletXcmCoreBuyerCall: { _enum: { buy_core: { @@ -3777,24 +3780,24 @@ export default { }, }, }, - /** Lookup379: tp_xcm_core_buyer::BuyCoreCollatorProof */ + /** Lookup380: tp_xcm_core_buyer::BuyCoreCollatorProof */ TpXcmCoreBuyerBuyCoreCollatorProof: { nonce: "u64", publicKey: "NimbusPrimitivesNimbusCryptoPublic", signature: "NimbusPrimitivesNimbusCryptoSignature", }, - /** Lookup380: nimbus_primitives::nimbus_crypto::Signature */ + /** Lookup381: nimbus_primitives::nimbus_crypto::Signature */ NimbusPrimitivesNimbusCryptoSignature: "[u8;64]", - /** Lookup382: pallet_xcm_core_buyer::pallet::RelayXcmWeightConfigInner */ + /** Lookup383: pallet_xcm_core_buyer::pallet::RelayXcmWeightConfigInner */ PalletXcmCoreBuyerRelayXcmWeightConfigInner: { buyExecutionCost: "u128", weightAtMost: "SpWeightsWeightV2Weight", }, - /** Lookup384: dancebox_runtime::xcm_config::RelayChain */ + /** Lookup385: dancebox_runtime::xcm_config::RelayChain */ DanceboxRuntimeXcmConfigRelayChain: { _enum: ["Westend", "Rococo"], }, - /** Lookup385: pallet_root_testing::pallet::Call */ + /** Lookup386: pallet_root_testing::pallet::Call */ PalletRootTestingCall: { _enum: { fill_block: { @@ -3803,27 +3806,27 @@ export default { trigger_defensive: "Null", }, }, - /** Lookup386: pallet_sudo::pallet::Error */ + /** Lookup387: pallet_sudo::pallet::Error */ PalletSudoError: { _enum: ["RequireSudo"], }, - /** Lookup387: pallet_utility::pallet::Error */ + /** Lookup388: pallet_utility::pallet::Error */ PalletUtilityError: { _enum: ["TooManyCalls"], }, - /** Lookup390: pallet_proxy::ProxyDefinition */ + /** Lookup391: pallet_proxy::ProxyDefinition */ PalletProxyProxyDefinition: { delegate: "AccountId32", proxyType: "DanceboxRuntimeProxyType", delay: "u32", }, - /** Lookup394: pallet_proxy::Announcement */ + /** Lookup395: pallet_proxy::Announcement */ PalletProxyAnnouncement: { real: "AccountId32", callHash: "H256", height: "u32", }, - /** Lookup396: pallet_proxy::pallet::Error */ + /** Lookup397: pallet_proxy::pallet::Error */ PalletProxyError: { _enum: [ "TooMany", @@ -3836,39 +3839,39 @@ export default { "NoSelfProxy", ], }, - /** Lookup397: pallet_migrations::pallet::Error */ + /** Lookup398: pallet_migrations::pallet::Error */ PalletMigrationsError: { _enum: ["PreimageMissing", "WrongUpperBound", "PreimageIsTooBig", "PreimageAlreadyExists"], }, - /** Lookup398: pallet_maintenance_mode::pallet::Error */ + /** Lookup399: pallet_maintenance_mode::pallet::Error */ PalletMaintenanceModeError: { _enum: ["AlreadyInMaintenanceMode", "NotInMaintenanceMode"], }, - /** Lookup399: pallet_tx_pause::pallet::Error */ + /** Lookup400: pallet_tx_pause::pallet::Error */ PalletTxPauseError: { _enum: ["IsPaused", "IsUnpaused", "Unpausable", "NotFound"], }, - /** Lookup401: pallet_balances::types::BalanceLock */ + /** Lookup402: pallet_balances::types::BalanceLock */ PalletBalancesBalanceLock: { id: "[u8;8]", amount: "u128", reasons: "PalletBalancesReasons", }, - /** Lookup402: pallet_balances::types::Reasons */ + /** Lookup403: pallet_balances::types::Reasons */ PalletBalancesReasons: { _enum: ["Fee", "Misc", "All"], }, - /** Lookup405: pallet_balances::types::ReserveData */ + /** Lookup406: pallet_balances::types::ReserveData */ PalletBalancesReserveData: { id: "[u8;8]", amount: "u128", }, - /** Lookup408: frame_support::traits::tokens::misc::IdAmount */ + /** Lookup409: frame_support::traits::tokens::misc::IdAmount */ FrameSupportTokensMiscIdAmountRuntimeHoldReason: { id: "DanceboxRuntimeRuntimeHoldReason", amount: "u128", }, - /** Lookup409: dancebox_runtime::RuntimeHoldReason */ + /** Lookup410: dancebox_runtime::RuntimeHoldReason */ DanceboxRuntimeRuntimeHoldReason: { _enum: { __Unused0: "Null", @@ -3908,28 +3911,28 @@ export default { PooledStaking: "PalletPooledStakingHoldReason", }, }, - /** Lookup410: pallet_stream_payment::pallet::HoldReason */ + /** Lookup411: pallet_stream_payment::pallet::HoldReason */ PalletStreamPaymentHoldReason: { _enum: ["StreamPayment", "StreamOpened"], }, - /** Lookup411: pallet_registrar::pallet::HoldReason */ + /** Lookup412: pallet_registrar::pallet::HoldReason */ PalletRegistrarHoldReason: { _enum: ["RegistrarDeposit"], }, - /** Lookup412: pallet_data_preservers::pallet::HoldReason */ + /** Lookup413: pallet_data_preservers::pallet::HoldReason */ PalletDataPreserversHoldReason: { _enum: ["ProfileDeposit"], }, - /** Lookup413: pallet_pooled_staking::pallet::HoldReason */ + /** Lookup414: pallet_pooled_staking::pallet::HoldReason */ PalletPooledStakingHoldReason: { _enum: ["PooledStake"], }, - /** Lookup416: frame_support::traits::tokens::misc::IdAmount */ + /** Lookup417: frame_support::traits::tokens::misc::IdAmount */ FrameSupportTokensMiscIdAmountRuntimeFreezeReason: { id: "DanceboxRuntimeRuntimeFreezeReason", amount: "u128", }, - /** Lookup417: dancebox_runtime::RuntimeFreezeReason */ + /** Lookup418: dancebox_runtime::RuntimeFreezeReason */ DanceboxRuntimeRuntimeFreezeReason: { _enum: { __Unused0: "Null", @@ -3947,11 +3950,11 @@ export default { StreamPayment: "PalletStreamPaymentFreezeReason", }, }, - /** Lookup418: pallet_stream_payment::pallet::FreezeReason */ + /** Lookup419: pallet_stream_payment::pallet::FreezeReason */ PalletStreamPaymentFreezeReason: { _enum: ["StreamPayment"], }, - /** Lookup420: pallet_balances::pallet::Error */ + /** Lookup421: pallet_balances::pallet::Error */ PalletBalancesError: { _enum: [ "VestingBalance", @@ -3968,12 +3971,12 @@ export default { "DeltaZero", ], }, - /** Lookup421: pallet_transaction_payment::Releases */ + /** Lookup422: pallet_transaction_payment::Releases */ PalletTransactionPaymentReleases: { _enum: ["V1Ancient", "V2"], }, /** - * Lookup422: pallet_stream_payment::pallet::Stream */ PalletStreamPaymentStream: { @@ -3987,7 +3990,7 @@ export default { openingDeposit: "u128", }, /** - * Lookup424: pallet_stream_payment::pallet::ChangeRequest */ PalletStreamPaymentChangeRequest: { @@ -3996,7 +3999,7 @@ export default { newConfig: "PalletStreamPaymentStreamConfig", depositChange: "Option", }, - /** Lookup426: pallet_stream_payment::pallet::Error */ + /** Lookup427: pallet_stream_payment::pallet::Error */ PalletStreamPaymentError: { _enum: [ "UnknownStreamId", @@ -4018,24 +4021,24 @@ export default { "CantFetchStatusBeforeLastTimeUpdated", ], }, - /** Lookup428: pallet_identity::types::Registration> */ + /** Lookup429: pallet_identity::types::Registration> */ PalletIdentityRegistration: { judgements: "Vec<(u32,PalletIdentityJudgement)>", deposit: "u128", info: "PalletIdentityLegacyIdentityInfo", }, - /** Lookup437: pallet_identity::types::RegistrarInfo */ + /** Lookup438: pallet_identity::types::RegistrarInfo */ PalletIdentityRegistrarInfo: { account: "AccountId32", fee: "u128", fields: "u64", }, - /** Lookup439: pallet_identity::types::AuthorityProperties> */ + /** Lookup440: pallet_identity::types::AuthorityProperties> */ PalletIdentityAuthorityProperties: { suffix: "Bytes", allocation: "u32", }, - /** Lookup442: pallet_identity::pallet::Error */ + /** Lookup443: pallet_identity::pallet::Error */ PalletIdentityError: { _enum: [ "TooManySubAccounts", @@ -4066,14 +4069,14 @@ export default { "NotExpired", ], }, - /** Lookup444: pallet_multisig::Multisig */ + /** Lookup445: pallet_multisig::Multisig */ PalletMultisigMultisig: { when: "PalletMultisigTimepoint", deposit: "u128", depositor: "AccountId32", approvals: "Vec", }, - /** Lookup446: pallet_multisig::pallet::Error */ + /** Lookup447: pallet_multisig::pallet::Error */ PalletMultisigError: { _enum: [ "MinimumThreshold", @@ -4092,12 +4095,12 @@ export default { "AlreadyStored", ], }, - /** Lookup455: pallet_registrar::pallet::DepositInfo */ + /** Lookup456: pallet_registrar::pallet::DepositInfo */ PalletRegistrarDepositInfo: { creator: "AccountId32", deposit: "u128", }, - /** Lookup456: pallet_registrar::pallet::Error */ + /** Lookup457: pallet_registrar::pallet::Error */ PalletRegistrarError: { _enum: [ "ParaIdAlreadyRegistered", @@ -4117,7 +4120,7 @@ export default { "ParaStillExistsInRelay", ], }, - /** Lookup457: pallet_configuration::HostConfiguration */ + /** Lookup458: pallet_configuration::HostConfiguration */ PalletConfigurationHostConfiguration: { maxCollators: "u32", minOrchestratorCollators: "u32", @@ -4128,22 +4131,22 @@ export default { parathreadsPerCollator: "u32", targetContainerChainFullness: "Perbill", }, - /** Lookup460: pallet_configuration::pallet::Error */ + /** Lookup461: pallet_configuration::pallet::Error */ PalletConfigurationError: { _enum: ["InvalidNewValue"], }, - /** Lookup461: dp_collator_assignment::AssignedCollators */ + /** Lookup462: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsAccountId32: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup466: tp_traits::ContainerChainBlockInfo */ + /** Lookup467: tp_traits::ContainerChainBlockInfo */ TpTraitsContainerChainBlockInfo: { blockNumber: "u32", author: "AccountId32", latestSlotNumber: "u64", }, - /** Lookup467: pallet_author_noting::pallet::Error */ + /** Lookup468: pallet_author_noting::pallet::Error */ PalletAuthorNotingError: { _enum: [ "FailedReading", @@ -4155,23 +4158,23 @@ export default { "NonAuraDigest", ], }, - /** Lookup468: dp_collator_assignment::AssignedCollators */ + /** Lookup469: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsPublic: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup473: pallet_services_payment::pallet::Error */ + /** Lookup474: pallet_services_payment::pallet::Error */ PalletServicesPaymentError: { _enum: ["InsufficientFundsToPurchaseCredits", "InsufficientCredits", "CreditPriceTooExpensive"], }, - /** Lookup474: pallet_data_preservers::types::RegisteredProfile */ + /** Lookup475: pallet_data_preservers::types::RegisteredProfile */ PalletDataPreserversRegisteredProfile: { account: "AccountId32", deposit: "u128", profile: "PalletDataPreserversProfile", assignment: "Option<(u32,DanceboxRuntimePreserversAssignementPaymentWitness)>", }, - /** Lookup480: pallet_data_preservers::pallet::Error */ + /** Lookup481: pallet_data_preservers::pallet::Error */ PalletDataPreserversError: { _enum: [ "NoBootNodes", @@ -4186,7 +4189,7 @@ export default { "CantDeleteAssignedProfile", ], }, - /** Lookup482: pallet_invulnerables::pallet::Error */ + /** Lookup483: pallet_invulnerables::pallet::Error */ PalletInvulnerablesError: { _enum: [ "TooManyInvulnerables", @@ -4196,22 +4199,22 @@ export default { "UnableToDeriveCollatorId", ], }, - /** Lookup487: sp_core::crypto::KeyTypeId */ + /** Lookup488: sp_core::crypto::KeyTypeId */ SpCoreCryptoKeyTypeId: "[u8;4]", - /** Lookup488: pallet_session::pallet::Error */ + /** Lookup489: pallet_session::pallet::Error */ PalletSessionError: { _enum: ["InvalidProof", "NoAssociatedValidatorId", "DuplicatedKey", "NoKeys", "NoAccount"], }, - /** Lookup492: pallet_author_inherent::pallet::Error */ + /** Lookup493: pallet_author_inherent::pallet::Error */ PalletAuthorInherentError: { _enum: ["AuthorAlreadySet", "NoAccountId", "CannotBeAuthor"], }, - /** Lookup494: pallet_pooled_staking::candidate::EligibleCandidate */ + /** Lookup495: pallet_pooled_staking::candidate::EligibleCandidate */ PalletPooledStakingCandidateEligibleCandidate: { candidate: "AccountId32", stake: "u128", }, - /** Lookup497: pallet_pooled_staking::pallet::PoolsKey */ + /** Lookup498: pallet_pooled_staking::pallet::PoolsKey */ PalletPooledStakingPoolsKey: { _enum: { CandidateTotalStake: "Null", @@ -4253,7 +4256,7 @@ export default { }, }, }, - /** Lookup499: pallet_pooled_staking::pallet::Error */ + /** Lookup500: pallet_pooled_staking::pallet::Error */ PalletPooledStakingError: { _enum: { InvalidPalletSetting: "Null", @@ -4272,19 +4275,19 @@ export default { SwapResultsInZeroShares: "Null", }, }, - /** Lookup500: pallet_inflation_rewards::pallet::ChainsToRewardValue */ + /** Lookup501: pallet_inflation_rewards::pallet::ChainsToRewardValue */ PalletInflationRewardsChainsToRewardValue: { paraIds: "Vec", rewardsPerChain: "u128", }, - /** Lookup501: pallet_treasury::Proposal */ + /** Lookup502: pallet_treasury::Proposal */ PalletTreasuryProposal: { proposer: "AccountId32", value: "u128", beneficiary: "AccountId32", bond: "u128", }, - /** Lookup503: pallet_treasury::SpendStatus */ + /** Lookup504: pallet_treasury::SpendStatus */ PalletTreasurySpendStatus: { assetKind: "Null", amount: "u128", @@ -4293,7 +4296,7 @@ export default { expireAt: "u32", status: "PalletTreasuryPaymentState", }, - /** Lookup504: pallet_treasury::PaymentState */ + /** Lookup505: pallet_treasury::PaymentState */ PalletTreasuryPaymentState: { _enum: { Pending: "Null", @@ -4303,9 +4306,9 @@ export default { Failed: "Null", }, }, - /** Lookup506: frame_support::PalletId */ + /** Lookup507: frame_support::PalletId */ FrameSupportPalletId: "[u8;8]", - /** Lookup507: pallet_treasury::pallet::Error */ + /** Lookup508: pallet_treasury::pallet::Error */ PalletTreasuryError: { _enum: [ "InvalidIndex", @@ -4321,7 +4324,7 @@ export default { "Inconclusive", ], }, - /** Lookup510: cumulus_pallet_xcmp_queue::OutboundChannelDetails */ + /** Lookup511: cumulus_pallet_xcmp_queue::OutboundChannelDetails */ CumulusPalletXcmpQueueOutboundChannelDetails: { recipient: "u32", state: "CumulusPalletXcmpQueueOutboundState", @@ -4329,21 +4332,21 @@ export default { firstIndex: "u16", lastIndex: "u16", }, - /** Lookup511: cumulus_pallet_xcmp_queue::OutboundState */ + /** Lookup512: cumulus_pallet_xcmp_queue::OutboundState */ CumulusPalletXcmpQueueOutboundState: { _enum: ["Ok", "Suspended"], }, - /** Lookup515: cumulus_pallet_xcmp_queue::QueueConfigData */ + /** Lookup516: cumulus_pallet_xcmp_queue::QueueConfigData */ CumulusPalletXcmpQueueQueueConfigData: { suspendThreshold: "u32", dropThreshold: "u32", resumeThreshold: "u32", }, - /** Lookup516: cumulus_pallet_xcmp_queue::pallet::Error */ + /** Lookup517: cumulus_pallet_xcmp_queue::pallet::Error */ CumulusPalletXcmpQueueError: { _enum: ["BadQueueConfig", "AlreadySuspended", "AlreadyResumed", "TooManyActiveOutboundChannels", "TooBig"], }, - /** Lookup517: pallet_xcm::pallet::QueryStatus */ + /** Lookup518: pallet_xcm::pallet::QueryStatus */ PalletXcmQueryStatus: { _enum: { Pending: { @@ -4362,7 +4365,7 @@ export default { }, }, }, - /** Lookup521: xcm::VersionedResponse */ + /** Lookup522: xcm::VersionedResponse */ XcmVersionedResponse: { _enum: { __Unused0: "Null", @@ -4372,7 +4375,7 @@ export default { V4: "StagingXcmV4Response", }, }, - /** Lookup527: pallet_xcm::pallet::VersionMigrationStage */ + /** Lookup528: pallet_xcm::pallet::VersionMigrationStage */ PalletXcmVersionMigrationStage: { _enum: { MigrateSupportedVersion: "Null", @@ -4381,14 +4384,14 @@ export default { MigrateAndNotifyOldTargets: "Null", }, }, - /** Lookup529: pallet_xcm::pallet::RemoteLockedFungibleRecord */ + /** Lookup530: pallet_xcm::pallet::RemoteLockedFungibleRecord */ PalletXcmRemoteLockedFungibleRecord: { amount: "u128", owner: "XcmVersionedLocation", locker: "XcmVersionedLocation", consumers: "Vec<(Null,u128)>", }, - /** Lookup536: pallet_xcm::pallet::Error */ + /** Lookup537: pallet_xcm::pallet::Error */ PalletXcmError: { _enum: [ "Unreachable", @@ -4418,7 +4421,7 @@ export default { "LocalExecutionIncomplete", ], }, - /** Lookup537: pallet_assets::types::AssetDetails */ + /** Lookup538: pallet_assets::types::AssetDetails */ PalletAssetsAssetDetails: { owner: "AccountId32", issuer: "AccountId32", @@ -4433,22 +4436,22 @@ export default { approvals: "u32", status: "PalletAssetsAssetStatus", }, - /** Lookup538: pallet_assets::types::AssetStatus */ + /** Lookup539: pallet_assets::types::AssetStatus */ PalletAssetsAssetStatus: { _enum: ["Live", "Frozen", "Destroying"], }, - /** Lookup540: pallet_assets::types::AssetAccount */ + /** Lookup541: pallet_assets::types::AssetAccount */ PalletAssetsAssetAccount: { balance: "u128", status: "PalletAssetsAccountStatus", reason: "PalletAssetsExistenceReason", extra: "Null", }, - /** Lookup541: pallet_assets::types::AccountStatus */ + /** Lookup542: pallet_assets::types::AccountStatus */ PalletAssetsAccountStatus: { _enum: ["Liquid", "Frozen", "Blocked"], }, - /** Lookup542: pallet_assets::types::ExistenceReason */ + /** Lookup543: pallet_assets::types::ExistenceReason */ PalletAssetsExistenceReason: { _enum: { Consumer: "Null", @@ -4458,12 +4461,12 @@ export default { DepositFrom: "(AccountId32,u128)", }, }, - /** Lookup544: pallet_assets::types::Approval */ + /** Lookup545: pallet_assets::types::Approval */ PalletAssetsApproval: { amount: "u128", deposit: "u128", }, - /** Lookup545: pallet_assets::types::AssetMetadata> */ + /** Lookup546: pallet_assets::types::AssetMetadata> */ PalletAssetsAssetMetadata: { deposit: "u128", name: "Bytes", @@ -4471,7 +4474,7 @@ export default { decimals: "u8", isFrozen: "bool", }, - /** Lookup547: pallet_assets::pallet::Error */ + /** Lookup548: pallet_assets::pallet::Error */ PalletAssetsError: { _enum: [ "BalanceLow", @@ -4497,15 +4500,15 @@ export default { "BadAssetId", ], }, - /** Lookup548: pallet_foreign_asset_creator::pallet::Error */ + /** Lookup549: pallet_foreign_asset_creator::pallet::Error */ PalletForeignAssetCreatorError: { _enum: ["AssetAlreadyExists", "AssetDoesNotExist"], }, - /** Lookup549: pallet_asset_rate::pallet::Error */ + /** Lookup550: pallet_asset_rate::pallet::Error */ PalletAssetRateError: { _enum: ["UnknownAssetKind", "AlreadyExists", "Overflow"], }, - /** Lookup550: pallet_message_queue::BookState */ + /** Lookup551: pallet_message_queue::BookState */ PalletMessageQueueBookState: { _alias: { size_: "size", @@ -4517,12 +4520,12 @@ export default { messageCount: "u64", size_: "u64", }, - /** Lookup552: pallet_message_queue::Neighbours */ + /** Lookup553: pallet_message_queue::Neighbours */ PalletMessageQueueNeighbours: { prev: "CumulusPrimitivesCoreAggregateMessageOrigin", next: "CumulusPrimitivesCoreAggregateMessageOrigin", }, - /** Lookup554: pallet_message_queue::Page */ + /** Lookup555: pallet_message_queue::Page */ PalletMessageQueuePage: { remaining: "u32", remainingSize: "u32", @@ -4531,7 +4534,7 @@ export default { last: "u32", heap: "Bytes", }, - /** Lookup556: pallet_message_queue::pallet::Error */ + /** Lookup557: pallet_message_queue::pallet::Error */ PalletMessageQueueError: { _enum: [ "NotReapable", @@ -4545,13 +4548,13 @@ export default { "RecursiveDisallowed", ], }, - /** Lookup557: pallet_xcm_core_buyer::InFlightCoreBuyingOrder */ + /** Lookup558: pallet_xcm_core_buyer::InFlightCoreBuyingOrder */ PalletXcmCoreBuyerInFlightCoreBuyingOrder: { paraId: "u32", queryId: "u64", ttl: "u32", }, - /** Lookup558: pallet_xcm_core_buyer::pallet::Error */ + /** Lookup559: pallet_xcm_core_buyer::pallet::Error */ PalletXcmCoreBuyerError: { _enum: [ "InvalidProof", @@ -4573,22 +4576,22 @@ export default { "InvalidCollatorSignature", ], }, - /** Lookup563: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ + /** Lookup564: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ FrameSystemExtensionsCheckNonZeroSender: "Null", - /** Lookup564: frame_system::extensions::check_spec_version::CheckSpecVersion */ + /** Lookup565: frame_system::extensions::check_spec_version::CheckSpecVersion */ FrameSystemExtensionsCheckSpecVersion: "Null", - /** Lookup565: frame_system::extensions::check_tx_version::CheckTxVersion */ + /** Lookup566: frame_system::extensions::check_tx_version::CheckTxVersion */ FrameSystemExtensionsCheckTxVersion: "Null", - /** Lookup566: frame_system::extensions::check_genesis::CheckGenesis */ + /** Lookup567: frame_system::extensions::check_genesis::CheckGenesis */ FrameSystemExtensionsCheckGenesis: "Null", - /** Lookup569: frame_system::extensions::check_nonce::CheckNonce */ + /** Lookup570: frame_system::extensions::check_nonce::CheckNonce */ FrameSystemExtensionsCheckNonce: "Compact", - /** Lookup570: frame_system::extensions::check_weight::CheckWeight */ + /** Lookup571: frame_system::extensions::check_weight::CheckWeight */ FrameSystemExtensionsCheckWeight: "Null", - /** Lookup571: pallet_transaction_payment::ChargeTransactionPayment */ + /** Lookup572: pallet_transaction_payment::ChargeTransactionPayment */ PalletTransactionPaymentChargeTransactionPayment: "Compact", - /** Lookup572: cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim */ + /** Lookup573: cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim */ CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim: "Null", - /** Lookup573: dancebox_runtime::Runtime */ + /** Lookup574: dancebox_runtime::Runtime */ DanceboxRuntimeRuntime: "Null", }; diff --git a/typescript-api/src/dancebox/interfaces/types-lookup.ts b/typescript-api/src/dancebox/interfaces/types-lookup.ts index 6f6d97c03..17f793080 100644 --- a/typescript-api/src/dancebox/interfaces/types-lookup.ts +++ b/typescript-api/src/dancebox/interfaces/types-lookup.ts @@ -3595,6 +3595,7 @@ declare module "@polkadot/types/lookup" { readonly asRegister: { readonly paraId: u32; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isDeregister: boolean; readonly asDeregister: { @@ -3617,6 +3618,7 @@ declare module "@polkadot/types/lookup" { readonly paraId: u32; readonly slotFrequency: TpTraitsSlotFrequency; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isSetParathreadParams: boolean; readonly asSetParathreadParams: { @@ -3636,6 +3638,7 @@ declare module "@polkadot/types/lookup" { readonly relayStorageProof: SpTrieStorageProof; readonly managerSignature: SpRuntimeMultiSignature; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isDeregisterWithRelayProof: boolean; readonly asDeregisterWithRelayProof: { @@ -3685,18 +3688,18 @@ declare module "@polkadot/types/lookup" { readonly tokenDecimals: u32; } - /** @name TpTraitsSlotFrequency (299) */ + /** @name TpTraitsSlotFrequency (300) */ interface TpTraitsSlotFrequency extends Struct { readonly min: u32; readonly max: u32; } - /** @name TpTraitsParathreadParams (301) */ + /** @name TpTraitsParathreadParams (302) */ interface TpTraitsParathreadParams extends Struct { readonly slotFrequency: TpTraitsSlotFrequency; } - /** @name PalletConfigurationCall (302) */ + /** @name PalletConfigurationCall (303) */ interface PalletConfigurationCall extends Enum { readonly isSetMaxCollators: boolean; readonly asSetMaxCollators: { @@ -3746,10 +3749,10 @@ declare module "@polkadot/types/lookup" { | "SetBypassConsistencyCheck"; } - /** @name PalletCollatorAssignmentCall (304) */ + /** @name PalletCollatorAssignmentCall (305) */ type PalletCollatorAssignmentCall = Null; - /** @name PalletAuthorNotingCall (305) */ + /** @name PalletAuthorNotingCall (306) */ interface PalletAuthorNotingCall extends Enum { readonly isSetLatestAuthorData: boolean; readonly asSetLatestAuthorData: { @@ -3769,15 +3772,15 @@ declare module "@polkadot/types/lookup" { readonly type: "SetLatestAuthorData" | "SetAuthor" | "KillAuthorData"; } - /** @name TpAuthorNotingInherentOwnParachainInherentData (306) */ + /** @name TpAuthorNotingInherentOwnParachainInherentData (307) */ interface TpAuthorNotingInherentOwnParachainInherentData extends Struct { readonly relayStorageProof: SpTrieStorageProof; } - /** @name PalletAuthorityAssignmentCall (307) */ + /** @name PalletAuthorityAssignmentCall (308) */ type PalletAuthorityAssignmentCall = Null; - /** @name PalletServicesPaymentCall (308) */ + /** @name PalletServicesPaymentCall (309) */ interface PalletServicesPaymentCall extends Enum { readonly isPurchaseCredits: boolean; readonly asPurchaseCredits: { @@ -3824,7 +3827,7 @@ declare module "@polkadot/types/lookup" { | "SetMaxTip"; } - /** @name PalletDataPreserversCall (309) */ + /** @name PalletDataPreserversCall (310) */ interface PalletDataPreserversCall extends Enum { readonly isCreateProfile: boolean; readonly asCreateProfile: { @@ -3882,7 +3885,7 @@ declare module "@polkadot/types/lookup" { | "ForceStartAssignment"; } - /** @name PalletDataPreserversProfile (310) */ + /** @name PalletDataPreserversProfile (311) */ interface PalletDataPreserversProfile extends Struct { readonly url: Bytes; readonly paraIds: PalletDataPreserversParaIdsFilter; @@ -3890,7 +3893,7 @@ declare module "@polkadot/types/lookup" { readonly assignmentRequest: DanceboxRuntimePreserversAssignementPaymentRequest; } - /** @name PalletDataPreserversParaIdsFilter (312) */ + /** @name PalletDataPreserversParaIdsFilter (313) */ interface PalletDataPreserversParaIdsFilter extends Enum { readonly isAnyParaId: boolean; readonly isWhitelist: boolean; @@ -3900,7 +3903,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AnyParaId" | "Whitelist" | "Blacklist"; } - /** @name PalletDataPreserversProfileMode (315) */ + /** @name PalletDataPreserversProfileMode (316) */ interface PalletDataPreserversProfileMode extends Enum { readonly isBootnode: boolean; readonly isRpc: boolean; @@ -3910,25 +3913,25 @@ declare module "@polkadot/types/lookup" { readonly type: "Bootnode" | "Rpc"; } - /** @name DanceboxRuntimePreserversAssignementPaymentRequest (316) */ + /** @name DanceboxRuntimePreserversAssignementPaymentRequest (317) */ interface DanceboxRuntimePreserversAssignementPaymentRequest extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name DanceboxRuntimePreserversAssignementPaymentExtra (317) */ + /** @name DanceboxRuntimePreserversAssignementPaymentExtra (318) */ interface DanceboxRuntimePreserversAssignementPaymentExtra extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name DanceboxRuntimePreserversAssignementPaymentWitness (318) */ + /** @name DanceboxRuntimePreserversAssignementPaymentWitness (319) */ interface DanceboxRuntimePreserversAssignementPaymentWitness extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name PalletInvulnerablesCall (319) */ + /** @name PalletInvulnerablesCall (320) */ interface PalletInvulnerablesCall extends Enum { readonly isAddInvulnerable: boolean; readonly asAddInvulnerable: { @@ -3941,7 +3944,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AddInvulnerable" | "RemoveInvulnerable"; } - /** @name PalletSessionCall (320) */ + /** @name PalletSessionCall (321) */ interface PalletSessionCall extends Enum { readonly isSetKeys: boolean; readonly asSetKeys: { @@ -3952,21 +3955,21 @@ declare module "@polkadot/types/lookup" { readonly type: "SetKeys" | "PurgeKeys"; } - /** @name DanceboxRuntimeSessionKeys (321) */ + /** @name DanceboxRuntimeSessionKeys (322) */ interface DanceboxRuntimeSessionKeys extends Struct { readonly nimbus: NimbusPrimitivesNimbusCryptoPublic; } - /** @name NimbusPrimitivesNimbusCryptoPublic (322) */ + /** @name NimbusPrimitivesNimbusCryptoPublic (323) */ interface NimbusPrimitivesNimbusCryptoPublic extends U8aFixed {} - /** @name PalletAuthorInherentCall (323) */ + /** @name PalletAuthorInherentCall (324) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletPooledStakingCall (324) */ + /** @name PalletPooledStakingCall (325) */ interface PalletPooledStakingCall extends Enum { readonly isRebalanceHold: boolean; readonly asRebalanceHold: { @@ -4014,7 +4017,7 @@ declare module "@polkadot/types/lookup" { | "SwapPool"; } - /** @name PalletPooledStakingAllTargetPool (325) */ + /** @name PalletPooledStakingAllTargetPool (326) */ interface PalletPooledStakingAllTargetPool extends Enum { readonly isJoining: boolean; readonly isAutoCompounding: boolean; @@ -4023,13 +4026,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Joining" | "AutoCompounding" | "ManualRewards" | "Leaving"; } - /** @name PalletPooledStakingPendingOperationQuery (327) */ + /** @name PalletPooledStakingPendingOperationQuery (328) */ interface PalletPooledStakingPendingOperationQuery extends Struct { readonly delegator: AccountId32; readonly operation: PalletPooledStakingPendingOperationKey; } - /** @name PalletPooledStakingPendingOperationKey (328) */ + /** @name PalletPooledStakingPendingOperationKey (329) */ interface PalletPooledStakingPendingOperationKey extends Enum { readonly isJoiningAutoCompounding: boolean; readonly asJoiningAutoCompounding: { @@ -4049,7 +4052,7 @@ declare module "@polkadot/types/lookup" { readonly type: "JoiningAutoCompounding" | "JoiningManualRewards" | "Leaving"; } - /** @name PalletPooledStakingSharesOrStake (329) */ + /** @name PalletPooledStakingSharesOrStake (330) */ interface PalletPooledStakingSharesOrStake extends Enum { readonly isShares: boolean; readonly asShares: u128; @@ -4058,7 +4061,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Shares" | "Stake"; } - /** @name PalletTreasuryCall (332) */ + /** @name PalletTreasuryCall (333) */ interface PalletTreasuryCall extends Enum { readonly isSpendLocal: boolean; readonly asSpendLocal: { @@ -4091,7 +4094,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SpendLocal" | "RemoveApproval" | "Spend" | "Payout" | "CheckStatus" | "VoidSpend"; } - /** @name CumulusPalletXcmpQueueCall (333) */ + /** @name CumulusPalletXcmpQueueCall (334) */ interface CumulusPalletXcmpQueueCall extends Enum { readonly isSuspendXcmExecution: boolean; readonly isResumeXcmExecution: boolean; @@ -4115,7 +4118,7 @@ declare module "@polkadot/types/lookup" { | "UpdateResumeThreshold"; } - /** @name PalletXcmCall (334) */ + /** @name PalletXcmCall (335) */ interface PalletXcmCall extends Enum { readonly isSend: boolean; readonly asSend: { @@ -4218,7 +4221,7 @@ declare module "@polkadot/types/lookup" { | "TransferAssetsUsingTypeAndThen"; } - /** @name XcmVersionedXcm (335) */ + /** @name XcmVersionedXcm (336) */ interface XcmVersionedXcm extends Enum { readonly isV2: boolean; readonly asV2: XcmV2Xcm; @@ -4229,10 +4232,10 @@ declare module "@polkadot/types/lookup" { readonly type: "V2" | "V3" | "V4"; } - /** @name XcmV2Xcm (336) */ + /** @name XcmV2Xcm (337) */ interface XcmV2Xcm extends Vec {} - /** @name XcmV2Instruction (338) */ + /** @name XcmV2Instruction (339) */ interface XcmV2Instruction extends Enum { readonly isWithdrawAsset: boolean; readonly asWithdrawAsset: XcmV2MultiassetMultiAssets; @@ -4380,7 +4383,7 @@ declare module "@polkadot/types/lookup" { | "UnsubscribeVersion"; } - /** @name XcmV2Response (339) */ + /** @name XcmV2Response (340) */ interface XcmV2Response extends Enum { readonly isNull: boolean; readonly isAssets: boolean; @@ -4392,7 +4395,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Null" | "Assets" | "ExecutionResult" | "Version"; } - /** @name XcmV2TraitsError (342) */ + /** @name XcmV2TraitsError (343) */ interface XcmV2TraitsError extends Enum { readonly isOverflow: boolean; readonly isUnimplemented: boolean; @@ -4451,7 +4454,7 @@ declare module "@polkadot/types/lookup" { | "WeightNotComputable"; } - /** @name XcmV2OriginKind (343) */ + /** @name XcmV2OriginKind (344) */ interface XcmV2OriginKind extends Enum { readonly isNative: boolean; readonly isSovereignAccount: boolean; @@ -4460,7 +4463,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Native" | "SovereignAccount" | "Superuser" | "Xcm"; } - /** @name XcmV2MultiassetMultiAssetFilter (344) */ + /** @name XcmV2MultiassetMultiAssetFilter (345) */ interface XcmV2MultiassetMultiAssetFilter extends Enum { readonly isDefinite: boolean; readonly asDefinite: XcmV2MultiassetMultiAssets; @@ -4469,7 +4472,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Definite" | "Wild"; } - /** @name XcmV2MultiassetWildMultiAsset (345) */ + /** @name XcmV2MultiassetWildMultiAsset (346) */ interface XcmV2MultiassetWildMultiAsset extends Enum { readonly isAll: boolean; readonly isAllOf: boolean; @@ -4480,14 +4483,14 @@ declare module "@polkadot/types/lookup" { readonly type: "All" | "AllOf"; } - /** @name XcmV2MultiassetWildFungibility (346) */ + /** @name XcmV2MultiassetWildFungibility (347) */ interface XcmV2MultiassetWildFungibility extends Enum { readonly isFungible: boolean; readonly isNonFungible: boolean; readonly type: "Fungible" | "NonFungible"; } - /** @name XcmV2WeightLimit (347) */ + /** @name XcmV2WeightLimit (348) */ interface XcmV2WeightLimit extends Enum { readonly isUnlimited: boolean; readonly isLimited: boolean; @@ -4495,10 +4498,10 @@ declare module "@polkadot/types/lookup" { readonly type: "Unlimited" | "Limited"; } - /** @name XcmV3Xcm (348) */ + /** @name XcmV3Xcm (349) */ interface XcmV3Xcm extends Vec {} - /** @name XcmV3Instruction (350) */ + /** @name XcmV3Instruction (351) */ interface XcmV3Instruction extends Enum { readonly isWithdrawAsset: boolean; readonly asWithdrawAsset: XcmV3MultiassetMultiAssets; @@ -4728,7 +4731,7 @@ declare module "@polkadot/types/lookup" { | "UnpaidExecution"; } - /** @name XcmV3Response (351) */ + /** @name XcmV3Response (352) */ interface XcmV3Response extends Enum { readonly isNull: boolean; readonly isAssets: boolean; @@ -4744,7 +4747,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Null" | "Assets" | "ExecutionResult" | "Version" | "PalletsInfo" | "DispatchResult"; } - /** @name XcmV3PalletInfo (353) */ + /** @name XcmV3PalletInfo (354) */ interface XcmV3PalletInfo extends Struct { readonly index: Compact; readonly name: Bytes; @@ -4754,14 +4757,14 @@ declare module "@polkadot/types/lookup" { readonly patch: Compact; } - /** @name XcmV3QueryResponseInfo (357) */ + /** @name XcmV3QueryResponseInfo (358) */ interface XcmV3QueryResponseInfo extends Struct { readonly destination: StagingXcmV3MultiLocation; readonly queryId: Compact; readonly maxWeight: SpWeightsWeightV2Weight; } - /** @name XcmV3MultiassetMultiAssetFilter (358) */ + /** @name XcmV3MultiassetMultiAssetFilter (359) */ interface XcmV3MultiassetMultiAssetFilter extends Enum { readonly isDefinite: boolean; readonly asDefinite: XcmV3MultiassetMultiAssets; @@ -4770,7 +4773,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Definite" | "Wild"; } - /** @name XcmV3MultiassetWildMultiAsset (359) */ + /** @name XcmV3MultiassetWildMultiAsset (360) */ interface XcmV3MultiassetWildMultiAsset extends Enum { readonly isAll: boolean; readonly isAllOf: boolean; @@ -4789,14 +4792,14 @@ declare module "@polkadot/types/lookup" { readonly type: "All" | "AllOf" | "AllCounted" | "AllOfCounted"; } - /** @name XcmV3MultiassetWildFungibility (360) */ + /** @name XcmV3MultiassetWildFungibility (361) */ interface XcmV3MultiassetWildFungibility extends Enum { readonly isFungible: boolean; readonly isNonFungible: boolean; readonly type: "Fungible" | "NonFungible"; } - /** @name StagingXcmExecutorAssetTransferTransferType (372) */ + /** @name StagingXcmExecutorAssetTransferTransferType (373) */ interface StagingXcmExecutorAssetTransferTransferType extends Enum { readonly isTeleport: boolean; readonly isLocalReserve: boolean; @@ -4806,7 +4809,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Teleport" | "LocalReserve" | "DestinationReserve" | "RemoteReserve"; } - /** @name XcmVersionedAssetId (373) */ + /** @name XcmVersionedAssetId (374) */ interface XcmVersionedAssetId extends Enum { readonly isV3: boolean; readonly asV3: XcmV3MultiassetAssetId; @@ -4815,7 +4818,7 @@ declare module "@polkadot/types/lookup" { readonly type: "V3" | "V4"; } - /** @name PalletAssetsCall (374) */ + /** @name PalletAssetsCall (375) */ interface PalletAssetsCall extends Enum { readonly isCreate: boolean; readonly asCreate: { @@ -5029,7 +5032,7 @@ declare module "@polkadot/types/lookup" { | "Block"; } - /** @name PalletForeignAssetCreatorCall (375) */ + /** @name PalletForeignAssetCreatorCall (376) */ interface PalletForeignAssetCreatorCall extends Enum { readonly isCreateForeignAsset: boolean; readonly asCreateForeignAsset: { @@ -5059,7 +5062,7 @@ declare module "@polkadot/types/lookup" { | "DestroyForeignAsset"; } - /** @name PalletAssetRateCall (376) */ + /** @name PalletAssetRateCall (377) */ interface PalletAssetRateCall extends Enum { readonly isCreate: boolean; readonly asCreate: { @@ -5078,7 +5081,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Create" | "Update" | "Remove"; } - /** @name PalletMessageQueueCall (377) */ + /** @name PalletMessageQueueCall (378) */ interface PalletMessageQueueCall extends Enum { readonly isReapPage: boolean; readonly asReapPage: { @@ -5095,7 +5098,7 @@ declare module "@polkadot/types/lookup" { readonly type: "ReapPage" | "ExecuteOverweight"; } - /** @name PalletXcmCoreBuyerCall (378) */ + /** @name PalletXcmCoreBuyerCall (379) */ interface PalletXcmCoreBuyerCall extends Enum { readonly isBuyCore: boolean; readonly asBuyCore: { @@ -5137,30 +5140,30 @@ declare module "@polkadot/types/lookup" { | "CleanUpExpiredInFlightOrders"; } - /** @name TpXcmCoreBuyerBuyCoreCollatorProof (379) */ + /** @name TpXcmCoreBuyerBuyCoreCollatorProof (380) */ interface TpXcmCoreBuyerBuyCoreCollatorProof extends Struct { readonly nonce: u64; readonly publicKey: NimbusPrimitivesNimbusCryptoPublic; readonly signature: NimbusPrimitivesNimbusCryptoSignature; } - /** @name NimbusPrimitivesNimbusCryptoSignature (380) */ + /** @name NimbusPrimitivesNimbusCryptoSignature (381) */ interface NimbusPrimitivesNimbusCryptoSignature extends U8aFixed {} - /** @name PalletXcmCoreBuyerRelayXcmWeightConfigInner (382) */ + /** @name PalletXcmCoreBuyerRelayXcmWeightConfigInner (383) */ interface PalletXcmCoreBuyerRelayXcmWeightConfigInner extends Struct { readonly buyExecutionCost: u128; readonly weightAtMost: SpWeightsWeightV2Weight; } - /** @name DanceboxRuntimeXcmConfigRelayChain (384) */ + /** @name DanceboxRuntimeXcmConfigRelayChain (385) */ interface DanceboxRuntimeXcmConfigRelayChain extends Enum { readonly isWestend: boolean; readonly isRococo: boolean; readonly type: "Westend" | "Rococo"; } - /** @name PalletRootTestingCall (385) */ + /** @name PalletRootTestingCall (386) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -5170,33 +5173,33 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock" | "TriggerDefensive"; } - /** @name PalletSudoError (386) */ + /** @name PalletSudoError (387) */ interface PalletSudoError extends Enum { readonly isRequireSudo: boolean; readonly type: "RequireSudo"; } - /** @name PalletUtilityError (387) */ + /** @name PalletUtilityError (388) */ interface PalletUtilityError extends Enum { readonly isTooManyCalls: boolean; readonly type: "TooManyCalls"; } - /** @name PalletProxyProxyDefinition (390) */ + /** @name PalletProxyProxyDefinition (391) */ interface PalletProxyProxyDefinition extends Struct { readonly delegate: AccountId32; readonly proxyType: DanceboxRuntimeProxyType; readonly delay: u32; } - /** @name PalletProxyAnnouncement (394) */ + /** @name PalletProxyAnnouncement (395) */ interface PalletProxyAnnouncement extends Struct { readonly real: AccountId32; readonly callHash: H256; readonly height: u32; } - /** @name PalletProxyError (396) */ + /** @name PalletProxyError (397) */ interface PalletProxyError extends Enum { readonly isTooMany: boolean; readonly isNotFound: boolean; @@ -5217,7 +5220,7 @@ declare module "@polkadot/types/lookup" { | "NoSelfProxy"; } - /** @name PalletMigrationsError (397) */ + /** @name PalletMigrationsError (398) */ interface PalletMigrationsError extends Enum { readonly isPreimageMissing: boolean; readonly isWrongUpperBound: boolean; @@ -5226,14 +5229,14 @@ declare module "@polkadot/types/lookup" { readonly type: "PreimageMissing" | "WrongUpperBound" | "PreimageIsTooBig" | "PreimageAlreadyExists"; } - /** @name PalletMaintenanceModeError (398) */ + /** @name PalletMaintenanceModeError (399) */ interface PalletMaintenanceModeError extends Enum { readonly isAlreadyInMaintenanceMode: boolean; readonly isNotInMaintenanceMode: boolean; readonly type: "AlreadyInMaintenanceMode" | "NotInMaintenanceMode"; } - /** @name PalletTxPauseError (399) */ + /** @name PalletTxPauseError (400) */ interface PalletTxPauseError extends Enum { readonly isIsPaused: boolean; readonly isIsUnpaused: boolean; @@ -5242,14 +5245,14 @@ declare module "@polkadot/types/lookup" { readonly type: "IsPaused" | "IsUnpaused" | "Unpausable" | "NotFound"; } - /** @name PalletBalancesBalanceLock (401) */ + /** @name PalletBalancesBalanceLock (402) */ interface PalletBalancesBalanceLock extends Struct { readonly id: U8aFixed; readonly amount: u128; readonly reasons: PalletBalancesReasons; } - /** @name PalletBalancesReasons (402) */ + /** @name PalletBalancesReasons (403) */ interface PalletBalancesReasons extends Enum { readonly isFee: boolean; readonly isMisc: boolean; @@ -5257,19 +5260,19 @@ declare module "@polkadot/types/lookup" { readonly type: "Fee" | "Misc" | "All"; } - /** @name PalletBalancesReserveData (405) */ + /** @name PalletBalancesReserveData (406) */ interface PalletBalancesReserveData extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name FrameSupportTokensMiscIdAmountRuntimeHoldReason (408) */ + /** @name FrameSupportTokensMiscIdAmountRuntimeHoldReason (409) */ interface FrameSupportTokensMiscIdAmountRuntimeHoldReason extends Struct { readonly id: DanceboxRuntimeRuntimeHoldReason; readonly amount: u128; } - /** @name DanceboxRuntimeRuntimeHoldReason (409) */ + /** @name DanceboxRuntimeRuntimeHoldReason (410) */ interface DanceboxRuntimeRuntimeHoldReason extends Enum { readonly isStreamPayment: boolean; readonly asStreamPayment: PalletStreamPaymentHoldReason; @@ -5282,51 +5285,51 @@ declare module "@polkadot/types/lookup" { readonly type: "StreamPayment" | "Registrar" | "DataPreservers" | "PooledStaking"; } - /** @name PalletStreamPaymentHoldReason (410) */ + /** @name PalletStreamPaymentHoldReason (411) */ interface PalletStreamPaymentHoldReason extends Enum { readonly isStreamPayment: boolean; readonly isStreamOpened: boolean; readonly type: "StreamPayment" | "StreamOpened"; } - /** @name PalletRegistrarHoldReason (411) */ + /** @name PalletRegistrarHoldReason (412) */ interface PalletRegistrarHoldReason extends Enum { readonly isRegistrarDeposit: boolean; readonly type: "RegistrarDeposit"; } - /** @name PalletDataPreserversHoldReason (412) */ + /** @name PalletDataPreserversHoldReason (413) */ interface PalletDataPreserversHoldReason extends Enum { readonly isProfileDeposit: boolean; readonly type: "ProfileDeposit"; } - /** @name PalletPooledStakingHoldReason (413) */ + /** @name PalletPooledStakingHoldReason (414) */ interface PalletPooledStakingHoldReason extends Enum { readonly isPooledStake: boolean; readonly type: "PooledStake"; } - /** @name FrameSupportTokensMiscIdAmountRuntimeFreezeReason (416) */ + /** @name FrameSupportTokensMiscIdAmountRuntimeFreezeReason (417) */ interface FrameSupportTokensMiscIdAmountRuntimeFreezeReason extends Struct { readonly id: DanceboxRuntimeRuntimeFreezeReason; readonly amount: u128; } - /** @name DanceboxRuntimeRuntimeFreezeReason (417) */ + /** @name DanceboxRuntimeRuntimeFreezeReason (418) */ interface DanceboxRuntimeRuntimeFreezeReason extends Enum { readonly isStreamPayment: boolean; readonly asStreamPayment: PalletStreamPaymentFreezeReason; readonly type: "StreamPayment"; } - /** @name PalletStreamPaymentFreezeReason (418) */ + /** @name PalletStreamPaymentFreezeReason (419) */ interface PalletStreamPaymentFreezeReason extends Enum { readonly isStreamPayment: boolean; readonly type: "StreamPayment"; } - /** @name PalletBalancesError (420) */ + /** @name PalletBalancesError (421) */ interface PalletBalancesError extends Enum { readonly isVestingBalance: boolean; readonly isLiquidityRestrictions: boolean; @@ -5355,14 +5358,14 @@ declare module "@polkadot/types/lookup" { | "DeltaZero"; } - /** @name PalletTransactionPaymentReleases (421) */ + /** @name PalletTransactionPaymentReleases (422) */ interface PalletTransactionPaymentReleases extends Enum { readonly isV1Ancient: boolean; readonly isV2: boolean; readonly type: "V1Ancient" | "V2"; } - /** @name PalletStreamPaymentStream (422) */ + /** @name PalletStreamPaymentStream (423) */ interface PalletStreamPaymentStream extends Struct { readonly source: AccountId32; readonly target: AccountId32; @@ -5374,7 +5377,7 @@ declare module "@polkadot/types/lookup" { readonly openingDeposit: u128; } - /** @name PalletStreamPaymentChangeRequest (424) */ + /** @name PalletStreamPaymentChangeRequest (425) */ interface PalletStreamPaymentChangeRequest extends Struct { readonly requester: PalletStreamPaymentParty; readonly kind: PalletStreamPaymentChangeKind; @@ -5382,7 +5385,7 @@ declare module "@polkadot/types/lookup" { readonly depositChange: Option; } - /** @name PalletStreamPaymentError (426) */ + /** @name PalletStreamPaymentError (427) */ interface PalletStreamPaymentError extends Enum { readonly isUnknownStreamId: boolean; readonly isStreamIdOverflow: boolean; @@ -5421,27 +5424,27 @@ declare module "@polkadot/types/lookup" { | "CantFetchStatusBeforeLastTimeUpdated"; } - /** @name PalletIdentityRegistration (428) */ + /** @name PalletIdentityRegistration (429) */ interface PalletIdentityRegistration extends Struct { readonly judgements: Vec>; readonly deposit: u128; readonly info: PalletIdentityLegacyIdentityInfo; } - /** @name PalletIdentityRegistrarInfo (437) */ + /** @name PalletIdentityRegistrarInfo (438) */ interface PalletIdentityRegistrarInfo extends Struct { readonly account: AccountId32; readonly fee: u128; readonly fields: u64; } - /** @name PalletIdentityAuthorityProperties (439) */ + /** @name PalletIdentityAuthorityProperties (440) */ interface PalletIdentityAuthorityProperties extends Struct { readonly suffix: Bytes; readonly allocation: u32; } - /** @name PalletIdentityError (442) */ + /** @name PalletIdentityError (443) */ interface PalletIdentityError extends Enum { readonly isTooManySubAccounts: boolean; readonly isNotFound: boolean; @@ -5498,7 +5501,7 @@ declare module "@polkadot/types/lookup" { | "NotExpired"; } - /** @name PalletMultisigMultisig (444) */ + /** @name PalletMultisigMultisig (445) */ interface PalletMultisigMultisig extends Struct { readonly when: PalletMultisigTimepoint; readonly deposit: u128; @@ -5506,7 +5509,7 @@ declare module "@polkadot/types/lookup" { readonly approvals: Vec; } - /** @name PalletMultisigError (446) */ + /** @name PalletMultisigError (447) */ interface PalletMultisigError extends Enum { readonly isMinimumThreshold: boolean; readonly isAlreadyApproved: boolean; @@ -5539,13 +5542,13 @@ declare module "@polkadot/types/lookup" { | "AlreadyStored"; } - /** @name PalletRegistrarDepositInfo (455) */ + /** @name PalletRegistrarDepositInfo (456) */ interface PalletRegistrarDepositInfo extends Struct { readonly creator: AccountId32; readonly deposit: u128; } - /** @name PalletRegistrarError (456) */ + /** @name PalletRegistrarError (457) */ interface PalletRegistrarError extends Enum { readonly isParaIdAlreadyRegistered: boolean; readonly isParaIdNotRegistered: boolean; @@ -5580,7 +5583,7 @@ declare module "@polkadot/types/lookup" { | "ParaStillExistsInRelay"; } - /** @name PalletConfigurationHostConfiguration (457) */ + /** @name PalletConfigurationHostConfiguration (458) */ interface PalletConfigurationHostConfiguration extends Struct { readonly maxCollators: u32; readonly minOrchestratorCollators: u32; @@ -5592,26 +5595,26 @@ declare module "@polkadot/types/lookup" { readonly targetContainerChainFullness: Perbill; } - /** @name PalletConfigurationError (460) */ + /** @name PalletConfigurationError (461) */ interface PalletConfigurationError extends Enum { readonly isInvalidNewValue: boolean; readonly type: "InvalidNewValue"; } - /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (461) */ + /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (462) */ interface DpCollatorAssignmentAssignedCollatorsAccountId32 extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name TpTraitsContainerChainBlockInfo (466) */ + /** @name TpTraitsContainerChainBlockInfo (467) */ interface TpTraitsContainerChainBlockInfo extends Struct { readonly blockNumber: u32; readonly author: AccountId32; readonly latestSlotNumber: u64; } - /** @name PalletAuthorNotingError (467) */ + /** @name PalletAuthorNotingError (468) */ interface PalletAuthorNotingError extends Enum { readonly isFailedReading: boolean; readonly isFailedDecodingHeader: boolean; @@ -5630,13 +5633,13 @@ declare module "@polkadot/types/lookup" { | "NonAuraDigest"; } - /** @name DpCollatorAssignmentAssignedCollatorsPublic (468) */ + /** @name DpCollatorAssignmentAssignedCollatorsPublic (469) */ interface DpCollatorAssignmentAssignedCollatorsPublic extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletServicesPaymentError (473) */ + /** @name PalletServicesPaymentError (474) */ interface PalletServicesPaymentError extends Enum { readonly isInsufficientFundsToPurchaseCredits: boolean; readonly isInsufficientCredits: boolean; @@ -5644,7 +5647,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InsufficientFundsToPurchaseCredits" | "InsufficientCredits" | "CreditPriceTooExpensive"; } - /** @name PalletDataPreserversRegisteredProfile (474) */ + /** @name PalletDataPreserversRegisteredProfile (475) */ interface PalletDataPreserversRegisteredProfile extends Struct { readonly account: AccountId32; readonly deposit: u128; @@ -5652,7 +5655,7 @@ declare module "@polkadot/types/lookup" { readonly assignment: Option>; } - /** @name PalletDataPreserversError (480) */ + /** @name PalletDataPreserversError (481) */ interface PalletDataPreserversError extends Enum { readonly isNoBootNodes: boolean; readonly isUnknownProfileId: boolean; @@ -5677,7 +5680,7 @@ declare module "@polkadot/types/lookup" { | "CantDeleteAssignedProfile"; } - /** @name PalletInvulnerablesError (482) */ + /** @name PalletInvulnerablesError (483) */ interface PalletInvulnerablesError extends Enum { readonly isTooManyInvulnerables: boolean; readonly isAlreadyInvulnerable: boolean; @@ -5692,10 +5695,10 @@ declare module "@polkadot/types/lookup" { | "UnableToDeriveCollatorId"; } - /** @name SpCoreCryptoKeyTypeId (487) */ + /** @name SpCoreCryptoKeyTypeId (488) */ interface SpCoreCryptoKeyTypeId extends U8aFixed {} - /** @name PalletSessionError (488) */ + /** @name PalletSessionError (489) */ interface PalletSessionError extends Enum { readonly isInvalidProof: boolean; readonly isNoAssociatedValidatorId: boolean; @@ -5705,7 +5708,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InvalidProof" | "NoAssociatedValidatorId" | "DuplicatedKey" | "NoKeys" | "NoAccount"; } - /** @name PalletAuthorInherentError (492) */ + /** @name PalletAuthorInherentError (493) */ interface PalletAuthorInherentError extends Enum { readonly isAuthorAlreadySet: boolean; readonly isNoAccountId: boolean; @@ -5713,13 +5716,13 @@ declare module "@polkadot/types/lookup" { readonly type: "AuthorAlreadySet" | "NoAccountId" | "CannotBeAuthor"; } - /** @name PalletPooledStakingCandidateEligibleCandidate (494) */ + /** @name PalletPooledStakingCandidateEligibleCandidate (495) */ interface PalletPooledStakingCandidateEligibleCandidate extends Struct { readonly candidate: AccountId32; readonly stake: u128; } - /** @name PalletPooledStakingPoolsKey (497) */ + /** @name PalletPooledStakingPoolsKey (498) */ interface PalletPooledStakingPoolsKey extends Enum { readonly isCandidateTotalStake: boolean; readonly isJoiningShares: boolean; @@ -5789,7 +5792,7 @@ declare module "@polkadot/types/lookup" { | "LeavingSharesHeldStake"; } - /** @name PalletPooledStakingError (499) */ + /** @name PalletPooledStakingError (500) */ interface PalletPooledStakingError extends Enum { readonly isInvalidPalletSetting: boolean; readonly isDisabledFeature: boolean; @@ -5823,13 +5826,13 @@ declare module "@polkadot/types/lookup" { | "SwapResultsInZeroShares"; } - /** @name PalletInflationRewardsChainsToRewardValue (500) */ + /** @name PalletInflationRewardsChainsToRewardValue (501) */ interface PalletInflationRewardsChainsToRewardValue extends Struct { readonly paraIds: Vec; readonly rewardsPerChain: u128; } - /** @name PalletTreasuryProposal (501) */ + /** @name PalletTreasuryProposal (502) */ interface PalletTreasuryProposal extends Struct { readonly proposer: AccountId32; readonly value: u128; @@ -5837,7 +5840,7 @@ declare module "@polkadot/types/lookup" { readonly bond: u128; } - /** @name PalletTreasurySpendStatus (503) */ + /** @name PalletTreasurySpendStatus (504) */ interface PalletTreasurySpendStatus extends Struct { readonly assetKind: Null; readonly amount: u128; @@ -5847,7 +5850,7 @@ declare module "@polkadot/types/lookup" { readonly status: PalletTreasuryPaymentState; } - /** @name PalletTreasuryPaymentState (504) */ + /** @name PalletTreasuryPaymentState (505) */ interface PalletTreasuryPaymentState extends Enum { readonly isPending: boolean; readonly isAttempted: boolean; @@ -5858,10 +5861,10 @@ declare module "@polkadot/types/lookup" { readonly type: "Pending" | "Attempted" | "Failed"; } - /** @name FrameSupportPalletId (506) */ + /** @name FrameSupportPalletId (507) */ interface FrameSupportPalletId extends U8aFixed {} - /** @name PalletTreasuryError (507) */ + /** @name PalletTreasuryError (508) */ interface PalletTreasuryError extends Enum { readonly isInvalidIndex: boolean; readonly isTooManyApprovals: boolean; @@ -5888,7 +5891,7 @@ declare module "@polkadot/types/lookup" { | "Inconclusive"; } - /** @name CumulusPalletXcmpQueueOutboundChannelDetails (510) */ + /** @name CumulusPalletXcmpQueueOutboundChannelDetails (511) */ interface CumulusPalletXcmpQueueOutboundChannelDetails extends Struct { readonly recipient: u32; readonly state: CumulusPalletXcmpQueueOutboundState; @@ -5897,21 +5900,21 @@ declare module "@polkadot/types/lookup" { readonly lastIndex: u16; } - /** @name CumulusPalletXcmpQueueOutboundState (511) */ + /** @name CumulusPalletXcmpQueueOutboundState (512) */ interface CumulusPalletXcmpQueueOutboundState extends Enum { readonly isOk: boolean; readonly isSuspended: boolean; readonly type: "Ok" | "Suspended"; } - /** @name CumulusPalletXcmpQueueQueueConfigData (515) */ + /** @name CumulusPalletXcmpQueueQueueConfigData (516) */ interface CumulusPalletXcmpQueueQueueConfigData extends Struct { readonly suspendThreshold: u32; readonly dropThreshold: u32; readonly resumeThreshold: u32; } - /** @name CumulusPalletXcmpQueueError (516) */ + /** @name CumulusPalletXcmpQueueError (517) */ interface CumulusPalletXcmpQueueError extends Enum { readonly isBadQueueConfig: boolean; readonly isAlreadySuspended: boolean; @@ -5926,7 +5929,7 @@ declare module "@polkadot/types/lookup" { | "TooBig"; } - /** @name PalletXcmQueryStatus (517) */ + /** @name PalletXcmQueryStatus (518) */ interface PalletXcmQueryStatus extends Enum { readonly isPending: boolean; readonly asPending: { @@ -5948,7 +5951,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Pending" | "VersionNotifier" | "Ready"; } - /** @name XcmVersionedResponse (521) */ + /** @name XcmVersionedResponse (522) */ interface XcmVersionedResponse extends Enum { readonly isV2: boolean; readonly asV2: XcmV2Response; @@ -5959,7 +5962,7 @@ declare module "@polkadot/types/lookup" { readonly type: "V2" | "V3" | "V4"; } - /** @name PalletXcmVersionMigrationStage (527) */ + /** @name PalletXcmVersionMigrationStage (528) */ interface PalletXcmVersionMigrationStage extends Enum { readonly isMigrateSupportedVersion: boolean; readonly isMigrateVersionNotifiers: boolean; @@ -5973,7 +5976,7 @@ declare module "@polkadot/types/lookup" { | "MigrateAndNotifyOldTargets"; } - /** @name PalletXcmRemoteLockedFungibleRecord (529) */ + /** @name PalletXcmRemoteLockedFungibleRecord (530) */ interface PalletXcmRemoteLockedFungibleRecord extends Struct { readonly amount: u128; readonly owner: XcmVersionedLocation; @@ -5981,7 +5984,7 @@ declare module "@polkadot/types/lookup" { readonly consumers: Vec>; } - /** @name PalletXcmError (536) */ + /** @name PalletXcmError (537) */ interface PalletXcmError extends Enum { readonly isUnreachable: boolean; readonly isSendFailure: boolean; @@ -6034,7 +6037,7 @@ declare module "@polkadot/types/lookup" { | "LocalExecutionIncomplete"; } - /** @name PalletAssetsAssetDetails (537) */ + /** @name PalletAssetsAssetDetails (538) */ interface PalletAssetsAssetDetails extends Struct { readonly owner: AccountId32; readonly issuer: AccountId32; @@ -6050,7 +6053,7 @@ declare module "@polkadot/types/lookup" { readonly status: PalletAssetsAssetStatus; } - /** @name PalletAssetsAssetStatus (538) */ + /** @name PalletAssetsAssetStatus (539) */ interface PalletAssetsAssetStatus extends Enum { readonly isLive: boolean; readonly isFrozen: boolean; @@ -6058,7 +6061,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Live" | "Frozen" | "Destroying"; } - /** @name PalletAssetsAssetAccount (540) */ + /** @name PalletAssetsAssetAccount (541) */ interface PalletAssetsAssetAccount extends Struct { readonly balance: u128; readonly status: PalletAssetsAccountStatus; @@ -6066,7 +6069,7 @@ declare module "@polkadot/types/lookup" { readonly extra: Null; } - /** @name PalletAssetsAccountStatus (541) */ + /** @name PalletAssetsAccountStatus (542) */ interface PalletAssetsAccountStatus extends Enum { readonly isLiquid: boolean; readonly isFrozen: boolean; @@ -6074,7 +6077,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Liquid" | "Frozen" | "Blocked"; } - /** @name PalletAssetsExistenceReason (542) */ + /** @name PalletAssetsExistenceReason (543) */ interface PalletAssetsExistenceReason extends Enum { readonly isConsumer: boolean; readonly isSufficient: boolean; @@ -6086,13 +6089,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Consumer" | "Sufficient" | "DepositHeld" | "DepositRefunded" | "DepositFrom"; } - /** @name PalletAssetsApproval (544) */ + /** @name PalletAssetsApproval (545) */ interface PalletAssetsApproval extends Struct { readonly amount: u128; readonly deposit: u128; } - /** @name PalletAssetsAssetMetadata (545) */ + /** @name PalletAssetsAssetMetadata (546) */ interface PalletAssetsAssetMetadata extends Struct { readonly deposit: u128; readonly name: Bytes; @@ -6101,7 +6104,7 @@ declare module "@polkadot/types/lookup" { readonly isFrozen: bool; } - /** @name PalletAssetsError (547) */ + /** @name PalletAssetsError (548) */ interface PalletAssetsError extends Enum { readonly isBalanceLow: boolean; readonly isNoAccount: boolean; @@ -6148,14 +6151,14 @@ declare module "@polkadot/types/lookup" { | "BadAssetId"; } - /** @name PalletForeignAssetCreatorError (548) */ + /** @name PalletForeignAssetCreatorError (549) */ interface PalletForeignAssetCreatorError extends Enum { readonly isAssetAlreadyExists: boolean; readonly isAssetDoesNotExist: boolean; readonly type: "AssetAlreadyExists" | "AssetDoesNotExist"; } - /** @name PalletAssetRateError (549) */ + /** @name PalletAssetRateError (550) */ interface PalletAssetRateError extends Enum { readonly isUnknownAssetKind: boolean; readonly isAlreadyExists: boolean; @@ -6163,7 +6166,7 @@ declare module "@polkadot/types/lookup" { readonly type: "UnknownAssetKind" | "AlreadyExists" | "Overflow"; } - /** @name PalletMessageQueueBookState (550) */ + /** @name PalletMessageQueueBookState (551) */ interface PalletMessageQueueBookState extends Struct { readonly begin: u32; readonly end: u32; @@ -6173,13 +6176,13 @@ declare module "@polkadot/types/lookup" { readonly size_: u64; } - /** @name PalletMessageQueueNeighbours (552) */ + /** @name PalletMessageQueueNeighbours (553) */ interface PalletMessageQueueNeighbours extends Struct { readonly prev: CumulusPrimitivesCoreAggregateMessageOrigin; readonly next: CumulusPrimitivesCoreAggregateMessageOrigin; } - /** @name PalletMessageQueuePage (554) */ + /** @name PalletMessageQueuePage (555) */ interface PalletMessageQueuePage extends Struct { readonly remaining: u32; readonly remainingSize: u32; @@ -6189,7 +6192,7 @@ declare module "@polkadot/types/lookup" { readonly heap: Bytes; } - /** @name PalletMessageQueueError (556) */ + /** @name PalletMessageQueueError (557) */ interface PalletMessageQueueError extends Enum { readonly isNotReapable: boolean; readonly isNoPage: boolean; @@ -6212,14 +6215,14 @@ declare module "@polkadot/types/lookup" { | "RecursiveDisallowed"; } - /** @name PalletXcmCoreBuyerInFlightCoreBuyingOrder (557) */ + /** @name PalletXcmCoreBuyerInFlightCoreBuyingOrder (558) */ interface PalletXcmCoreBuyerInFlightCoreBuyingOrder extends Struct { readonly paraId: u32; readonly queryId: u64; readonly ttl: u32; } - /** @name PalletXcmCoreBuyerError (558) */ + /** @name PalletXcmCoreBuyerError (559) */ interface PalletXcmCoreBuyerError extends Enum { readonly isInvalidProof: boolean; readonly isErrorValidatingXCM: boolean; @@ -6258,30 +6261,30 @@ declare module "@polkadot/types/lookup" { | "InvalidCollatorSignature"; } - /** @name FrameSystemExtensionsCheckNonZeroSender (563) */ + /** @name FrameSystemExtensionsCheckNonZeroSender (564) */ type FrameSystemExtensionsCheckNonZeroSender = Null; - /** @name FrameSystemExtensionsCheckSpecVersion (564) */ + /** @name FrameSystemExtensionsCheckSpecVersion (565) */ type FrameSystemExtensionsCheckSpecVersion = Null; - /** @name FrameSystemExtensionsCheckTxVersion (565) */ + /** @name FrameSystemExtensionsCheckTxVersion (566) */ type FrameSystemExtensionsCheckTxVersion = Null; - /** @name FrameSystemExtensionsCheckGenesis (566) */ + /** @name FrameSystemExtensionsCheckGenesis (567) */ type FrameSystemExtensionsCheckGenesis = Null; - /** @name FrameSystemExtensionsCheckNonce (569) */ + /** @name FrameSystemExtensionsCheckNonce (570) */ interface FrameSystemExtensionsCheckNonce extends Compact {} - /** @name FrameSystemExtensionsCheckWeight (570) */ + /** @name FrameSystemExtensionsCheckWeight (571) */ type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTransactionPaymentChargeTransactionPayment (571) */ + /** @name PalletTransactionPaymentChargeTransactionPayment (572) */ interface PalletTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim (572) */ + /** @name CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim (573) */ type CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim = Null; - /** @name DanceboxRuntimeRuntime (573) */ + /** @name DanceboxRuntimeRuntime (574) */ type DanceboxRuntimeRuntime = Null; } // declare module diff --git a/typescript-api/src/flashbox/interfaces/augment-api-query.ts b/typescript-api/src/flashbox/interfaces/augment-api-query.ts index 7dba777b4..2e141d706 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-query.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-query.ts @@ -642,6 +642,24 @@ declare module "@polkadot/api-base/types/storage" { [key: string]: QueryableStorageEntry; }; registrar: { + /** + * This storage aims to act as a 'buffer' for paraIds that must be deregistered at the end of the block execution + * by calling 'T::InnerRegistrar::deregister()' implementation. + * + * We need this buffer because when we are using this pallet on a relay-chain environment like Starlight (where + * 'T::InnerRegistrar' implementation is usually the 'paras_registrar' pallet) we need to deregister (via + * 'paras_registrar::deregister') the same paraIds we have in 'PendingToRemove', and we need to do this + * deregistration process inside 'on_finalize' hook. + * + * It can be the case that some paraIds need to be downgraded to a parathread before deregistering on + * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block finalizes. + * + * Therefore, if we tried to perform this relay deregistration process at the beginning of the session/block + * inside ('on_initialize') initializer_on_new_session() as we do for this pallet, it would fail due to the + * downgrade process could have not taken place yet. + */ + bufferedParasToDeregister: AugmentedQuery Observable>, []> & + QueryableStorageEntry; paraGenesisData: AugmentedQuery< ApiType, ( diff --git a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts index 583276812..07c45d28e 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts @@ -1504,9 +1504,10 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, - [u32, DpContainerChainGenesisDataContainerChainGenesisData] + [u32, DpContainerChainGenesisDataContainerChainGenesisData, Option] >; /** Register parathread */ registerParathread: AugmentedSubmittable< @@ -1517,9 +1518,10 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, - [u32, TpTraitsSlotFrequency, DpContainerChainGenesisDataContainerChainGenesisData] + [u32, TpTraitsSlotFrequency, DpContainerChainGenesisDataContainerChainGenesisData, Option] >; /** Register parachain or parathread */ registerWithRelayProof: AugmentedSubmittable< @@ -1545,7 +1547,8 @@ declare module "@polkadot/api-base/types/submittable" { | DpContainerChainGenesisDataContainerChainGenesisData | { storage?: any; name?: any; id?: any; forkId?: any; extensions?: any; properties?: any } | string - | Uint8Array + | Uint8Array, + headData: Option | null | Uint8Array | Bytes | string ) => SubmittableExtrinsic, [ u32, @@ -1553,7 +1556,8 @@ declare module "@polkadot/api-base/types/submittable" { u32, SpTrieStorageProof, SpRuntimeMultiSignature, - DpContainerChainGenesisDataContainerChainGenesisData + DpContainerChainGenesisDataContainerChainGenesisData, + Option ] >; setParaManager: AugmentedSubmittable< diff --git a/typescript-api/src/flashbox/interfaces/lookup.ts b/typescript-api/src/flashbox/interfaces/lookup.ts index a3302038f..27492cb13 100644 --- a/typescript-api/src/flashbox/interfaces/lookup.ts +++ b/typescript-api/src/flashbox/interfaces/lookup.ts @@ -1414,6 +1414,7 @@ export default { register: { paraId: "u32", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, deregister: { paraId: "u32", @@ -1432,6 +1433,7 @@ export default { paraId: "u32", slotFrequency: "TpTraitsSlotFrequency", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, set_parathread_params: { paraId: "u32", @@ -1448,6 +1450,7 @@ export default { relayStorageProof: "SpTrieStorageProof", managerSignature: "SpRuntimeMultiSignature", genesisData: "DpContainerChainGenesisDataContainerChainGenesisData", + headData: "Option", }, deregister_with_relay_proof: { paraId: "u32", @@ -1481,16 +1484,16 @@ export default { ss58Format: "u32", tokenDecimals: "u32", }, - /** Lookup215: tp_traits::SlotFrequency */ + /** Lookup216: tp_traits::SlotFrequency */ TpTraitsSlotFrequency: { min: "u32", max: "u32", }, - /** Lookup217: tp_traits::ParathreadParams */ + /** Lookup218: tp_traits::ParathreadParams */ TpTraitsParathreadParams: { slotFrequency: "TpTraitsSlotFrequency", }, - /** Lookup218: pallet_configuration::pallet::Call */ + /** Lookup219: pallet_configuration::pallet::Call */ PalletConfigurationCall: { _enum: { set_max_collators: { @@ -1585,9 +1588,9 @@ export default { }, }, }, - /** Lookup220: pallet_collator_assignment::pallet::Call */ + /** Lookup221: pallet_collator_assignment::pallet::Call */ PalletCollatorAssignmentCall: "Null", - /** Lookup221: pallet_author_noting::pallet::Call */ + /** Lookup222: pallet_author_noting::pallet::Call */ PalletAuthorNotingCall: { _enum: { set_latest_author_data: { @@ -1604,13 +1607,13 @@ export default { }, }, }, - /** Lookup222: tp_author_noting_inherent::OwnParachainInherentData */ + /** Lookup223: tp_author_noting_inherent::OwnParachainInherentData */ TpAuthorNotingInherentOwnParachainInherentData: { relayStorageProof: "SpTrieStorageProof", }, - /** Lookup223: pallet_authority_assignment::pallet::Call */ + /** Lookup224: pallet_authority_assignment::pallet::Call */ PalletAuthorityAssignmentCall: "Null", - /** Lookup224: pallet_services_payment::pallet::Call */ + /** Lookup225: pallet_services_payment::pallet::Call */ PalletServicesPaymentCall: { _enum: { purchase_credits: { @@ -1643,7 +1646,7 @@ export default { }, }, }, - /** Lookup225: pallet_data_preservers::pallet::Call */ + /** Lookup226: pallet_data_preservers::pallet::Call */ PalletDataPreserversCall: { _enum: { __Unused0: "Null", @@ -1684,14 +1687,14 @@ export default { }, }, }, - /** Lookup226: pallet_data_preservers::types::Profile */ + /** Lookup227: pallet_data_preservers::types::Profile */ PalletDataPreserversProfile: { url: "Bytes", paraIds: "PalletDataPreserversParaIdsFilter", mode: "PalletDataPreserversProfileMode", assignmentRequest: "FlashboxRuntimePreserversAssignementPaymentRequest", }, - /** Lookup228: pallet_data_preservers::types::ParaIdsFilter */ + /** Lookup229: pallet_data_preservers::types::ParaIdsFilter */ PalletDataPreserversParaIdsFilter: { _enum: { AnyParaId: "Null", @@ -1699,7 +1702,7 @@ export default { Blacklist: "BTreeSet", }, }, - /** Lookup232: pallet_data_preservers::types::ProfileMode */ + /** Lookup233: pallet_data_preservers::types::ProfileMode */ PalletDataPreserversProfileMode: { _enum: { Bootnode: "Null", @@ -1708,19 +1711,19 @@ export default { }, }, }, - /** Lookup233: flashbox_runtime::PreserversAssignementPaymentRequest */ + /** Lookup234: flashbox_runtime::PreserversAssignementPaymentRequest */ FlashboxRuntimePreserversAssignementPaymentRequest: { _enum: ["Free"], }, - /** Lookup234: flashbox_runtime::PreserversAssignementPaymentExtra */ + /** Lookup235: flashbox_runtime::PreserversAssignementPaymentExtra */ FlashboxRuntimePreserversAssignementPaymentExtra: { _enum: ["Free"], }, - /** Lookup235: flashbox_runtime::PreserversAssignementPaymentWitness */ + /** Lookup236: flashbox_runtime::PreserversAssignementPaymentWitness */ FlashboxRuntimePreserversAssignementPaymentWitness: { _enum: ["Free"], }, - /** Lookup236: pallet_invulnerables::pallet::Call */ + /** Lookup237: pallet_invulnerables::pallet::Call */ PalletInvulnerablesCall: { _enum: { __Unused0: "Null", @@ -1732,7 +1735,7 @@ export default { }, }, }, - /** Lookup237: pallet_session::pallet::Call */ + /** Lookup238: pallet_session::pallet::Call */ PalletSessionCall: { _enum: { set_keys: { @@ -1745,17 +1748,17 @@ export default { purge_keys: "Null", }, }, - /** Lookup238: flashbox_runtime::SessionKeys */ + /** Lookup239: flashbox_runtime::SessionKeys */ FlashboxRuntimeSessionKeys: { nimbus: "NimbusPrimitivesNimbusCryptoPublic", }, - /** Lookup239: nimbus_primitives::nimbus_crypto::Public */ + /** Lookup240: nimbus_primitives::nimbus_crypto::Public */ NimbusPrimitivesNimbusCryptoPublic: "[u8;32]", - /** Lookup240: pallet_author_inherent::pallet::Call */ + /** Lookup241: pallet_author_inherent::pallet::Call */ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"], }, - /** Lookup241: pallet_treasury::pallet::Call */ + /** Lookup242: pallet_treasury::pallet::Call */ PalletTreasuryCall: { _enum: { __Unused0: "Null", @@ -1785,7 +1788,7 @@ export default { }, }, }, - /** Lookup242: pallet_root_testing::pallet::Call */ + /** Lookup243: pallet_root_testing::pallet::Call */ PalletRootTestingCall: { _enum: { fill_block: { @@ -1794,27 +1797,27 @@ export default { trigger_defensive: "Null", }, }, - /** Lookup243: pallet_sudo::pallet::Error */ + /** Lookup244: pallet_sudo::pallet::Error */ PalletSudoError: { _enum: ["RequireSudo"], }, - /** Lookup244: pallet_utility::pallet::Error */ + /** Lookup245: pallet_utility::pallet::Error */ PalletUtilityError: { _enum: ["TooManyCalls"], }, - /** Lookup247: pallet_proxy::ProxyDefinition */ + /** Lookup248: pallet_proxy::ProxyDefinition */ PalletProxyProxyDefinition: { delegate: "AccountId32", proxyType: "FlashboxRuntimeProxyType", delay: "u32", }, - /** Lookup251: pallet_proxy::Announcement */ + /** Lookup252: pallet_proxy::Announcement */ PalletProxyAnnouncement: { real: "AccountId32", callHash: "H256", height: "u32", }, - /** Lookup253: pallet_proxy::pallet::Error */ + /** Lookup254: pallet_proxy::pallet::Error */ PalletProxyError: { _enum: [ "TooMany", @@ -1827,39 +1830,39 @@ export default { "NoSelfProxy", ], }, - /** Lookup254: pallet_migrations::pallet::Error */ + /** Lookup255: pallet_migrations::pallet::Error */ PalletMigrationsError: { _enum: ["PreimageMissing", "WrongUpperBound", "PreimageIsTooBig", "PreimageAlreadyExists"], }, - /** Lookup255: pallet_maintenance_mode::pallet::Error */ + /** Lookup256: pallet_maintenance_mode::pallet::Error */ PalletMaintenanceModeError: { _enum: ["AlreadyInMaintenanceMode", "NotInMaintenanceMode"], }, - /** Lookup256: pallet_tx_pause::pallet::Error */ + /** Lookup257: pallet_tx_pause::pallet::Error */ PalletTxPauseError: { _enum: ["IsPaused", "IsUnpaused", "Unpausable", "NotFound"], }, - /** Lookup258: pallet_balances::types::BalanceLock */ + /** Lookup259: pallet_balances::types::BalanceLock */ PalletBalancesBalanceLock: { id: "[u8;8]", amount: "u128", reasons: "PalletBalancesReasons", }, - /** Lookup259: pallet_balances::types::Reasons */ + /** Lookup260: pallet_balances::types::Reasons */ PalletBalancesReasons: { _enum: ["Fee", "Misc", "All"], }, - /** Lookup262: pallet_balances::types::ReserveData */ + /** Lookup263: pallet_balances::types::ReserveData */ PalletBalancesReserveData: { id: "[u8;8]", amount: "u128", }, - /** Lookup265: frame_support::traits::tokens::misc::IdAmount */ + /** Lookup266: frame_support::traits::tokens::misc::IdAmount */ FrameSupportTokensMiscIdAmountRuntimeHoldReason: { id: "FlashboxRuntimeRuntimeHoldReason", amount: "u128", }, - /** Lookup266: flashbox_runtime::RuntimeHoldReason */ + /** Lookup267: flashbox_runtime::RuntimeHoldReason */ FlashboxRuntimeRuntimeHoldReason: { _enum: { __Unused0: "Null", @@ -1892,24 +1895,24 @@ export default { DataPreservers: "PalletDataPreserversHoldReason", }, }, - /** Lookup267: pallet_stream_payment::pallet::HoldReason */ + /** Lookup268: pallet_stream_payment::pallet::HoldReason */ PalletStreamPaymentHoldReason: { _enum: ["StreamPayment", "StreamOpened"], }, - /** Lookup268: pallet_registrar::pallet::HoldReason */ + /** Lookup269: pallet_registrar::pallet::HoldReason */ PalletRegistrarHoldReason: { _enum: ["RegistrarDeposit"], }, - /** Lookup269: pallet_data_preservers::pallet::HoldReason */ + /** Lookup270: pallet_data_preservers::pallet::HoldReason */ PalletDataPreserversHoldReason: { _enum: ["ProfileDeposit"], }, - /** Lookup272: frame_support::traits::tokens::misc::IdAmount */ + /** Lookup273: frame_support::traits::tokens::misc::IdAmount */ FrameSupportTokensMiscIdAmountRuntimeFreezeReason: { id: "FlashboxRuntimeRuntimeFreezeReason", amount: "u128", }, - /** Lookup273: flashbox_runtime::RuntimeFreezeReason */ + /** Lookup274: flashbox_runtime::RuntimeFreezeReason */ FlashboxRuntimeRuntimeFreezeReason: { _enum: { __Unused0: "Null", @@ -1927,11 +1930,11 @@ export default { StreamPayment: "PalletStreamPaymentFreezeReason", }, }, - /** Lookup274: pallet_stream_payment::pallet::FreezeReason */ + /** Lookup275: pallet_stream_payment::pallet::FreezeReason */ PalletStreamPaymentFreezeReason: { _enum: ["StreamPayment"], }, - /** Lookup276: pallet_balances::pallet::Error */ + /** Lookup277: pallet_balances::pallet::Error */ PalletBalancesError: { _enum: [ "VestingBalance", @@ -1948,12 +1951,12 @@ export default { "DeltaZero", ], }, - /** Lookup277: pallet_transaction_payment::Releases */ + /** Lookup278: pallet_transaction_payment::Releases */ PalletTransactionPaymentReleases: { _enum: ["V1Ancient", "V2"], }, /** - * Lookup278: pallet_stream_payment::pallet::Stream */ PalletStreamPaymentStream: { @@ -1967,7 +1970,7 @@ export default { openingDeposit: "u128", }, /** - * Lookup280: pallet_stream_payment::pallet::ChangeRequest */ PalletStreamPaymentChangeRequest: { @@ -1976,7 +1979,7 @@ export default { newConfig: "PalletStreamPaymentStreamConfig", depositChange: "Option", }, - /** Lookup282: pallet_stream_payment::pallet::Error */ + /** Lookup283: pallet_stream_payment::pallet::Error */ PalletStreamPaymentError: { _enum: [ "UnknownStreamId", @@ -1998,24 +2001,24 @@ export default { "CantFetchStatusBeforeLastTimeUpdated", ], }, - /** Lookup284: pallet_identity::types::Registration> */ + /** Lookup285: pallet_identity::types::Registration> */ PalletIdentityRegistration: { judgements: "Vec<(u32,PalletIdentityJudgement)>", deposit: "u128", info: "PalletIdentityLegacyIdentityInfo", }, - /** Lookup293: pallet_identity::types::RegistrarInfo */ + /** Lookup294: pallet_identity::types::RegistrarInfo */ PalletIdentityRegistrarInfo: { account: "AccountId32", fee: "u128", fields: "u64", }, - /** Lookup295: pallet_identity::types::AuthorityProperties> */ + /** Lookup296: pallet_identity::types::AuthorityProperties> */ PalletIdentityAuthorityProperties: { suffix: "Bytes", allocation: "u32", }, - /** Lookup298: pallet_identity::pallet::Error */ + /** Lookup299: pallet_identity::pallet::Error */ PalletIdentityError: { _enum: [ "TooManySubAccounts", @@ -2046,14 +2049,14 @@ export default { "NotExpired", ], }, - /** Lookup300: pallet_multisig::Multisig */ + /** Lookup301: pallet_multisig::Multisig */ PalletMultisigMultisig: { when: "PalletMultisigTimepoint", deposit: "u128", depositor: "AccountId32", approvals: "Vec", }, - /** Lookup302: pallet_multisig::pallet::Error */ + /** Lookup303: pallet_multisig::pallet::Error */ PalletMultisigError: { _enum: [ "MinimumThreshold", @@ -2072,12 +2075,12 @@ export default { "AlreadyStored", ], }, - /** Lookup311: pallet_registrar::pallet::DepositInfo */ + /** Lookup312: pallet_registrar::pallet::DepositInfo */ PalletRegistrarDepositInfo: { creator: "AccountId32", deposit: "u128", }, - /** Lookup312: pallet_registrar::pallet::Error */ + /** Lookup313: pallet_registrar::pallet::Error */ PalletRegistrarError: { _enum: [ "ParaIdAlreadyRegistered", @@ -2097,7 +2100,7 @@ export default { "ParaStillExistsInRelay", ], }, - /** Lookup313: pallet_configuration::HostConfiguration */ + /** Lookup314: pallet_configuration::HostConfiguration */ PalletConfigurationHostConfiguration: { maxCollators: "u32", minOrchestratorCollators: "u32", @@ -2108,22 +2111,22 @@ export default { parathreadsPerCollator: "u32", targetContainerChainFullness: "Perbill", }, - /** Lookup316: pallet_configuration::pallet::Error */ + /** Lookup317: pallet_configuration::pallet::Error */ PalletConfigurationError: { _enum: ["InvalidNewValue"], }, - /** Lookup317: dp_collator_assignment::AssignedCollators */ + /** Lookup318: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsAccountId32: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup322: tp_traits::ContainerChainBlockInfo */ + /** Lookup323: tp_traits::ContainerChainBlockInfo */ TpTraitsContainerChainBlockInfo: { blockNumber: "u32", author: "AccountId32", latestSlotNumber: "u64", }, - /** Lookup323: pallet_author_noting::pallet::Error */ + /** Lookup324: pallet_author_noting::pallet::Error */ PalletAuthorNotingError: { _enum: [ "FailedReading", @@ -2135,23 +2138,23 @@ export default { "NonAuraDigest", ], }, - /** Lookup324: dp_collator_assignment::AssignedCollators */ + /** Lookup325: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsPublic: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup329: pallet_services_payment::pallet::Error */ + /** Lookup330: pallet_services_payment::pallet::Error */ PalletServicesPaymentError: { _enum: ["InsufficientFundsToPurchaseCredits", "InsufficientCredits", "CreditPriceTooExpensive"], }, - /** Lookup330: pallet_data_preservers::types::RegisteredProfile */ + /** Lookup331: pallet_data_preservers::types::RegisteredProfile */ PalletDataPreserversRegisteredProfile: { account: "AccountId32", deposit: "u128", profile: "PalletDataPreserversProfile", assignment: "Option<(u32,FlashboxRuntimePreserversAssignementPaymentWitness)>", }, - /** Lookup336: pallet_data_preservers::pallet::Error */ + /** Lookup337: pallet_data_preservers::pallet::Error */ PalletDataPreserversError: { _enum: [ "NoBootNodes", @@ -2166,7 +2169,7 @@ export default { "CantDeleteAssignedProfile", ], }, - /** Lookup338: pallet_invulnerables::pallet::Error */ + /** Lookup339: pallet_invulnerables::pallet::Error */ PalletInvulnerablesError: { _enum: [ "TooManyInvulnerables", @@ -2176,29 +2179,29 @@ export default { "UnableToDeriveCollatorId", ], }, - /** Lookup343: sp_core::crypto::KeyTypeId */ + /** Lookup344: sp_core::crypto::KeyTypeId */ SpCoreCryptoKeyTypeId: "[u8;4]", - /** Lookup344: pallet_session::pallet::Error */ + /** Lookup345: pallet_session::pallet::Error */ PalletSessionError: { _enum: ["InvalidProof", "NoAssociatedValidatorId", "DuplicatedKey", "NoKeys", "NoAccount"], }, - /** Lookup348: pallet_author_inherent::pallet::Error */ + /** Lookup349: pallet_author_inherent::pallet::Error */ PalletAuthorInherentError: { _enum: ["AuthorAlreadySet", "NoAccountId", "CannotBeAuthor"], }, - /** Lookup349: pallet_inflation_rewards::pallet::ChainsToRewardValue */ + /** Lookup350: pallet_inflation_rewards::pallet::ChainsToRewardValue */ PalletInflationRewardsChainsToRewardValue: { paraIds: "Vec", rewardsPerChain: "u128", }, - /** Lookup350: pallet_treasury::Proposal */ + /** Lookup351: pallet_treasury::Proposal */ PalletTreasuryProposal: { proposer: "AccountId32", value: "u128", beneficiary: "AccountId32", bond: "u128", }, - /** Lookup352: pallet_treasury::SpendStatus */ + /** Lookup353: pallet_treasury::SpendStatus */ PalletTreasurySpendStatus: { assetKind: "Null", amount: "u128", @@ -2207,7 +2210,7 @@ export default { expireAt: "u32", status: "PalletTreasuryPaymentState", }, - /** Lookup353: pallet_treasury::PaymentState */ + /** Lookup354: pallet_treasury::PaymentState */ PalletTreasuryPaymentState: { _enum: { Pending: "Null", @@ -2217,9 +2220,9 @@ export default { Failed: "Null", }, }, - /** Lookup355: frame_support::PalletId */ + /** Lookup356: frame_support::PalletId */ FrameSupportPalletId: "[u8;8]", - /** Lookup356: pallet_treasury::pallet::Error */ + /** Lookup357: pallet_treasury::pallet::Error */ PalletTreasuryError: { _enum: [ "InvalidIndex", @@ -2235,22 +2238,22 @@ export default { "Inconclusive", ], }, - /** Lookup361: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ + /** Lookup362: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ FrameSystemExtensionsCheckNonZeroSender: "Null", - /** Lookup362: frame_system::extensions::check_spec_version::CheckSpecVersion */ + /** Lookup363: frame_system::extensions::check_spec_version::CheckSpecVersion */ FrameSystemExtensionsCheckSpecVersion: "Null", - /** Lookup363: frame_system::extensions::check_tx_version::CheckTxVersion */ + /** Lookup364: frame_system::extensions::check_tx_version::CheckTxVersion */ FrameSystemExtensionsCheckTxVersion: "Null", - /** Lookup364: frame_system::extensions::check_genesis::CheckGenesis */ + /** Lookup365: frame_system::extensions::check_genesis::CheckGenesis */ FrameSystemExtensionsCheckGenesis: "Null", - /** Lookup367: frame_system::extensions::check_nonce::CheckNonce */ + /** Lookup368: frame_system::extensions::check_nonce::CheckNonce */ FrameSystemExtensionsCheckNonce: "Compact", - /** Lookup368: frame_system::extensions::check_weight::CheckWeight */ + /** Lookup369: frame_system::extensions::check_weight::CheckWeight */ FrameSystemExtensionsCheckWeight: "Null", - /** Lookup369: pallet_transaction_payment::ChargeTransactionPayment */ + /** Lookup370: pallet_transaction_payment::ChargeTransactionPayment */ PalletTransactionPaymentChargeTransactionPayment: "Compact", - /** Lookup370: cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim */ + /** Lookup371: cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim */ CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim: "Null", - /** Lookup371: flashbox_runtime::Runtime */ + /** Lookup372: flashbox_runtime::Runtime */ FlashboxRuntimeRuntime: "Null", }; diff --git a/typescript-api/src/flashbox/interfaces/types-lookup.ts b/typescript-api/src/flashbox/interfaces/types-lookup.ts index c5ebd95d1..f9d25b857 100644 --- a/typescript-api/src/flashbox/interfaces/types-lookup.ts +++ b/typescript-api/src/flashbox/interfaces/types-lookup.ts @@ -1928,6 +1928,7 @@ declare module "@polkadot/types/lookup" { readonly asRegister: { readonly paraId: u32; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isDeregister: boolean; readonly asDeregister: { @@ -1950,6 +1951,7 @@ declare module "@polkadot/types/lookup" { readonly paraId: u32; readonly slotFrequency: TpTraitsSlotFrequency; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isSetParathreadParams: boolean; readonly asSetParathreadParams: { @@ -1969,6 +1971,7 @@ declare module "@polkadot/types/lookup" { readonly relayStorageProof: SpTrieStorageProof; readonly managerSignature: SpRuntimeMultiSignature; readonly genesisData: DpContainerChainGenesisDataContainerChainGenesisData; + readonly headData: Option; } & Struct; readonly isDeregisterWithRelayProof: boolean; readonly asDeregisterWithRelayProof: { @@ -2018,18 +2021,18 @@ declare module "@polkadot/types/lookup" { readonly tokenDecimals: u32; } - /** @name TpTraitsSlotFrequency (215) */ + /** @name TpTraitsSlotFrequency (216) */ interface TpTraitsSlotFrequency extends Struct { readonly min: u32; readonly max: u32; } - /** @name TpTraitsParathreadParams (217) */ + /** @name TpTraitsParathreadParams (218) */ interface TpTraitsParathreadParams extends Struct { readonly slotFrequency: TpTraitsSlotFrequency; } - /** @name PalletConfigurationCall (218) */ + /** @name PalletConfigurationCall (219) */ interface PalletConfigurationCall extends Enum { readonly isSetMaxCollators: boolean; readonly asSetMaxCollators: { @@ -2079,10 +2082,10 @@ declare module "@polkadot/types/lookup" { | "SetBypassConsistencyCheck"; } - /** @name PalletCollatorAssignmentCall (220) */ + /** @name PalletCollatorAssignmentCall (221) */ type PalletCollatorAssignmentCall = Null; - /** @name PalletAuthorNotingCall (221) */ + /** @name PalletAuthorNotingCall (222) */ interface PalletAuthorNotingCall extends Enum { readonly isSetLatestAuthorData: boolean; readonly asSetLatestAuthorData: { @@ -2102,15 +2105,15 @@ declare module "@polkadot/types/lookup" { readonly type: "SetLatestAuthorData" | "SetAuthor" | "KillAuthorData"; } - /** @name TpAuthorNotingInherentOwnParachainInherentData (222) */ + /** @name TpAuthorNotingInherentOwnParachainInherentData (223) */ interface TpAuthorNotingInherentOwnParachainInherentData extends Struct { readonly relayStorageProof: SpTrieStorageProof; } - /** @name PalletAuthorityAssignmentCall (223) */ + /** @name PalletAuthorityAssignmentCall (224) */ type PalletAuthorityAssignmentCall = Null; - /** @name PalletServicesPaymentCall (224) */ + /** @name PalletServicesPaymentCall (225) */ interface PalletServicesPaymentCall extends Enum { readonly isPurchaseCredits: boolean; readonly asPurchaseCredits: { @@ -2157,7 +2160,7 @@ declare module "@polkadot/types/lookup" { | "SetMaxTip"; } - /** @name PalletDataPreserversCall (225) */ + /** @name PalletDataPreserversCall (226) */ interface PalletDataPreserversCall extends Enum { readonly isCreateProfile: boolean; readonly asCreateProfile: { @@ -2215,7 +2218,7 @@ declare module "@polkadot/types/lookup" { | "ForceStartAssignment"; } - /** @name PalletDataPreserversProfile (226) */ + /** @name PalletDataPreserversProfile (227) */ interface PalletDataPreserversProfile extends Struct { readonly url: Bytes; readonly paraIds: PalletDataPreserversParaIdsFilter; @@ -2223,7 +2226,7 @@ declare module "@polkadot/types/lookup" { readonly assignmentRequest: FlashboxRuntimePreserversAssignementPaymentRequest; } - /** @name PalletDataPreserversParaIdsFilter (228) */ + /** @name PalletDataPreserversParaIdsFilter (229) */ interface PalletDataPreserversParaIdsFilter extends Enum { readonly isAnyParaId: boolean; readonly isWhitelist: boolean; @@ -2233,7 +2236,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AnyParaId" | "Whitelist" | "Blacklist"; } - /** @name PalletDataPreserversProfileMode (232) */ + /** @name PalletDataPreserversProfileMode (233) */ interface PalletDataPreserversProfileMode extends Enum { readonly isBootnode: boolean; readonly isRpc: boolean; @@ -2243,25 +2246,25 @@ declare module "@polkadot/types/lookup" { readonly type: "Bootnode" | "Rpc"; } - /** @name FlashboxRuntimePreserversAssignementPaymentRequest (233) */ + /** @name FlashboxRuntimePreserversAssignementPaymentRequest (234) */ interface FlashboxRuntimePreserversAssignementPaymentRequest extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name FlashboxRuntimePreserversAssignementPaymentExtra (234) */ + /** @name FlashboxRuntimePreserversAssignementPaymentExtra (235) */ interface FlashboxRuntimePreserversAssignementPaymentExtra extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name FlashboxRuntimePreserversAssignementPaymentWitness (235) */ + /** @name FlashboxRuntimePreserversAssignementPaymentWitness (236) */ interface FlashboxRuntimePreserversAssignementPaymentWitness extends Enum { readonly isFree: boolean; readonly type: "Free"; } - /** @name PalletInvulnerablesCall (236) */ + /** @name PalletInvulnerablesCall (237) */ interface PalletInvulnerablesCall extends Enum { readonly isAddInvulnerable: boolean; readonly asAddInvulnerable: { @@ -2274,7 +2277,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AddInvulnerable" | "RemoveInvulnerable"; } - /** @name PalletSessionCall (237) */ + /** @name PalletSessionCall (238) */ interface PalletSessionCall extends Enum { readonly isSetKeys: boolean; readonly asSetKeys: { @@ -2285,21 +2288,21 @@ declare module "@polkadot/types/lookup" { readonly type: "SetKeys" | "PurgeKeys"; } - /** @name FlashboxRuntimeSessionKeys (238) */ + /** @name FlashboxRuntimeSessionKeys (239) */ interface FlashboxRuntimeSessionKeys extends Struct { readonly nimbus: NimbusPrimitivesNimbusCryptoPublic; } - /** @name NimbusPrimitivesNimbusCryptoPublic (239) */ + /** @name NimbusPrimitivesNimbusCryptoPublic (240) */ interface NimbusPrimitivesNimbusCryptoPublic extends U8aFixed {} - /** @name PalletAuthorInherentCall (240) */ + /** @name PalletAuthorInherentCall (241) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletTreasuryCall (241) */ + /** @name PalletTreasuryCall (242) */ interface PalletTreasuryCall extends Enum { readonly isSpendLocal: boolean; readonly asSpendLocal: { @@ -2332,7 +2335,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SpendLocal" | "RemoveApproval" | "Spend" | "Payout" | "CheckStatus" | "VoidSpend"; } - /** @name PalletRootTestingCall (242) */ + /** @name PalletRootTestingCall (243) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -2342,33 +2345,33 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock" | "TriggerDefensive"; } - /** @name PalletSudoError (243) */ + /** @name PalletSudoError (244) */ interface PalletSudoError extends Enum { readonly isRequireSudo: boolean; readonly type: "RequireSudo"; } - /** @name PalletUtilityError (244) */ + /** @name PalletUtilityError (245) */ interface PalletUtilityError extends Enum { readonly isTooManyCalls: boolean; readonly type: "TooManyCalls"; } - /** @name PalletProxyProxyDefinition (247) */ + /** @name PalletProxyProxyDefinition (248) */ interface PalletProxyProxyDefinition extends Struct { readonly delegate: AccountId32; readonly proxyType: FlashboxRuntimeProxyType; readonly delay: u32; } - /** @name PalletProxyAnnouncement (251) */ + /** @name PalletProxyAnnouncement (252) */ interface PalletProxyAnnouncement extends Struct { readonly real: AccountId32; readonly callHash: H256; readonly height: u32; } - /** @name PalletProxyError (253) */ + /** @name PalletProxyError (254) */ interface PalletProxyError extends Enum { readonly isTooMany: boolean; readonly isNotFound: boolean; @@ -2389,7 +2392,7 @@ declare module "@polkadot/types/lookup" { | "NoSelfProxy"; } - /** @name PalletMigrationsError (254) */ + /** @name PalletMigrationsError (255) */ interface PalletMigrationsError extends Enum { readonly isPreimageMissing: boolean; readonly isWrongUpperBound: boolean; @@ -2398,14 +2401,14 @@ declare module "@polkadot/types/lookup" { readonly type: "PreimageMissing" | "WrongUpperBound" | "PreimageIsTooBig" | "PreimageAlreadyExists"; } - /** @name PalletMaintenanceModeError (255) */ + /** @name PalletMaintenanceModeError (256) */ interface PalletMaintenanceModeError extends Enum { readonly isAlreadyInMaintenanceMode: boolean; readonly isNotInMaintenanceMode: boolean; readonly type: "AlreadyInMaintenanceMode" | "NotInMaintenanceMode"; } - /** @name PalletTxPauseError (256) */ + /** @name PalletTxPauseError (257) */ interface PalletTxPauseError extends Enum { readonly isIsPaused: boolean; readonly isIsUnpaused: boolean; @@ -2414,14 +2417,14 @@ declare module "@polkadot/types/lookup" { readonly type: "IsPaused" | "IsUnpaused" | "Unpausable" | "NotFound"; } - /** @name PalletBalancesBalanceLock (258) */ + /** @name PalletBalancesBalanceLock (259) */ interface PalletBalancesBalanceLock extends Struct { readonly id: U8aFixed; readonly amount: u128; readonly reasons: PalletBalancesReasons; } - /** @name PalletBalancesReasons (259) */ + /** @name PalletBalancesReasons (260) */ interface PalletBalancesReasons extends Enum { readonly isFee: boolean; readonly isMisc: boolean; @@ -2429,19 +2432,19 @@ declare module "@polkadot/types/lookup" { readonly type: "Fee" | "Misc" | "All"; } - /** @name PalletBalancesReserveData (262) */ + /** @name PalletBalancesReserveData (263) */ interface PalletBalancesReserveData extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name FrameSupportTokensMiscIdAmountRuntimeHoldReason (265) */ + /** @name FrameSupportTokensMiscIdAmountRuntimeHoldReason (266) */ interface FrameSupportTokensMiscIdAmountRuntimeHoldReason extends Struct { readonly id: FlashboxRuntimeRuntimeHoldReason; readonly amount: u128; } - /** @name FlashboxRuntimeRuntimeHoldReason (266) */ + /** @name FlashboxRuntimeRuntimeHoldReason (267) */ interface FlashboxRuntimeRuntimeHoldReason extends Enum { readonly isStreamPayment: boolean; readonly asStreamPayment: PalletStreamPaymentHoldReason; @@ -2452,45 +2455,45 @@ declare module "@polkadot/types/lookup" { readonly type: "StreamPayment" | "Registrar" | "DataPreservers"; } - /** @name PalletStreamPaymentHoldReason (267) */ + /** @name PalletStreamPaymentHoldReason (268) */ interface PalletStreamPaymentHoldReason extends Enum { readonly isStreamPayment: boolean; readonly isStreamOpened: boolean; readonly type: "StreamPayment" | "StreamOpened"; } - /** @name PalletRegistrarHoldReason (268) */ + /** @name PalletRegistrarHoldReason (269) */ interface PalletRegistrarHoldReason extends Enum { readonly isRegistrarDeposit: boolean; readonly type: "RegistrarDeposit"; } - /** @name PalletDataPreserversHoldReason (269) */ + /** @name PalletDataPreserversHoldReason (270) */ interface PalletDataPreserversHoldReason extends Enum { readonly isProfileDeposit: boolean; readonly type: "ProfileDeposit"; } - /** @name FrameSupportTokensMiscIdAmountRuntimeFreezeReason (272) */ + /** @name FrameSupportTokensMiscIdAmountRuntimeFreezeReason (273) */ interface FrameSupportTokensMiscIdAmountRuntimeFreezeReason extends Struct { readonly id: FlashboxRuntimeRuntimeFreezeReason; readonly amount: u128; } - /** @name FlashboxRuntimeRuntimeFreezeReason (273) */ + /** @name FlashboxRuntimeRuntimeFreezeReason (274) */ interface FlashboxRuntimeRuntimeFreezeReason extends Enum { readonly isStreamPayment: boolean; readonly asStreamPayment: PalletStreamPaymentFreezeReason; readonly type: "StreamPayment"; } - /** @name PalletStreamPaymentFreezeReason (274) */ + /** @name PalletStreamPaymentFreezeReason (275) */ interface PalletStreamPaymentFreezeReason extends Enum { readonly isStreamPayment: boolean; readonly type: "StreamPayment"; } - /** @name PalletBalancesError (276) */ + /** @name PalletBalancesError (277) */ interface PalletBalancesError extends Enum { readonly isVestingBalance: boolean; readonly isLiquidityRestrictions: boolean; @@ -2519,14 +2522,14 @@ declare module "@polkadot/types/lookup" { | "DeltaZero"; } - /** @name PalletTransactionPaymentReleases (277) */ + /** @name PalletTransactionPaymentReleases (278) */ interface PalletTransactionPaymentReleases extends Enum { readonly isV1Ancient: boolean; readonly isV2: boolean; readonly type: "V1Ancient" | "V2"; } - /** @name PalletStreamPaymentStream (278) */ + /** @name PalletStreamPaymentStream (279) */ interface PalletStreamPaymentStream extends Struct { readonly source: AccountId32; readonly target: AccountId32; @@ -2538,7 +2541,7 @@ declare module "@polkadot/types/lookup" { readonly openingDeposit: u128; } - /** @name PalletStreamPaymentChangeRequest (280) */ + /** @name PalletStreamPaymentChangeRequest (281) */ interface PalletStreamPaymentChangeRequest extends Struct { readonly requester: PalletStreamPaymentParty; readonly kind: PalletStreamPaymentChangeKind; @@ -2546,7 +2549,7 @@ declare module "@polkadot/types/lookup" { readonly depositChange: Option; } - /** @name PalletStreamPaymentError (282) */ + /** @name PalletStreamPaymentError (283) */ interface PalletStreamPaymentError extends Enum { readonly isUnknownStreamId: boolean; readonly isStreamIdOverflow: boolean; @@ -2585,27 +2588,27 @@ declare module "@polkadot/types/lookup" { | "CantFetchStatusBeforeLastTimeUpdated"; } - /** @name PalletIdentityRegistration (284) */ + /** @name PalletIdentityRegistration (285) */ interface PalletIdentityRegistration extends Struct { readonly judgements: Vec>; readonly deposit: u128; readonly info: PalletIdentityLegacyIdentityInfo; } - /** @name PalletIdentityRegistrarInfo (293) */ + /** @name PalletIdentityRegistrarInfo (294) */ interface PalletIdentityRegistrarInfo extends Struct { readonly account: AccountId32; readonly fee: u128; readonly fields: u64; } - /** @name PalletIdentityAuthorityProperties (295) */ + /** @name PalletIdentityAuthorityProperties (296) */ interface PalletIdentityAuthorityProperties extends Struct { readonly suffix: Bytes; readonly allocation: u32; } - /** @name PalletIdentityError (298) */ + /** @name PalletIdentityError (299) */ interface PalletIdentityError extends Enum { readonly isTooManySubAccounts: boolean; readonly isNotFound: boolean; @@ -2662,7 +2665,7 @@ declare module "@polkadot/types/lookup" { | "NotExpired"; } - /** @name PalletMultisigMultisig (300) */ + /** @name PalletMultisigMultisig (301) */ interface PalletMultisigMultisig extends Struct { readonly when: PalletMultisigTimepoint; readonly deposit: u128; @@ -2670,7 +2673,7 @@ declare module "@polkadot/types/lookup" { readonly approvals: Vec; } - /** @name PalletMultisigError (302) */ + /** @name PalletMultisigError (303) */ interface PalletMultisigError extends Enum { readonly isMinimumThreshold: boolean; readonly isAlreadyApproved: boolean; @@ -2703,13 +2706,13 @@ declare module "@polkadot/types/lookup" { | "AlreadyStored"; } - /** @name PalletRegistrarDepositInfo (311) */ + /** @name PalletRegistrarDepositInfo (312) */ interface PalletRegistrarDepositInfo extends Struct { readonly creator: AccountId32; readonly deposit: u128; } - /** @name PalletRegistrarError (312) */ + /** @name PalletRegistrarError (313) */ interface PalletRegistrarError extends Enum { readonly isParaIdAlreadyRegistered: boolean; readonly isParaIdNotRegistered: boolean; @@ -2744,7 +2747,7 @@ declare module "@polkadot/types/lookup" { | "ParaStillExistsInRelay"; } - /** @name PalletConfigurationHostConfiguration (313) */ + /** @name PalletConfigurationHostConfiguration (314) */ interface PalletConfigurationHostConfiguration extends Struct { readonly maxCollators: u32; readonly minOrchestratorCollators: u32; @@ -2756,26 +2759,26 @@ declare module "@polkadot/types/lookup" { readonly targetContainerChainFullness: Perbill; } - /** @name PalletConfigurationError (316) */ + /** @name PalletConfigurationError (317) */ interface PalletConfigurationError extends Enum { readonly isInvalidNewValue: boolean; readonly type: "InvalidNewValue"; } - /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (317) */ + /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (318) */ interface DpCollatorAssignmentAssignedCollatorsAccountId32 extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name TpTraitsContainerChainBlockInfo (322) */ + /** @name TpTraitsContainerChainBlockInfo (323) */ interface TpTraitsContainerChainBlockInfo extends Struct { readonly blockNumber: u32; readonly author: AccountId32; readonly latestSlotNumber: u64; } - /** @name PalletAuthorNotingError (323) */ + /** @name PalletAuthorNotingError (324) */ interface PalletAuthorNotingError extends Enum { readonly isFailedReading: boolean; readonly isFailedDecodingHeader: boolean; @@ -2794,13 +2797,13 @@ declare module "@polkadot/types/lookup" { | "NonAuraDigest"; } - /** @name DpCollatorAssignmentAssignedCollatorsPublic (324) */ + /** @name DpCollatorAssignmentAssignedCollatorsPublic (325) */ interface DpCollatorAssignmentAssignedCollatorsPublic extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletServicesPaymentError (329) */ + /** @name PalletServicesPaymentError (330) */ interface PalletServicesPaymentError extends Enum { readonly isInsufficientFundsToPurchaseCredits: boolean; readonly isInsufficientCredits: boolean; @@ -2808,7 +2811,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InsufficientFundsToPurchaseCredits" | "InsufficientCredits" | "CreditPriceTooExpensive"; } - /** @name PalletDataPreserversRegisteredProfile (330) */ + /** @name PalletDataPreserversRegisteredProfile (331) */ interface PalletDataPreserversRegisteredProfile extends Struct { readonly account: AccountId32; readonly deposit: u128; @@ -2816,7 +2819,7 @@ declare module "@polkadot/types/lookup" { readonly assignment: Option>; } - /** @name PalletDataPreserversError (336) */ + /** @name PalletDataPreserversError (337) */ interface PalletDataPreserversError extends Enum { readonly isNoBootNodes: boolean; readonly isUnknownProfileId: boolean; @@ -2841,7 +2844,7 @@ declare module "@polkadot/types/lookup" { | "CantDeleteAssignedProfile"; } - /** @name PalletInvulnerablesError (338) */ + /** @name PalletInvulnerablesError (339) */ interface PalletInvulnerablesError extends Enum { readonly isTooManyInvulnerables: boolean; readonly isAlreadyInvulnerable: boolean; @@ -2856,10 +2859,10 @@ declare module "@polkadot/types/lookup" { | "UnableToDeriveCollatorId"; } - /** @name SpCoreCryptoKeyTypeId (343) */ + /** @name SpCoreCryptoKeyTypeId (344) */ interface SpCoreCryptoKeyTypeId extends U8aFixed {} - /** @name PalletSessionError (344) */ + /** @name PalletSessionError (345) */ interface PalletSessionError extends Enum { readonly isInvalidProof: boolean; readonly isNoAssociatedValidatorId: boolean; @@ -2869,7 +2872,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InvalidProof" | "NoAssociatedValidatorId" | "DuplicatedKey" | "NoKeys" | "NoAccount"; } - /** @name PalletAuthorInherentError (348) */ + /** @name PalletAuthorInherentError (349) */ interface PalletAuthorInherentError extends Enum { readonly isAuthorAlreadySet: boolean; readonly isNoAccountId: boolean; @@ -2877,13 +2880,13 @@ declare module "@polkadot/types/lookup" { readonly type: "AuthorAlreadySet" | "NoAccountId" | "CannotBeAuthor"; } - /** @name PalletInflationRewardsChainsToRewardValue (349) */ + /** @name PalletInflationRewardsChainsToRewardValue (350) */ interface PalletInflationRewardsChainsToRewardValue extends Struct { readonly paraIds: Vec; readonly rewardsPerChain: u128; } - /** @name PalletTreasuryProposal (350) */ + /** @name PalletTreasuryProposal (351) */ interface PalletTreasuryProposal extends Struct { readonly proposer: AccountId32; readonly value: u128; @@ -2891,7 +2894,7 @@ declare module "@polkadot/types/lookup" { readonly bond: u128; } - /** @name PalletTreasurySpendStatus (352) */ + /** @name PalletTreasurySpendStatus (353) */ interface PalletTreasurySpendStatus extends Struct { readonly assetKind: Null; readonly amount: u128; @@ -2901,7 +2904,7 @@ declare module "@polkadot/types/lookup" { readonly status: PalletTreasuryPaymentState; } - /** @name PalletTreasuryPaymentState (353) */ + /** @name PalletTreasuryPaymentState (354) */ interface PalletTreasuryPaymentState extends Enum { readonly isPending: boolean; readonly isAttempted: boolean; @@ -2912,10 +2915,10 @@ declare module "@polkadot/types/lookup" { readonly type: "Pending" | "Attempted" | "Failed"; } - /** @name FrameSupportPalletId (355) */ + /** @name FrameSupportPalletId (356) */ interface FrameSupportPalletId extends U8aFixed {} - /** @name PalletTreasuryError (356) */ + /** @name PalletTreasuryError (357) */ interface PalletTreasuryError extends Enum { readonly isInvalidIndex: boolean; readonly isTooManyApprovals: boolean; @@ -2942,30 +2945,30 @@ declare module "@polkadot/types/lookup" { | "Inconclusive"; } - /** @name FrameSystemExtensionsCheckNonZeroSender (361) */ + /** @name FrameSystemExtensionsCheckNonZeroSender (362) */ type FrameSystemExtensionsCheckNonZeroSender = Null; - /** @name FrameSystemExtensionsCheckSpecVersion (362) */ + /** @name FrameSystemExtensionsCheckSpecVersion (363) */ type FrameSystemExtensionsCheckSpecVersion = Null; - /** @name FrameSystemExtensionsCheckTxVersion (363) */ + /** @name FrameSystemExtensionsCheckTxVersion (364) */ type FrameSystemExtensionsCheckTxVersion = Null; - /** @name FrameSystemExtensionsCheckGenesis (364) */ + /** @name FrameSystemExtensionsCheckGenesis (365) */ type FrameSystemExtensionsCheckGenesis = Null; - /** @name FrameSystemExtensionsCheckNonce (367) */ + /** @name FrameSystemExtensionsCheckNonce (368) */ interface FrameSystemExtensionsCheckNonce extends Compact {} - /** @name FrameSystemExtensionsCheckWeight (368) */ + /** @name FrameSystemExtensionsCheckWeight (369) */ type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTransactionPaymentChargeTransactionPayment (369) */ + /** @name PalletTransactionPaymentChargeTransactionPayment (370) */ interface PalletTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim (370) */ + /** @name CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim (371) */ type CumulusPrimitivesStorageWeightReclaimStorageWeightReclaim = Null; - /** @name FlashboxRuntimeRuntime (371) */ + /** @name FlashboxRuntimeRuntime (372) */ type FlashboxRuntimeRuntime = Null; } // declare module From b762692fb3cb3bc755c23dc25acc19582099e4ee Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Thu, 29 Aug 2024 17:42:11 -0700 Subject: [PATCH 38/51] api-augment again --- typescript-api/src/dancebox/interfaces/augment-api-query.ts | 3 ++- typescript-api/src/dancebox/interfaces/augment-api-tx.ts | 2 +- typescript-api/src/dancebox/interfaces/lookup.ts | 4 ++-- typescript-api/src/flashbox/interfaces/augment-api-query.ts | 3 ++- typescript-api/src/flashbox/interfaces/augment-api-tx.ts | 2 +- typescript-api/src/flashbox/interfaces/lookup.ts | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/typescript-api/src/dancebox/interfaces/augment-api-query.ts b/typescript-api/src/dancebox/interfaces/augment-api-query.ts index 6c59ca52f..20ce4a029 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-query.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-query.ts @@ -995,7 +995,8 @@ declare module "@polkadot/api-base/types/storage" { * deregistration process inside 'on_finalize' hook. * * It can be the case that some paraIds need to be downgraded to a parathread before deregistering on - * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block finalizes. + * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block + * finalizes. * * Therefore, if we tried to perform this relay deregistration process at the beginning of the session/block * inside ('on_initialize') initializer_on_new_session() as we do for this pallet, it would fail due to the diff --git a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts index ad50eec85..338d4c3ed 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts @@ -3032,7 +3032,7 @@ declare module "@polkadot/api-base/types/submittable" { SpTrieStorageProof, SpRuntimeMultiSignature, DpContainerChainGenesisDataContainerChainGenesisData, - Option + Option, ] >; setParaManager: AugmentedSubmittable< diff --git a/typescript-api/src/dancebox/interfaces/lookup.ts b/typescript-api/src/dancebox/interfaces/lookup.ts index 95d295718..c36590627 100644 --- a/typescript-api/src/dancebox/interfaces/lookup.ts +++ b/typescript-api/src/dancebox/interfaces/lookup.ts @@ -4022,7 +4022,7 @@ export default { ], }, /** - * Lookup428: pallet_identity::types::Registration> */ PalletIdentityRegistration: { @@ -4291,7 +4291,7 @@ export default { bond: "u128", }, /** - * Lookup503: pallet_treasury::SpendStatus */ PalletTreasurySpendStatus: { diff --git a/typescript-api/src/flashbox/interfaces/augment-api-query.ts b/typescript-api/src/flashbox/interfaces/augment-api-query.ts index 706d27faa..7f1148bf5 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-query.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-query.ts @@ -657,7 +657,8 @@ declare module "@polkadot/api-base/types/storage" { * deregistration process inside 'on_finalize' hook. * * It can be the case that some paraIds need to be downgraded to a parathread before deregistering on - * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block finalizes. + * 'paras_registrar'. This process usually takes 2 sessions, and the actual downgrade happens when the block + * finalizes. * * Therefore, if we tried to perform this relay deregistration process at the beginning of the session/block * inside ('on_initialize') initializer_on_new_session() as we do for this pallet, it would fail due to the diff --git a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts index 137d785f4..cf3110462 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts @@ -1569,7 +1569,7 @@ declare module "@polkadot/api-base/types/submittable" { SpTrieStorageProof, SpRuntimeMultiSignature, DpContainerChainGenesisDataContainerChainGenesisData, - Option + Option, ] >; setParaManager: AugmentedSubmittable< diff --git a/typescript-api/src/flashbox/interfaces/lookup.ts b/typescript-api/src/flashbox/interfaces/lookup.ts index 78b829833..945143c65 100644 --- a/typescript-api/src/flashbox/interfaces/lookup.ts +++ b/typescript-api/src/flashbox/interfaces/lookup.ts @@ -2002,7 +2002,7 @@ export default { ], }, /** - * Lookup284: pallet_identity::types::Registration> */ PalletIdentityRegistration: { @@ -2205,7 +2205,7 @@ export default { bond: "u128", }, /** - * Lookup352: pallet_treasury::SpendStatus */ PalletTreasurySpendStatus: { From 9a76e31422088f5a1231e8671063cb0ed3da1581 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 11:02:41 -0700 Subject: [PATCH 39/51] add more docs --- pallets/registrar/src/lib.rs | 32 +++++++++++++++++++++--- primitives/traits/src/lib.rs | 3 +++ solo-chains/runtime/starlight/src/lib.rs | 2 ++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index abbfcee2d..40f8a9f5e 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -176,6 +176,12 @@ pub mod pallet { type RegistrarHooks: RegistrarHooks; + /// External manager that takes care of executing specific operations + /// when register-like functions of this pallet are called. + /// + /// Mostly used when we are in a relay-chain cofiguration context (Starlight) + /// to also register, deregister and upgrading paraIds in polkadot's + /// paras_registrar pallet. type InnerRegistrar: RegistrarHandler; type WeightInfo: WeightInfo; @@ -349,7 +355,7 @@ pub mod pallet { let mut weight = Weight::zero().saturating_add(T::DbWeight::get().reads(1)); let buffered_paras = BufferedParasToDeregister::::get(); - for _para_id in buffered_paras { + for _ in 0..buffered_paras.len() { weight += T::InnerRegistrar::deregister_weight(); } weight @@ -460,6 +466,7 @@ pub mod pallet { fn on_finalize(_: BlockNumberFor) { let buffered_paras = BufferedParasToDeregister::::take(); for para_id in buffered_paras { + // Deregister (in the relay context) each paraId present inside the buffer. T::InnerRegistrar::deregister(para_id); } } @@ -856,6 +863,7 @@ pub mod pallet { // Hold the deposit, we verified we can do this T::Currency::hold(&HoldReason::RegistrarDeposit.into(), &account, deposit)?; + // Register the paraId also in the relay context (if any). T::InnerRegistrar::register( account.clone(), para_id, @@ -918,7 +926,18 @@ pub mod pallet { })?; // Mark this para id for cleanup later Self::schedule_parachain_cleanup(para_id)?; - T::InnerRegistrar::schedule_para_downgrade(para_id)?; + + // If we have InnerRegistrar set to a relay context (like Starlight), + // we first need to downgrade the paraId (if it was a parachain before) + // and convert it to a parathread before deregistering it. Otherwise + // the deregistration process will fail in the scheduled session. + // + // We only downgrade if the paraId is a parachain in the context of + // this pallet. + if let None = ParathreadParams::::get(para_id) { + T::InnerRegistrar::schedule_para_downgrade(para_id)?; + } + Self::deposit_event(Event::ParaIdDeregistered { para_id }); } @@ -955,7 +974,14 @@ pub mod pallet { T::RegistrarHooks::para_marked_valid_for_collating(para_id); - T::InnerRegistrar::schedule_para_upgrade(para_id)?; + // If we execute mark_valid_for_collating, we automatically upgrade + // the paraId to a parachain (in the relay context) at the end of the execution. + // + // We only upgrade if the paraId is a parachain in the context of + // this pallet. + if let None = ParathreadParams::::get(para_id) { + T::InnerRegistrar::schedule_para_upgrade(para_id)?; + } Ok(()) } diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 0f50137c1..96e5f5395 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -386,6 +386,9 @@ impl GenericStorageReader for NativeStorageReader { } } +/// Trait to handle registrar-related operations in a relay-chain context. +/// Mostly used to wire Tanssi's and Polkadot's registrars, for them to +/// work together in a solo-chain environment. pub trait RegistrarHandler { fn register( who: AccountId, diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index f0113f208..2375ea790 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1648,6 +1648,7 @@ where } fn schedule_para_upgrade(id: ParaId) -> DispatchResult { + // Return Ok() if the paraId is already a parachain in the relay context if !RegistrarManager::is_parachain(id) { return RegistrarManager::make_parachain(id); } @@ -1655,6 +1656,7 @@ where } fn schedule_para_downgrade(id: ParaId) -> DispatchResult { + // Return Ok() if the paraId is already a parathread in the relay context if !RegistrarManager::is_parathread(id) { return RegistrarManager::make_parathread(id); } From ecb457df2bf5e10c566d170ca921b8a153becda3 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 11:19:36 -0700 Subject: [PATCH 40/51] fix core scheduling test --- .../src/tests/core_scheduling_tests.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs index 0c7c56d78..e56588184 100644 --- a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs @@ -510,12 +510,6 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { // the only way to achieve this is by assigning the parathread a higher para-id run_to_block(2); - // Coordinate both ParasShared and Session CurrentIndex storages. - // If we don't do this, the one inside ParasShared is configured to - // one session before, and we want the to be the same for later checking in - // session 6. - ParasShared::set_session_index(Session::current_index()); - // Now the parathread should be there assert!(Paras::is_parathread(1001u32.into())); let alice_keys = @@ -535,7 +529,15 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { )); run_to_session(2); - ParasShared::set_session_index(Session::current_index()); + + // We call run_block() after each run_to_session() for on_finalize() to + // be properly executed, and thus to coordinate all the necessary storages, + // specially ParasShared and Session CurrentIndex storages. + // + // If we don't do this, ParasShared's CurrentIndex is configured to + // one session before, and we want the to be the same for later checking in + // session 6. + run_block(); // We need to accept the validation code, so that the para is onboarded after 2 sessions. assert_ok!(Paras::add_trusted_validation_code( @@ -544,7 +546,7 @@ fn test_parathread_uses_0_and_then_1_after_parachain_onboarded() { )); run_to_session(4); - ParasShared::set_session_index(Session::current_index()); + run_block(); set_dummy_boot_node(origin_of(ALICE.into()), 1000.into()); assert_ok!(ContainerRegistrar::mark_valid_for_collating( From cf97156e020b5066cefd0db772b3913ff3e98966 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 13:32:55 -0700 Subject: [PATCH 41/51] add test for invalid wasm --- .../src/tests/collator_assignment_tests.rs | 64 +++++++++++++++++-- .../src/tests/core_scheduling_tests.rs | 2 +- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs index 6658272ed..c6459c88b 100644 --- a/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/collator_assignment_tests.rs @@ -17,14 +17,14 @@ #![cfg(test)] use { - crate::tests::common::*, crate::{ - Balances, CollatorConfiguration, ContainerRegistrar, Paras, ServicesPayment, - TanssiAuthorityMapping, TanssiInvulnerables, + tests::common::*, Balances, CollatorConfiguration, ContainerRegistrar, Paras, + ServicesPayment, TanssiAuthorityMapping, TanssiInvulnerables, }, cumulus_primitives_core::{relay_chain::HeadData, ParaId}, - frame_support::assert_ok, + frame_support::{assert_noop, assert_ok}, parity_scale_codec::Encode, + runtime_common::paras_registrar, sp_consensus_aura::AURA_ENGINE_ID, sp_runtime::{traits::BlakeTwo256, DigestItem}, sp_std::vec, @@ -718,6 +718,62 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { }); } +#[test] +fn test_collators_not_assigned_if_wasm_code_is_invalid() { + ExtBuilder::default() + .with_balances(vec![ + // Alice gets 10k extra tokens for her mapping deposit + (AccountId::from(ALICE), 210_000 * UNIT), + (AccountId::from(BOB), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + ]) + .with_config(pallet_configuration::HostConfiguration { + max_collators: 100, + min_orchestrator_collators: 2, + max_orchestrator_collators: 5, + collators_per_container: 2, + full_rotation_period: 24, + ..Default::default() + }) + .build() + .execute_with(|| { + assert_ok!(ContainerRegistrar::register( + origin_of(ALICE.into()), + 1001.into(), + get_genesis_data_with_validation_code().0, + Some(HeadData(vec![1u8, 1u8, 1u8])) + )); + + run_to_session(2); + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + + // In session 2, we should mark the validation code as trusted in the relay + // for the paraId to be onboarded as a parathread after 2 sessions. + // We won't do it now to see what happens. + run_to_session(4); + + // paraId should not have been onboarded after 2 sessions. + assert!(Paras::lifecycle(1001u32.into()).is_none()); + + set_dummy_boot_node(origin_of(ALICE.into()), 1001.into()); + + // mark_valid_for_collating() should fail, as the paraId has not been onboarded yet, + // due to its validation code is not trusted. + assert_noop!( + ContainerRegistrar::mark_valid_for_collating(root_origin(), 1001.into()), + paras_registrar::Error::::NotParathread + ); + + // paraId should not have any collators assigned. + let assignment = TanssiCollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + }); +} + #[test] fn test_paras_registered_but_zero_credits() { ExtBuilder::default() diff --git a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs index e56588184..0b216ab71 100644 --- a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs @@ -18,7 +18,7 @@ use { crate::{ - tests::common::*, ContainerRegistrar, OnDemandAssignmentProvider, Paras, ParasShared, + tests::common::*, ContainerRegistrar, OnDemandAssignmentProvider, Paras, Session, }, cumulus_primitives_core::relay_chain::{ From 1da160133ce626b398e73c7672930540e8662fa1 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 14:00:36 -0700 Subject: [PATCH 42/51] add registrar errors to ContainerRegistrar --- pallets/registrar/src/lib.rs | 4 ++++ solo-chains/runtime/starlight/src/lib.rs | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 40f8a9f5e..b9337c2d6 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -341,6 +341,10 @@ pub mod pallet { InvalidRelayManagerSignature, /// Tried to deregister a parachain that was not deregistered from the relay chain ParaStillExistsInRelay, + /// Tried to register a paraId in a relay context without specifying a proper HeadData. + HeadDataNecessary, + /// Tried to register a paraId in a relay context without specifying a wasm chain code. + WasmCodeNecessary, } #[pallet::composite_enum] diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 2375ea790..804f8cbc8 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -39,6 +39,7 @@ use { frame_system::{pallet_prelude::BlockNumberFor, EnsureNever}, nimbus_primitives::NimbusId, pallet_initializer as tanssi_initializer, + pallet_registrar::Error as ContainerRegistrarError, pallet_registrar_runtime_api::ContainerChainGenesisData, pallet_services_payment::{ProvideBlockProductionCost, ProvideCollatorAssignmentCost}, pallet_session::ShouldEndSession, @@ -80,7 +81,7 @@ use { serde::{Deserialize, Serialize}, sp_core::storage::well_known_keys as StorageWellKnownKeys, sp_genesis_builder::PresetId, - sp_runtime::{traits::BlockNumberProvider, DispatchError}, + sp_runtime::traits::BlockNumberProvider, sp_std::{ cmp::Ordering, collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, @@ -1610,14 +1611,15 @@ parameter_types! { pub const MaxEncodedGenesisDataSize: u32 = 5_000_000u32; // 5MB } -pub struct InnerStarlightRegistrar( - PhantomData<(AccountId, RegistrarManager, RegistrarWeightInfo)>, +pub struct InnerStarlightRegistrar( + PhantomData<(Runtime, AccountId, RegistrarManager, RegistrarWeightInfo)>, ); -impl RegistrarHandler - for InnerStarlightRegistrar +impl RegistrarHandler + for InnerStarlightRegistrar where RegistrarManager: RegistrarInterface, RegistrarWeightInfo: paras_registrar::WeightInfo, + Runtime: pallet_registrar::Config, { fn register( who: AccountId, @@ -1628,7 +1630,7 @@ where // Return early if head_data is not specified let genesis_head = match head_data { Some(data) => data, - None => return Err(DispatchError::Other("HeadData not specified!")), + None => return Err(ContainerRegistrarError::::HeadDataNecessary.into()), }; let key_values: Vec<(Vec, Vec)> = @@ -1640,7 +1642,7 @@ where .find(|(key, _)| key == &StorageWellKnownKeys::CODE.to_vec()) { Some((_, code)) => ValidationCode(code), - None => return Err(DispatchError::Other("Code not found")), + None => return Err(ContainerRegistrarError::::WasmCodeNecessary.into()), }; // Try to register the parachain @@ -1695,7 +1697,7 @@ impl pallet_registrar::Config for Runtime { type RuntimeHoldReason = RuntimeHoldReason; // TODO: replace TestWeightInfo when we use proper weights on paras_registrar type InnerRegistrar = - InnerStarlightRegistrar; + InnerStarlightRegistrar; type WeightInfo = pallet_registrar::weights::SubstrateWeight; } From 368163e9b7bce4d0e18440cedb4d930f54652ecb Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 14:00:43 -0700 Subject: [PATCH 43/51] fmt --- .../runtime/starlight/src/tests/core_scheduling_tests.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs index 0b216ab71..a9c5f229b 100644 --- a/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs +++ b/solo-chains/runtime/starlight/src/tests/core_scheduling_tests.rs @@ -17,10 +17,7 @@ #![cfg(test)] use { - crate::{ - tests::common::*, ContainerRegistrar, OnDemandAssignmentProvider, Paras, - Session, - }, + crate::{tests::common::*, ContainerRegistrar, OnDemandAssignmentProvider, Paras, Session}, cumulus_primitives_core::relay_chain::{ vstaging::SchedulerParams, AsyncBackingParams, CoreIndex, HeadData, }, From 694f2f1e0f9830b194a74eec182a28d2867b6a48 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 14:09:33 -0700 Subject: [PATCH 44/51] cargo fmt --- solo-chains/runtime/starlight/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 54bb2b298..bb23dc9b2 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -80,7 +80,7 @@ use { }, scale_info::TypeInfo, serde::{Deserialize, Serialize}, - sp_core::{Get, storage::well_known_keys as StorageWellKnownKeys}, + sp_core::{storage::well_known_keys as StorageWellKnownKeys, Get}, sp_genesis_builder::PresetId, sp_runtime::traits::BlockNumberProvider, sp_std::{ From 31b4455af752189af1af85a683b2b33e78d0111d Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Fri, 30 Aug 2024 15:13:36 -0700 Subject: [PATCH 45/51] api-augment --- .../src/dancebox/interfaces/augment-api-errors.ts | 4 ++++ typescript-api/src/dancebox/interfaces/lookup.ts | 2 ++ typescript-api/src/dancebox/interfaces/types-lookup.ts | 6 +++++- .../src/flashbox/interfaces/augment-api-errors.ts | 4 ++++ typescript-api/src/flashbox/interfaces/lookup.ts | 2 ++ typescript-api/src/flashbox/interfaces/types-lookup.ts | 6 +++++- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/typescript-api/src/dancebox/interfaces/augment-api-errors.ts b/typescript-api/src/dancebox/interfaces/augment-api-errors.ts index 2f7e8638c..a8813831c 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-errors.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-errors.ts @@ -423,6 +423,8 @@ declare module "@polkadot/api-base/types/errors" { registrar: { /** Attempted to register a ParaId with a genesis data size greater than the limit */ GenesisDataTooBig: AugmentedError; + /** Tried to register a paraId in a relay context without specifying a proper HeadData. */ + HeadDataNecessary: AugmentedError; /** The provided signature from the parachain manager in the relay is not valid */ InvalidRelayManagerSignature: AugmentedError; /** The provided relay storage proof is not valid */ @@ -451,6 +453,8 @@ declare module "@polkadot/api-base/types/errors" { ParaStillExistsInRelay: AugmentedError; /** The relay storage root for the corresponding block number could not be retrieved */ RelayStorageRootNotFound: AugmentedError; + /** Tried to register a paraId in a relay context without specifying a wasm chain code. */ + WasmCodeNecessary: AugmentedError; /** Generic error */ [key: string]: AugmentedError; }; diff --git a/typescript-api/src/dancebox/interfaces/lookup.ts b/typescript-api/src/dancebox/interfaces/lookup.ts index c36590627..4ef071b31 100644 --- a/typescript-api/src/dancebox/interfaces/lookup.ts +++ b/typescript-api/src/dancebox/interfaces/lookup.ts @@ -4121,6 +4121,8 @@ export default { "InvalidRelayStorageProof", "InvalidRelayManagerSignature", "ParaStillExistsInRelay", + "HeadDataNecessary", + "WasmCodeNecessary", ], }, /** Lookup458: pallet_configuration::HostConfiguration */ diff --git a/typescript-api/src/dancebox/interfaces/types-lookup.ts b/typescript-api/src/dancebox/interfaces/types-lookup.ts index f515c2d26..ba5e5ed7a 100644 --- a/typescript-api/src/dancebox/interfaces/types-lookup.ts +++ b/typescript-api/src/dancebox/interfaces/types-lookup.ts @@ -5565,6 +5565,8 @@ declare module "@polkadot/types/lookup" { readonly isInvalidRelayStorageProof: boolean; readonly isInvalidRelayManagerSignature: boolean; readonly isParaStillExistsInRelay: boolean; + readonly isHeadDataNecessary: boolean; + readonly isWasmCodeNecessary: boolean; readonly type: | "ParaIdAlreadyRegistered" | "ParaIdNotRegistered" @@ -5580,7 +5582,9 @@ declare module "@polkadot/types/lookup" { | "RelayStorageRootNotFound" | "InvalidRelayStorageProof" | "InvalidRelayManagerSignature" - | "ParaStillExistsInRelay"; + | "ParaStillExistsInRelay" + | "HeadDataNecessary" + | "WasmCodeNecessary"; } /** @name PalletConfigurationHostConfiguration (458) */ diff --git a/typescript-api/src/flashbox/interfaces/augment-api-errors.ts b/typescript-api/src/flashbox/interfaces/augment-api-errors.ts index 343590b3f..d13bd62ad 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-errors.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-errors.ts @@ -251,6 +251,8 @@ declare module "@polkadot/api-base/types/errors" { registrar: { /** Attempted to register a ParaId with a genesis data size greater than the limit */ GenesisDataTooBig: AugmentedError; + /** Tried to register a paraId in a relay context without specifying a proper HeadData. */ + HeadDataNecessary: AugmentedError; /** The provided signature from the parachain manager in the relay is not valid */ InvalidRelayManagerSignature: AugmentedError; /** The provided relay storage proof is not valid */ @@ -279,6 +281,8 @@ declare module "@polkadot/api-base/types/errors" { ParaStillExistsInRelay: AugmentedError; /** The relay storage root for the corresponding block number could not be retrieved */ RelayStorageRootNotFound: AugmentedError; + /** Tried to register a paraId in a relay context without specifying a wasm chain code. */ + WasmCodeNecessary: AugmentedError; /** Generic error */ [key: string]: AugmentedError; }; diff --git a/typescript-api/src/flashbox/interfaces/lookup.ts b/typescript-api/src/flashbox/interfaces/lookup.ts index 945143c65..7a518747c 100644 --- a/typescript-api/src/flashbox/interfaces/lookup.ts +++ b/typescript-api/src/flashbox/interfaces/lookup.ts @@ -2101,6 +2101,8 @@ export default { "InvalidRelayStorageProof", "InvalidRelayManagerSignature", "ParaStillExistsInRelay", + "HeadDataNecessary", + "WasmCodeNecessary", ], }, /** Lookup314: pallet_configuration::HostConfiguration */ diff --git a/typescript-api/src/flashbox/interfaces/types-lookup.ts b/typescript-api/src/flashbox/interfaces/types-lookup.ts index f9d25b857..ce99b233e 100644 --- a/typescript-api/src/flashbox/interfaces/types-lookup.ts +++ b/typescript-api/src/flashbox/interfaces/types-lookup.ts @@ -2729,6 +2729,8 @@ declare module "@polkadot/types/lookup" { readonly isInvalidRelayStorageProof: boolean; readonly isInvalidRelayManagerSignature: boolean; readonly isParaStillExistsInRelay: boolean; + readonly isHeadDataNecessary: boolean; + readonly isWasmCodeNecessary: boolean; readonly type: | "ParaIdAlreadyRegistered" | "ParaIdNotRegistered" @@ -2744,7 +2746,9 @@ declare module "@polkadot/types/lookup" { | "RelayStorageRootNotFound" | "InvalidRelayStorageProof" | "InvalidRelayManagerSignature" - | "ParaStillExistsInRelay"; + | "ParaStillExistsInRelay" + | "HeadDataNecessary" + | "WasmCodeNecessary"; } /** @name PalletConfigurationHostConfiguration (314) */ From 29bf2d8365d566de33bb360f6ec4a98af15f0888 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Mon, 2 Sep 2024 16:01:49 -0700 Subject: [PATCH 46/51] add a way to test InnerRegistrar calls in pallet registrar --- pallets/registrar/src/lib.rs | 2 +- pallets/registrar/src/mock.rs | 61 ++++++++++++++++++++++++++++++++-- pallets/registrar/src/tests.rs | 30 +++++++++++++++++ 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index b9337c2d6..63da9499b 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -179,7 +179,7 @@ pub mod pallet { /// External manager that takes care of executing specific operations /// when register-like functions of this pallet are called. /// - /// Mostly used when we are in a relay-chain cofiguration context (Starlight) + /// Mostly used when we are in a relay-chain configuration context (Starlight) /// to also register, deregister and upgrading paraIds in polkadot's /// paras_registrar pallet. type InnerRegistrar: RegistrarHandler; diff --git a/pallets/registrar/src/mock.rs b/pallets/registrar/src/mock.rs index 02118e720..0ae0ce7e6 100644 --- a/pallets/registrar/src/mock.rs +++ b/pallets/registrar/src/mock.rs @@ -18,7 +18,7 @@ use { crate::{self as pallet_registrar, ParathreadParamsTy, RegistrarHooks}, dp_container_chain_genesis_data::ContainerChainGenesisData, frame_support::{ - traits::{ConstU16, ConstU64}, + traits::{ConstU16, ConstU64, OnFinalize, OnInitialize}, weights::Weight, }, parity_scale_codec::{Decode, Encode}, @@ -29,7 +29,7 @@ use { BuildStorage, }, std::collections::BTreeMap, - tp_traits::{ParaId, RelayStorageRootProvider}, + tp_traits::{ParaId, RegistrarHandler, RelayStorageRootProvider}, }; type Block = frame_system::mocking::MockBlock; @@ -148,7 +148,7 @@ impl pallet_registrar::Config for Test { type DepositAmount = DepositAmount; type RuntimeHoldReason = RuntimeHoldReason; type RegistrarHooks = Mock; - type InnerRegistrar = (); + type InnerRegistrar = Mock; type WeightInfo = (); } @@ -196,6 +196,11 @@ pub mod mock_data { pub enum HookCall { MarkedValid(ParaId), Deregistered(ParaId), + InnerRegister(ParaId), + InnerScheduleParaUpgrade(ParaId), + InnerScheduleParaDowngrade(ParaId), + InnerDeregister(ParaId), + InnerDeregisterWeight, } pub enum HookCallType { @@ -231,6 +236,50 @@ impl RegistrarHooks for mock_data::Pallet { fn benchmarks_ensure_valid_for_collating(_para_id: ParaId) {} } +// We also use mock_data pallet to check whether InnerRegistrar methods are called properly. +impl RegistrarHandler for mock_data::Pallet { + fn register( + _who: AccountId, + id: ParaId, + _genesis_storage: Vec, + _head_data: Option, + ) -> sp_runtime::DispatchResult { + Mock::mutate(|m| { + m.called_hooks.push(HookCall::InnerRegister(id)); + + Ok(()) + }) + } + + fn deregister(id: ParaId) { + Mock::mutate(|m| { + m.called_hooks.push(HookCall::InnerDeregister(id)); + }) + } + + fn schedule_para_upgrade(id: ParaId) -> sp_runtime::DispatchResult { + Mock::mutate(|m| { + m.called_hooks.push(HookCall::InnerScheduleParaUpgrade(id)); + Ok(()) + }) + } + + fn schedule_para_downgrade(id: ParaId) -> sp_runtime::DispatchResult { + Mock::mutate(|m| { + m.called_hooks + .push(HookCall::InnerScheduleParaDowngrade(id)); + Ok(()) + }) + } + + fn deregister_weight() -> Weight { + Mock::mutate(|m| { + m.called_hooks.push(HookCall::InnerDeregisterWeight); + Weight::default() + }) + } +} + impl mock_data::Config for Test {} #[derive( @@ -282,6 +331,7 @@ impl Mocks { } last_call_type.insert(*para_id, HookCallType::Deregistered); } + _ => {} } } } @@ -359,10 +409,15 @@ pub fn run_to_block(n: u64) { if x % SESSION_LEN == 1 { let session_index = (x / SESSION_LEN) as u32; ParaRegistrar::initializer_on_new_session(&session_index); + ParaRegistrar::on_initialize(session_index.into()); } } } +pub fn end_block() { + ParaRegistrar::on_finalize(System::block_number()); +} + pub fn get_ed25519_pairs(num: u32) -> Vec { let seed: u128 = 12345678901234567890123456789012; let mut pairs = Vec::new(); diff --git a/pallets/registrar/src/tests.rs b/pallets/registrar/src/tests.rs index 05221092d..bc05ab761 100644 --- a/pallets/registrar/src/tests.rs +++ b/pallets/registrar/src/tests.rs @@ -55,6 +55,14 @@ fn register_para_id_42() { run_to_session(2); assert_eq!(ParaRegistrar::registered_para_ids(), vec![42.into()]); assert_eq!(ParaRegistrar::pending_registered_para_ids(), vec![]); + + // Check that InnerRegistrar methods were called properly. + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerRegister(42u32.into()))); + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerScheduleParaUpgrade(42u32.into()))); }); } @@ -194,6 +202,28 @@ fn deregister_para_id_42_after_1_sessions() { assert_eq!(ParaRegistrar::pending_registered_para_ids(), vec![]); assert_eq!(ParaRegistrar::registered_para_ids(), vec![]); assert!(ParaRegistrar::para_genesis_data(ParaId::from(42)).is_none()); + + // Run two more sessions for the paraId to get deregistered + // in the relay context (if any) via InnerRegistrar. + run_to_session(5); + end_block(); + + // Check that InnerRegistrar methods were called properly. + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerRegister(42u32.into()))); + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerScheduleParaUpgrade(42u32.into()))); + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerScheduleParaDowngrade(42u32.into()))); + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerDeregister(42u32.into()))); + assert!(mock_data::Pallet::::mock() + .called_hooks + .contains(&HookCall::InnerDeregisterWeight)); }); } From 1d7a9ca5d0554f4969618d571c9c9e4bea4420cb Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Mon, 2 Sep 2024 17:13:57 -0700 Subject: [PATCH 47/51] adapt previous tests --- pallets/registrar/src/tests.rs | 78 ++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/pallets/registrar/src/tests.rs b/pallets/registrar/src/tests.rs index bc05ab761..e0d2ac4d8 100644 --- a/pallets/registrar/src/tests.rs +++ b/pallets/registrar/src/tests.rs @@ -57,10 +57,10 @@ fn register_para_id_42() { assert_eq!(ParaRegistrar::pending_registered_para_ids(), vec![]); // Check that InnerRegistrar methods were called properly. - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerRegister(42u32.into()))); - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerScheduleParaUpgrade(42u32.into()))); }); @@ -209,19 +209,19 @@ fn deregister_para_id_42_after_1_sessions() { end_block(); // Check that InnerRegistrar methods were called properly. - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerRegister(42u32.into()))); - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerScheduleParaUpgrade(42u32.into()))); - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerScheduleParaDowngrade(42u32.into()))); - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerDeregister(42u32.into()))); - assert!(mock_data::Pallet::::mock() + assert!(Mock::mock() .called_hooks .contains(&HookCall::InnerDeregisterWeight)); }); @@ -732,14 +732,21 @@ fn mark_valid_for_collating_calls_registered_hook() { empty_genesis_data(), None )); - assert_eq!(Mock::mock().called_hooks, vec![]); + assert_eq!( + Mock::mock().called_hooks, + vec![HookCall::InnerRegister(42.into())] + ); assert_ok!(ParaRegistrar::mark_valid_for_collating( RuntimeOrigin::root(), 42.into(), )); assert_eq!( Mock::mock().called_hooks, - vec![HookCall::MarkedValid(42.into())] + vec![ + HookCall::InnerRegister(42.into()), + HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()) + ] ); }); } @@ -1042,6 +1049,10 @@ fn deregister_2_container_chains_in_same_block() { )); run_to_session(2); + // Run end_block after each run_to_session to mock the reality and + // kill BufferedParasToDeregister storage after a session change. + end_block(); + assert_eq!( ParaRegistrar::registered_para_ids(), vec![42.into(), 43.into()] @@ -1059,12 +1070,20 @@ fn deregister_2_container_chains_in_same_block() { assert_eq!( Mock::mock().called_hooks, vec![ + HookCall::InnerRegister(42.into()), + HookCall::InnerRegister(43.into()), HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()), HookCall::MarkedValid(43.into()), + HookCall::InnerScheduleParaUpgrade(43.into()), + HookCall::InnerScheduleParaDowngrade(42.into()), + HookCall::InnerScheduleParaDowngrade(43.into()), ] ); run_to_session(4); + end_block(); + assert_eq!(ParaRegistrar::registered_para_ids(), vec![]); assert_eq!( ParaRegistrar::para_genesis_data(ParaId::from(42)).as_ref(), @@ -1077,10 +1096,20 @@ fn deregister_2_container_chains_in_same_block() { assert_eq!( Mock::mock().called_hooks, vec![ + HookCall::InnerRegister(42.into()), + HookCall::InnerRegister(43.into()), HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()), HookCall::MarkedValid(43.into()), + HookCall::InnerScheduleParaUpgrade(43.into()), + HookCall::InnerScheduleParaDowngrade(42.into()), + HookCall::InnerScheduleParaDowngrade(43.into()), HookCall::Deregistered(42.into()), HookCall::Deregistered(43.into()), + HookCall::InnerDeregisterWeight, + HookCall::InnerDeregisterWeight, + HookCall::InnerDeregister(42.into()), + HookCall::InnerDeregister(43.into()), ] ); }); @@ -1112,6 +1141,10 @@ fn deregister_2_container_chains_in_consecutive_sessions() { )); run_to_session(2); + // Run end_block after each run_to_session to mock the reality and + // kill BufferedParasToDeregister storage after a session change. + end_block(); + assert_eq!( ParaRegistrar::registered_para_ids(), vec![42.into(), 43.into()] @@ -1127,6 +1160,7 @@ fn deregister_2_container_chains_in_consecutive_sessions() { assert_ok!(ParaRegistrar::deregister(RuntimeOrigin::root(), 42.into(),)); run_to_session(3); + end_block(); assert_eq!( ParaRegistrar::registered_para_ids(), vec![42.into(), 43.into()] @@ -1143,12 +1177,19 @@ fn deregister_2_container_chains_in_consecutive_sessions() { assert_eq!( Mock::mock().called_hooks, vec![ + HookCall::InnerRegister(42.into()), + HookCall::InnerRegister(43.into()), HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()), HookCall::MarkedValid(43.into()), + HookCall::InnerScheduleParaUpgrade(43.into()), + HookCall::InnerScheduleParaDowngrade(42.into()), + HookCall::InnerScheduleParaDowngrade(43.into()), ] ); run_to_session(4); + end_block(); assert_eq!(ParaRegistrar::registered_para_ids(), vec![43.into()]); assert_eq!( ParaRegistrar::para_genesis_data(ParaId::from(42)).as_ref(), @@ -1161,13 +1202,22 @@ fn deregister_2_container_chains_in_consecutive_sessions() { assert_eq!( Mock::mock().called_hooks, vec![ + HookCall::InnerRegister(42.into()), + HookCall::InnerRegister(43.into()), HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()), HookCall::MarkedValid(43.into()), + HookCall::InnerScheduleParaUpgrade(43.into()), + HookCall::InnerScheduleParaDowngrade(42.into()), + HookCall::InnerScheduleParaDowngrade(43.into()), HookCall::Deregistered(42.into()), + HookCall::InnerDeregisterWeight, + HookCall::InnerDeregister(42.into()), ] ); run_to_session(5); + end_block(); assert_eq!(ParaRegistrar::registered_para_ids(), vec![]); assert_eq!( ParaRegistrar::para_genesis_data(ParaId::from(42)).as_ref(), @@ -1180,10 +1230,20 @@ fn deregister_2_container_chains_in_consecutive_sessions() { assert_eq!( Mock::mock().called_hooks, vec![ + HookCall::InnerRegister(42.into()), + HookCall::InnerRegister(43.into()), HookCall::MarkedValid(42.into()), + HookCall::InnerScheduleParaUpgrade(42.into()), HookCall::MarkedValid(43.into()), + HookCall::InnerScheduleParaUpgrade(43.into()), + HookCall::InnerScheduleParaDowngrade(42.into()), + HookCall::InnerScheduleParaDowngrade(43.into()), HookCall::Deregistered(42.into()), + HookCall::InnerDeregisterWeight, + HookCall::InnerDeregister(42.into()), HookCall::Deregistered(43.into()), + HookCall::InnerDeregisterWeight, + HookCall::InnerDeregister(43.into()), ] ); }); From 433dfea9319c3f191ef82c70847c43f53082cf90 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Mon, 2 Sep 2024 17:16:22 -0700 Subject: [PATCH 48/51] comment --- pallets/registrar/src/tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pallets/registrar/src/tests.rs b/pallets/registrar/src/tests.rs index e0d2ac4d8..0b3fd7515 100644 --- a/pallets/registrar/src/tests.rs +++ b/pallets/registrar/src/tests.rs @@ -206,6 +206,8 @@ fn deregister_para_id_42_after_1_sessions() { // Run two more sessions for the paraId to get deregistered // in the relay context (if any) via InnerRegistrar. run_to_session(5); + // Run end_block after run_to_session to mock the reality and + // kill BufferedParasToDeregister storage after a session change. end_block(); // Check that InnerRegistrar methods were called properly. From 73daab1933b5cfc51de53b7c7e8512420e7907c0 Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Tue, 3 Sep 2024 14:02:52 -0700 Subject: [PATCH 49/51] pr comments --- solo-chains/runtime/starlight/src/lib.rs | 8 +- .../starlight/src/tests/relay_registrar.rs | 79 +++++-------------- 2 files changed, 24 insertions(+), 63 deletions(-) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index bb23dc9b2..4344d70cf 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1634,13 +1634,11 @@ where None => return Err(ContainerRegistrarError::::HeadDataNecessary.into()), }; - let key_values: Vec<(Vec, Vec)> = - genesis_storage.into_iter().map(Into::into).collect(); - // Check if the wasm code is present in storage - let validation_code = match key_values + let validation_code = match genesis_storage .into_iter() - .find(|(key, _)| key == &StorageWellKnownKeys::CODE.to_vec()) + .map(Into::into) + .find(|(key, _): &(Vec, Vec)| key == &StorageWellKnownKeys::CODE) { Some((_, code)) => ValidationCode(code), None => return Err(ContainerRegistrarError::::WasmCodeNecessary.into()), diff --git a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs index 1a0c8a38e..e9dc4e45a 100644 --- a/solo-chains/runtime/starlight/src/tests/relay_registrar.rs +++ b/solo-chains/runtime/starlight/src/tests/relay_registrar.rs @@ -17,7 +17,7 @@ #![cfg(test)] use { - crate::{tests::common::*, Configuration, ContainerRegistrar, Paras, Registrar, System}, + crate::{tests::common::*, ContainerRegistrar, Paras, Registrar, System}, cumulus_primitives_core::relay_chain::HeadData, frame_support::{assert_noop, assert_ok}, pallet_registrar::Event as ContainerRegistrarEvent, @@ -116,14 +116,7 @@ fn register_para_via_container_registrar() { assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); - run_to_session(1u32); - - // Change max_head_data_size config. - assert_ok!( - Configuration::set_max_head_data_size(root_origin(), 20500), - () - ); - run_to_session(4u32); + run_to_session(2u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, 20500 @@ -152,7 +145,7 @@ fn register_para_via_container_registrar() { // Now let's check if the para was preoperly registered in the relay. // Run to next session. - run_to_session(5); + run_to_session(3); assert!(Paras::lifecycle(1003.into()) .expect("para should be onboarding") .is_onboarding()); @@ -162,7 +155,7 @@ fn register_para_via_container_registrar() { root_origin(), validation_code.into() )); - run_to_session(7); + run_to_session(5); // Now the para should be a parathread. assert!(Paras::lifecycle(1003.into()) @@ -185,14 +178,7 @@ fn cannot_register_para_twice_in_relay() { assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); - run_to_session(1u32); - - // Change max_head_data_size config. - assert_ok!( - Configuration::set_max_head_data_size(root_origin(), 20500), - () - ); - run_to_session(4u32); + run_to_session(2u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, 20500 @@ -221,7 +207,7 @@ fn cannot_register_para_twice_in_relay() { // Now let's check if the para was preoperly registered in the relay. // Run to next session. - run_to_session(5); + run_to_session(3); assert!(Paras::lifecycle(1003.into()) .expect("para should be onboarding") .is_onboarding()); @@ -231,7 +217,7 @@ fn cannot_register_para_twice_in_relay() { root_origin(), validation_code.clone().into() )); - run_to_session(7); + run_to_session(5); // Now the para should be a parathread. assert!(Paras::lifecycle(1003.into()) @@ -266,14 +252,7 @@ fn mark_valid_for_collating_converts_to_parachain() { assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); - run_to_session(1u32); - - // Change max_head_data_size config. - assert_ok!( - Configuration::set_max_head_data_size(root_origin(), 20500), - () - ); - run_to_session(4u32); + run_to_session(2u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, 20500 @@ -302,7 +281,7 @@ fn mark_valid_for_collating_converts_to_parachain() { // Now let's check if the para was preoperly registered in the relay. // Run to next session. - run_to_session(5); + run_to_session(3); assert!(Paras::lifecycle(1003.into()) .expect("para should be onboarding") .is_onboarding()); @@ -312,7 +291,7 @@ fn mark_valid_for_collating_converts_to_parachain() { root_origin(), validation_code.into() )); - run_to_session(7); + run_to_session(5); // Now the para should be a parathread. assert!(Paras::lifecycle(1003.into()) @@ -328,7 +307,7 @@ fn mark_valid_for_collating_converts_to_parachain() { ); // The change should be applied after 2 sessions. - run_to_session(9); + run_to_session(7); assert!(Paras::lifecycle(1003.into()) .expect("para should be parachain") .is_parachain()); @@ -349,15 +328,7 @@ fn deregister_calls_schedule_para_cleanup() { assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); - run_to_session(1u32); - - // Change max_head_data_size config. - assert_ok!( - Configuration::set_max_head_data_size(root_origin(), 20500), - () - ); - - run_to_session(4u32); + run_to_session(2u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, 20500 @@ -386,7 +357,7 @@ fn deregister_calls_schedule_para_cleanup() { // Now let's check if the para was preoperly registered in the relay. // Run to next session. - run_to_session(5); + run_to_session(3); assert!(Paras::lifecycle(1003.into()) .expect("para should be onboarding") .is_onboarding()); @@ -397,7 +368,7 @@ fn deregister_calls_schedule_para_cleanup() { validation_code.into() )); - run_to_session(7); + run_to_session(5); // Now the para should be a parathread. assert!(Paras::lifecycle(1003.into()) @@ -413,7 +384,7 @@ fn deregister_calls_schedule_para_cleanup() { ); // The change should be applied after 2 sessions. - run_to_session(9); + run_to_session(7); assert!(Paras::lifecycle(1003.into()) .expect("para should be parachain") .is_parachain()); @@ -433,7 +404,7 @@ fn deregister_calls_schedule_para_cleanup() { .into(), ); - run_to_session(11); + run_to_session(9); end_block(); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); @@ -460,15 +431,7 @@ fn deregister_two_paras_in_the_same_block() { assert_eq!(Runtime::registered_paras(), vec![1001.into(), 1002.into()]); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); assert_eq!(Runtime::genesis_data(1004.into()).as_ref(), None); - run_to_session(1u32); - - // Change max_head_data_size config. - assert_ok!( - Configuration::set_max_head_data_size(root_origin(), 20500), - () - ); - - run_to_session(4u32); + run_to_session(2u32); assert_eq!( parachains_configuration::ActiveConfig::::get().max_head_data_size, 20500 @@ -509,7 +472,7 @@ fn deregister_two_paras_in_the_same_block() { // Now let's check if the paras were preoperly registered in the relay. // Run to next session. - run_to_session(5); + run_to_session(3); assert!(Paras::lifecycle(1003.into()) .expect("para should be onboarding") .is_onboarding()); @@ -524,7 +487,7 @@ fn deregister_two_paras_in_the_same_block() { validation_code.into() )); - run_to_session(7); + run_to_session(5); // Now paras should be parathreads. assert!(Paras::lifecycle(1003.into()) @@ -549,7 +512,7 @@ fn deregister_two_paras_in_the_same_block() { ); // The change should be applied after 2 sessions. - run_to_session(9); + run_to_session(7); assert!(Paras::lifecycle(1003.into()) .expect("para should be parachain") .is_parachain()); @@ -586,7 +549,7 @@ fn deregister_two_paras_in_the_same_block() { .into(), ); - run_to_session(11); + run_to_session(9); end_block(); assert_eq!(Runtime::genesis_data(1003.into()).as_ref(), None); From b5517b405518f60a3295b587fd30c0dae6d1baad Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 4 Sep 2024 11:54:57 +0200 Subject: [PATCH 50/51] Avoid clone of genesis storage in dancebox --- pallets/registrar/src/lib.rs | 2 +- primitives/traits/src/lib.rs | 4 ++-- solo-chains/runtime/starlight/src/lib.rs | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pallets/registrar/src/lib.rs b/pallets/registrar/src/lib.rs index 63da9499b..0775831d5 100644 --- a/pallets/registrar/src/lib.rs +++ b/pallets/registrar/src/lib.rs @@ -871,7 +871,7 @@ pub mod pallet { T::InnerRegistrar::register( account.clone(), para_id, - genesis_data.clone().storage, + &genesis_data.storage, head_data, )?; diff --git a/primitives/traits/src/lib.rs b/primitives/traits/src/lib.rs index 6f28ada8e..ace2bc820 100644 --- a/primitives/traits/src/lib.rs +++ b/primitives/traits/src/lib.rs @@ -394,7 +394,7 @@ pub trait RegistrarHandler { fn register( who: AccountId, id: ParaId, - genesis_storage: Vec, + genesis_storage: &[ContainerChainGenesisDataItem], head_data: Option, ) -> DispatchResult; @@ -408,7 +408,7 @@ impl RegistrarHandler for () { fn register( _who: AccountId, _id: ParaId, - _genesis_storage: Vec, + _genesis_storage: &[ContainerChainGenesisDataItem], _head_data: Option, ) -> DispatchResult { Ok(()) diff --git a/solo-chains/runtime/starlight/src/lib.rs b/solo-chains/runtime/starlight/src/lib.rs index 4344d70cf..e390e3011 100644 --- a/solo-chains/runtime/starlight/src/lib.rs +++ b/solo-chains/runtime/starlight/src/lib.rs @@ -1625,7 +1625,7 @@ where fn register( who: AccountId, id: ParaId, - genesis_storage: Vec, + genesis_storage: &[ContainerChainGenesisDataItem], head_data: Option, ) -> DispatchResult { // Return early if head_data is not specified @@ -1637,10 +1637,9 @@ where // Check if the wasm code is present in storage let validation_code = match genesis_storage .into_iter() - .map(Into::into) - .find(|(key, _): &(Vec, Vec)| key == &StorageWellKnownKeys::CODE) + .find(|item| item.key == StorageWellKnownKeys::CODE) { - Some((_, code)) => ValidationCode(code), + Some(item) => ValidationCode(item.value.clone()), None => return Err(ContainerRegistrarError::::WasmCodeNecessary.into()), }; From e83f4a4c817cd829c039cb983531875273aa9f6b Mon Sep 17 00:00:00 2001 From: Agusrodri Date: Wed, 4 Sep 2024 05:06:52 -0700 Subject: [PATCH 51/51] fix mock --- pallets/registrar/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/registrar/src/mock.rs b/pallets/registrar/src/mock.rs index 0ae0ce7e6..51ca7fd37 100644 --- a/pallets/registrar/src/mock.rs +++ b/pallets/registrar/src/mock.rs @@ -241,7 +241,7 @@ impl RegistrarHandler for mock_data::Pallet { fn register( _who: AccountId, id: ParaId, - _genesis_storage: Vec, + _genesis_storage: &[tp_traits::ContainerChainGenesisDataItem], _head_data: Option, ) -> sp_runtime::DispatchResult { Mock::mutate(|m| {