diff --git a/pallets/services-payment/Cargo.toml b/pallets/services-payment/Cargo.toml index 0fd31ff08..d90a5175b 100644 --- a/pallets/services-payment/Cargo.toml +++ b/pallets/services-payment/Cargo.toml @@ -17,6 +17,7 @@ log = { workspace = true } parity-scale-codec = { workspace = true, features = [ "derive", "max-encoded-len" ] } scale-info = { workspace = true } serde = { workspace = true, optional = true, features = [ "derive" ] } +sp-io = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } tp-traits = { workspace = true } diff --git a/pallets/services-payment/src/benchmarks.rs b/pallets/services-payment/src/benchmarks.rs index 0b0cbf531..5655a4f10 100644 --- a/pallets/services-payment/src/benchmarks.rs +++ b/pallets/services-payment/src/benchmarks.rs @@ -18,14 +18,16 @@ //! Benchmarking use { - crate::{BalanceOf, BlockNumberFor, Call, Config, Pallet}, + crate::{BalanceOf, BlockNumberFor, Call, Config, Pallet, ProvideBlockProductionCost}, frame_benchmarking::{account, v2::*}, frame_support::{ assert_ok, traits::{Currency, Get}, }, frame_system::RawOrigin, + sp_runtime::Saturating, sp_std::prelude::*, + tp_traits::AuthorNotingHook, }; // Build genesis storage according to the mock runtime. @@ -57,9 +59,11 @@ mod benchmarks { #[benchmark] fn purchase_credits() { - let caller = create_funded_user::("caller", 1, 1000); let para_id = 1001u32.into(); - let credits = T::MaxCreditsStored::get(); + let payment: BalanceOf = T::ProvideBlockProductionCost::block_cost(¶_id) + .0 + .saturating_mul(1000u32.into()); + let caller = create_funded_user::("caller", 1, 1_000_000_000u32); // Before call: 0 credits assert_eq!( @@ -68,31 +72,24 @@ mod benchmarks { ); #[extrinsic_call] - Pallet::::purchase_credits( - RawOrigin::Signed(caller), - para_id, - credits, - Some(u32::MAX.into()), - ); + Pallet::::purchase_credits(RawOrigin::Signed(caller), para_id, payment); // verification code assert_eq!( - crate::BlockProductionCredits::::get(¶_id).unwrap_or_default(), - credits + ::total_balance(&crate::Pallet::::parachain_tank(para_id)), + payment ); } #[benchmark] fn set_credits() { - let caller = create_funded_user::("caller", 1, 1000); let para_id = 1001u32.into(); let credits = T::MaxCreditsStored::get(); - assert_ok!(Pallet::::purchase_credits( - RawOrigin::Signed(caller).into(), + assert_ok!(Pallet::::set_credits( + RawOrigin::Root.into(), para_id, credits, - Some(u32::MAX.into()), )); // Before call: 1000 credits @@ -125,5 +122,28 @@ mod benchmarks { assert!(crate::GivenFreeCredits::::get(¶_id).is_some()); } + #[benchmark] + fn on_container_author_noted() { + let para_id = 1001u32; + let block_cost = T::ProvideBlockProductionCost::block_cost(¶_id.into()).0; + let max_credit_stored = T::MaxCreditsStored::get(); + let balance_to_purchase = block_cost.saturating_mul(max_credit_stored.into()); + let caller = create_funded_user::("caller", 1, 1_000_000_000u32); + let existential_deposit = ::minimum_balance(); + assert_ok!(Pallet::::purchase_credits( + RawOrigin::Signed(caller.clone()).into(), + para_id.into(), + balance_to_purchase + existential_deposit + )); + #[block] + { + as AuthorNotingHook>::on_container_author_noted( + &caller, + 0, + para_id.into(), + ); + } + } + impl_benchmark_test_suite!(Pallet, crate::benchmarks::new_test_ext(), crate::mock::Test); } diff --git a/pallets/services-payment/src/lib.rs b/pallets/services-payment/src/lib.rs index 03e3349ab..6fa73ade4 100644 --- a/pallets/services-payment/src/lib.rs +++ b/pallets/services-payment/src/lib.rs @@ -41,10 +41,12 @@ use { frame_support::{ pallet_prelude::*, sp_runtime::{traits::Zero, Saturating}, - traits::{tokens::ExistenceRequirement, Currency, WithdrawReasons}, + traits::{tokens::ExistenceRequirement, Currency, OnUnbalanced, WithdrawReasons}, }, frame_system::pallet_prelude::*, scale_info::prelude::vec::Vec, + sp_io::hashing::blake2_256, + sp_runtime::traits::TrailingZeroInput, tp_traits::{AuthorNotingHook, BlockNumber}, }; @@ -68,11 +70,12 @@ pub mod pallet { /// The overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Handler for fees - type OnChargeForBlockCredit: OnChargeForBlockCredit; + type OnChargeForBlock: OnUnbalanced>; /// Currency type for fee payment type Currency: Currency; /// Provider of a block cost which can adjust from block to block type ProvideBlockProductionCost: ProvideBlockProductionCost; + /// The maximum number of credits that can be accumulated type MaxCreditsStored: Get>; @@ -95,9 +98,7 @@ pub mod pallet { CreditsPurchased { para_id: ParaId, payer: T::AccountId, - fee: BalanceOf, - credits_purchased: BlockNumberFor, - credits_remaining: BlockNumberFor, + credit: BalanceOf, }, CreditBurned { para_id: ParaId, @@ -110,7 +111,7 @@ pub mod pallet { } #[pallet::storage] - #[pallet::getter(fn collator_commission)] + #[pallet::getter(fn free_block_production_credits)] pub type BlockProductionCredits = StorageMap<_, Blake2_128Concat, ParaId, BlockNumberFor, OptionQuery>; @@ -129,44 +130,21 @@ pub mod pallet { pub fn purchase_credits( origin: OriginFor, para_id: ParaId, - credits: BlockNumberFor, - max_price_per_credit: Option>, + credit: BalanceOf, ) -> DispatchResultWithPostInfo { let account = ensure_signed(origin)?; - - let existing_credits = - BlockProductionCredits::::get(para_id).unwrap_or(BlockNumberFor::::zero()); - let credits_purchasable = T::MaxCreditsStored::get().saturating_sub(existing_credits); - let actual_credits_purchased = credits.min(credits_purchasable); - - let updated_credits = existing_credits.saturating_add(actual_credits_purchased); - - // get the current per-credit cost of a block - let (block_cost, _weight) = T::ProvideBlockProductionCost::block_cost(¶_id); - if let Some(max_price_per_credit) = max_price_per_credit { - ensure!( - block_cost <= max_price_per_credit, - Error::::CreditPriceTooExpensive, - ); - } - - let total_fee = block_cost.saturating_mul(actual_credits_purchased.into()); - - T::OnChargeForBlockCredit::charge_credits( + let parachain_tank = Self::parachain_tank(para_id); + T::Currency::transfer( &account, - ¶_id, - actual_credits_purchased, - total_fee, + ¶chain_tank, + credit, + ExistenceRequirement::KeepAlive, )?; - BlockProductionCredits::::insert(para_id, updated_credits); - Self::deposit_event(Event::::CreditsPurchased { para_id, payer: account, - fee: total_fee, - credits_purchased: actual_credits_purchased, - credits_remaining: updated_credits, + credit: credit, }); Ok(().into()) @@ -217,7 +195,7 @@ pub mod pallet { impl Pallet { /// Burn a credit for the given para. Deducts one credit if possible, errors otherwise. - pub fn burn_credit_for_para(para_id: &ParaId) -> DispatchResultWithPostInfo { + pub fn burn_free_credit_for_para(para_id: &ParaId) -> DispatchResultWithPostInfo { let existing_credits = BlockProductionCredits::::get(para_id).unwrap_or(BlockNumberFor::::zero()); @@ -290,42 +268,12 @@ pub mod pallet { pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; +pub type CurrencyOf = ::Currency; +/// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type. +pub type NegativeImbalanceOf = + as Currency<::AccountId>>::NegativeImbalance; /// Handler for fee charging. This will be invoked when fees need to be deducted from the fee /// account for a given paraId. -pub trait OnChargeForBlockCredit { - fn charge_credits( - payer: &T::AccountId, - para_id: &ParaId, - credits: BlockNumberFor, - fee: BalanceOf, - ) -> Result<(), Error>; -} - -pub struct ChargeForBlockCredit(PhantomData); -impl OnChargeForBlockCredit for ChargeForBlockCredit { - fn charge_credits( - payer: &T::AccountId, - _para_id: &ParaId, - _credits: BlockNumberFor, - fee: BalanceOf, - ) -> Result<(), crate::Error> { - use frame_support::traits::tokens::imbalance::Imbalance; - - let result = T::Currency::withdraw( - payer, - fee, - WithdrawReasons::FEE, - ExistenceRequirement::AllowDeath, - ); - let imbalance = result.map_err(|_| crate::Error::InsufficientFundsToPurchaseCredits)?; - - if imbalance.peek() != fee { - panic!("withdrawn balance incorrect"); - } - - Ok(()) - } -} /// Returns the cost for a given block credit at the current time. This can be a complex operation, /// so it also returns the weight it consumes. (TODO: or just rely on benchmarking) @@ -342,16 +290,54 @@ impl AuthorNotingHook for Pallet { _block_number: BlockNumber, para_id: ParaId, ) -> Weight { - let total_weight = T::DbWeight::get().reads_writes(1, 1); + if Pallet::::burn_free_credit_for_para(¶_id).is_err() { + let (amount_to_charge, _weight) = T::ProvideBlockProductionCost::block_cost(¶_id); + match T::Currency::withdraw( + &Self::parachain_tank(para_id), + amount_to_charge, + WithdrawReasons::FEE, + ExistenceRequirement::KeepAlive, + ) { + Err(e) => log::warn!( + "Failed to withdraw credits for container chain {}: {:?}", + u32::from(para_id), + e + ), + Ok(imbalance) => { + T::OnChargeForBlock::on_unbalanced(imbalance); + } + } + } - if let Err(e) = Pallet::::burn_credit_for_para(¶_id) { - log::warn!( - "Failed to burn credits for container chain {}: {:?}", - u32::from(para_id), - e - ); + T::WeightInfo::on_container_author_noted() + } +} + +impl Pallet { + /// Derive a derivative account ID from the paraId. + pub fn parachain_tank(para_id: ParaId) -> T::AccountId { + let entropy = (b"modlpy/serpayment", para_id).using_encoded(blake2_256); + Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref())) + .expect("infinite length input; no invalid inputs for type; qed") + } + + /// Hook to perform things on deregister + pub fn para_deregistered(para_id: ParaId) { + // Drain the para-id account from tokens + let parachain_tank_balance = T::Currency::total_balance(&Self::parachain_tank(para_id)); + if !parachain_tank_balance.is_zero() { + if let Ok(imbalance) = T::Currency::withdraw( + &Self::parachain_tank(para_id), + parachain_tank_balance, + WithdrawReasons::FEE, + ExistenceRequirement::AllowDeath, + ) { + // Burn for now, we might be able to pass something to do with this + drop(imbalance); + } } - total_weight + // Clean credits + BlockProductionCredits::::remove(para_id); } } diff --git a/pallets/services-payment/src/mock.rs b/pallets/services-payment/src/mock.rs index 329726eba..07a15aec8 100644 --- a/pallets/services-payment/src/mock.rs +++ b/pallets/services-payment/src/mock.rs @@ -29,7 +29,7 @@ //! to that containerChain, by simply assigning the slot position. use { - crate::{self as pallet_services_payment, ChargeForBlockCredit, ProvideBlockProductionCost}, + crate::{self as pallet_services_payment, ProvideBlockProductionCost}, cumulus_primitives_core::ParaId, frame_support::{ pallet_prelude::*, @@ -109,7 +109,7 @@ parameter_types! { impl pallet_services_payment::Config for Test { type RuntimeEvent = RuntimeEvent; - type OnChargeForBlockCredit = ChargeForBlockCredit; + type OnChargeForBlock = (); type Currency = Balances; type ProvideBlockProductionCost = BlockProductionCost; type MaxCreditsStored = MaxCreditsStored; @@ -164,13 +164,3 @@ pub(crate) fn events() -> Vec> { }) .collect::>() } - -// This function basically just builds a genesis storage key/value store according to -// our desired mockup. -#[cfg(feature = "runtime-benchmarks")] -pub fn new_test_ext() -> sp_io::TestExternalities { - frame_system::GenesisConfig::::default() - .build_storage() - .unwrap() - .into() -} diff --git a/pallets/services-payment/src/tests.rs b/pallets/services-payment/src/tests.rs index 4167e3bf8..0b2ec9e41 100644 --- a/pallets/services-payment/src/tests.rs +++ b/pallets/services-payment/src/tests.rs @@ -31,8 +31,9 @@ use { crate::{mock::*, pallet as pallet_services_payment, BlockProductionCredits}, cumulus_primitives_core::ParaId, - frame_support::{assert_err, assert_ok}, + frame_support::{assert_err, assert_ok, traits::fungible::Inspect}, sp_runtime::DispatchError, + tp_traits::AuthorNotingHook, }; const ALICE: u64 = 1; @@ -48,8 +49,7 @@ fn purchase_credits_works() { assert_ok!(PaymentServices::purchase_credits( RuntimeOrigin::signed(ALICE), 1.into(), - MaxCreditsStored::get(), - None, + 100u128, ),); assert_eq!( @@ -57,142 +57,34 @@ fn purchase_credits_works() { vec![pallet_services_payment::Event::CreditsPurchased { para_id: 1.into(), payer: ALICE, - fee: 500, - credits_purchased: MaxCreditsStored::get(), - credits_remaining: MaxCreditsStored::get(), + credit: 100u128 }] ); - }); -} - -#[test] -fn purchase_credits_purchases_zero_when_max_already_stored() { - ExtBuilder::default() - .with_balances([(ALICE, 1_000)].into()) - .build() - .execute_with(|| { - System::set_block_number(1); - - let para_id = 1.into(); - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - para_id, - MaxCreditsStored::get(), - None, - ),); - assert_eq!( - >::get(para_id), - Some(MaxCreditsStored::get()) - ); - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - para_id, - 1, - None - ),); - assert_eq!( - >::get(para_id), - Some(MaxCreditsStored::get()) - ); - - // should have two purchase events (one with MaxCreditsStored, then one with zero) - assert_eq!( - events(), - vec![ - pallet_services_payment::Event::CreditsPurchased { - para_id, - payer: ALICE, - fee: 500, - credits_purchased: MaxCreditsStored::get(), - credits_remaining: MaxCreditsStored::get(), - }, - pallet_services_payment::Event::CreditsPurchased { - para_id, - payer: ALICE, - fee: 0, - credits_purchased: 0, - credits_remaining: MaxCreditsStored::get(), - }, - ] + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 100u128 ); }); } - #[test] -fn purchase_credits_purchases_max_possible_when_cant_purchase_all_requested() { +fn purchase_credits_fails_with_insufficient_balance() { ExtBuilder::default() .with_balances([(ALICE, 1_000)].into()) .build() .execute_with(|| { - System::set_block_number(1); - - let para_id = 1.into(); - let amount_purchased = 1u64; - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - para_id, - amount_purchased, - None, - )); - - let purchasable = MaxCreditsStored::get() - amount_purchased; - assert_eq!(purchasable, 4); - - assert_eq!( - >::get(para_id), - Some(amount_purchased) - ); - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - para_id, - MaxCreditsStored::get(), - None, - ),); - assert_eq!( - >::get(para_id), - Some(MaxCreditsStored::get()) - ); - - // should have two purchase events (one with amount_purchased, then with purchasable) - assert_eq!( - events(), - vec![ - pallet_services_payment::Event::CreditsPurchased { - para_id, - payer: ALICE, - fee: 100, - credits_purchased: amount_purchased, - credits_remaining: amount_purchased, - }, - pallet_services_payment::Event::CreditsPurchased { - para_id, - payer: ALICE, - fee: 400, - credits_purchased: purchasable, - credits_remaining: MaxCreditsStored::get(), - }, - ] + // cannot purchase if death + assert_err!( + PaymentServices::purchase_credits(RuntimeOrigin::signed(ALICE), 1.into(), 1000u128), + sp_runtime::TokenError::NotExpendable, ); }); } -#[test] -fn purchase_credits_fails_with_insufficient_balance() { - ExtBuilder::default().build().execute_with(|| { - // really what we're testing is that purchase_credits fails when OnChargeForBlockCredits does - assert_err!( - PaymentServices::purchase_credits(RuntimeOrigin::signed(ALICE), 1.into(), 1, None), - pallet_services_payment::Error::::InsufficientFundsToPurchaseCredits, - ); - }); -} - #[test] fn burn_credit_fails_with_no_credits() { ExtBuilder::default().build().execute_with(|| { assert_err!( - PaymentServices::burn_credit_for_para(&1u32.into()), + PaymentServices::burn_free_credit_for_para(&1u32.into()), pallet_services_payment::Error::::InsufficientCredits, ); }); @@ -205,21 +97,20 @@ fn burn_credit_works() { .build() .execute_with(|| { let para_id = 1.into(); - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), + assert_ok!(PaymentServices::set_credits( + RuntimeOrigin::root(), para_id, 1u64, - None, ),); // should succeed and burn one assert_eq!(>::get(para_id), Some(1u64)); - assert_ok!(PaymentServices::burn_credit_for_para(¶_id)); + assert_ok!(PaymentServices::burn_free_credit_for_para(¶_id)); assert_eq!(>::get(para_id), Some(0u64)); // now should fail assert_err!( - PaymentServices::burn_credit_for_para(¶_id), + PaymentServices::burn_free_credit_for_para(¶_id), pallet_services_payment::Error::::InsufficientCredits, ); }); @@ -232,129 +123,146 @@ fn burn_credit_fails_for_wrong_para() { .build() .execute_with(|| { let para_id = 1.into(); - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), + assert_ok!(PaymentServices::set_credits( + RuntimeOrigin::root(), para_id, 1u64, - None, ),); // fails for wrong para let wrong_para_id = 2.into(); assert_err!( - PaymentServices::burn_credit_for_para(&wrong_para_id), + PaymentServices::burn_free_credit_for_para(&wrong_para_id), pallet_services_payment::Error::::InsufficientCredits, ); }); } #[test] -fn buy_credits_no_limit_works() { +fn set_credits_bad_origin() { ExtBuilder::default() .with_balances([(ALICE, 1_000)].into()) .build() .execute_with(|| { - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - 1.into(), - 1u64, - None, - )); + assert_err!( + PaymentServices::set_credits(RuntimeOrigin::signed(ALICE), 1.into(), 1u64,), + DispatchError::BadOrigin + ) }); } #[test] -fn buy_credits_too_expensive_fails() { +fn set_credits_above_max_works() { ExtBuilder::default() .with_balances([(ALICE, 1_000)].into()) .build() .execute_with(|| { - assert_err!( - PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), - 1.into(), - 1u64, - Some(FIXED_BLOCK_PRODUCTION_COST - 1), - ), - pallet_services_payment::Error::::CreditPriceTooExpensive, + assert_ok!(PaymentServices::set_credits( + RuntimeOrigin::root(), + 1.into(), + MaxCreditsStored::get() * 2, + )); + + assert_eq!( + >::get(ParaId::from(1)), + Some(MaxCreditsStored::get() * 2) ); }); } #[test] -fn buy_credits_exact_price_limit_works() { +fn set_credits_to_zero_kills_storage() { ExtBuilder::default() .with_balances([(ALICE, 1_000)].into()) .build() .execute_with(|| { - assert_ok!(PaymentServices::purchase_credits( - RuntimeOrigin::signed(ALICE), + assert_ok!(PaymentServices::set_credits( + RuntimeOrigin::root(), 1.into(), - 1u64, - Some(FIXED_BLOCK_PRODUCTION_COST), - ),); + 0u64, + )); + + assert_eq!(>::get(ParaId::from(1)), None,); }); } #[test] -fn buy_credits_limit_exceeds_price_works() { +fn credits_should_be_substracted_from_tank_if_no_free_credits() { ExtBuilder::default() - .with_balances([(ALICE, 1_000)].into()) + .with_balances([(ALICE, 2_000)].into()) .build() .execute_with(|| { + // this should give 10 block credit assert_ok!(PaymentServices::purchase_credits( RuntimeOrigin::signed(ALICE), 1.into(), - 1u64, - Some(FIXED_BLOCK_PRODUCTION_COST + 1), - ),); - }); -} + 1000u128, + )); -#[test] -fn set_credits_bad_origin() { - ExtBuilder::default() - .with_balances([(ALICE, 1_000)].into()) - .build() - .execute_with(|| { - assert_err!( - PaymentServices::set_credits(RuntimeOrigin::signed(ALICE), 1.into(), 1u64,), - DispatchError::BadOrigin - ) + assert_eq!( + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 1000u128 + ); + + PaymentServices::on_container_author_noted(&1, 1, 1.into()); + + assert_eq!( + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 900u128 + ); }); } #[test] -fn set_credits_above_max_works() { +fn credits_should_not_be_substracted_from_tank_if_it_involves_death() { ExtBuilder::default() - .with_balances([(ALICE, 1_000)].into()) + .with_balances([(ALICE, 2_000)].into()) .build() .execute_with(|| { - assert_ok!(PaymentServices::set_credits( - RuntimeOrigin::root(), + // this should give 10 block credit + assert_ok!(PaymentServices::purchase_credits( + RuntimeOrigin::signed(ALICE), 1.into(), - MaxCreditsStored::get() * 2, + 100u128, )); assert_eq!( - >::get(ParaId::from(1)), - Some(MaxCreditsStored::get() * 2) + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 100u128 + ); + + PaymentServices::on_container_author_noted(&1, 1, 1.into()); + + assert_eq!( + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 100u128 ); }); } #[test] -fn set_credits_to_zero_kills_storage() { +fn not_having_enough_tokens_in_tank_should_not_error() { ExtBuilder::default() - .with_balances([(ALICE, 1_000)].into()) + .with_balances([(ALICE, 2_000)].into()) .build() .execute_with(|| { - assert_ok!(PaymentServices::set_credits( - RuntimeOrigin::root(), + // this should give 10 block credit + assert_ok!(PaymentServices::purchase_credits( + RuntimeOrigin::signed(ALICE), 1.into(), - 0u64, + 1u128, )); - assert_eq!(>::get(ParaId::from(1)), None,); + assert_eq!( + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 1u128 + ); + + PaymentServices::on_container_author_noted(&1, 1, 1.into()); + + assert_eq!( + Balances::balance(&crate::Pallet::::parachain_tank(1.into())), + 1u128 + ); }); } diff --git a/pallets/services-payment/src/weights.rs b/pallets/services-payment/src/weights.rs index 9323b9822..d28639959 100644 --- a/pallets/services-payment/src/weights.rs +++ b/pallets/services-payment/src/weights.rs @@ -55,6 +55,7 @@ pub trait WeightInfo { fn purchase_credits() -> Weight; fn set_credits() -> Weight; fn set_given_free_credits() -> Weight; + fn on_container_author_noted() -> Weight; } /// Weights for pallet_services_payment using the Substrate node and recommended hardware. @@ -93,6 +94,20 @@ impl WeightInfo for SubstrateWeight { Weight::from_parts(2_691_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + /// Storage: `ServicesPayment::BlockProductionCredits` (r:1 w:0) + /// Proof: `ServicesPayment::BlockProductionCredits` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn on_container_author_noted() -> Weight { + // Proof Size summary in bytes: + // Measured: `224` + // Estimated: `3593` + // Minimum execution time: 19_043_000 picoseconds. + Weight::from_parts(19_499_000, 3593) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests @@ -130,4 +145,17 @@ impl WeightInfo for () { Weight::from_parts(2_691_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `ServicesPayment::BlockProductionCredits` (r:1 w:0) + /// Proof: `ServicesPayment::BlockProductionCredits` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn on_container_author_noted() -> Weight { + // Proof Size summary in bytes: + // Measured: `224` + // Estimated: `3593` + // Minimum execution time: 19_043_000 picoseconds. + Weight::from_parts(19_499_000, 3593) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } } diff --git a/runtime/dancebox/src/lib.rs b/runtime/dancebox/src/lib.rs index b2484fa4b..635cf4c70 100644 --- a/runtime/dancebox/src/lib.rs +++ b/runtime/dancebox/src/lib.rs @@ -48,7 +48,7 @@ use { pallet_prelude::DispatchResult, parameter_types, traits::{ - fungible::{Balanced, Credit}, + fungible::{Balanced, Credit, Inspect}, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, InsideBoth, InstanceFilter, OffchainWorker, OnFinalize, OnIdle, OnInitialize, OnRuntimeUpgrade, ValidatorRegistration, @@ -73,7 +73,7 @@ use { pallet_pooled_staking::traits::{IsCandidateEligible, Timer}, pallet_registrar::RegistrarHooks, pallet_registrar_runtime_api::ContainerChainGenesisData, - pallet_services_payment::{ChargeForBlockCredit, ProvideBlockProductionCost}, + pallet_services_payment::ProvideBlockProductionCost, pallet_session::{SessionManager, ShouldEndSession}, pallet_transaction_payment::{ConstFeeMultiplier, CurrencyAdapter, Multiplier}, polkadot_runtime_common::BlockHashCount, @@ -240,7 +240,6 @@ pub const DAYS: BlockNumber = HOURS * 24; pub const UNIT: Balance = 1_000_000_000_000; pub const MILLIUNIT: Balance = 1_000_000_000; pub const MICROUNIT: Balance = 1_000_000; - /// The existential deposit. Set to 1/10 of the Connected Relay Chain. pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; @@ -719,10 +718,22 @@ impl RemoveParaIdsWithNoCredits for RemoveParaIdsWithNoCreditsImpl { let credits_for_2_sessions = 2 * blocks_per_session; para_ids.retain(|para_id| { // Check if the container chain has enough credits for producing blocks for 2 sessions - let credits = pallet_services_payment::BlockProductionCredits::::get(para_id) + let free_credits = pallet_services_payment::BlockProductionCredits::::get(para_id) .unwrap_or_default(); - credits >= credits_for_2_sessions + // Return if we can survive with free credits + if free_credits >= credits_for_2_sessions { + return true + } + + let remaining_credits = credits_for_2_sessions.saturating_sub(free_credits); + + let (block_production_costs, _) = ::ProvideBlockProductionCost::block_cost(para_id); + // let's check if we can withdraw + let remaining_to_pay = (remaining_credits as u128).saturating_mul(block_production_costs); + // This should take into account whether we tank goes below ED + // The true refers to keepAlive + Balances::can_withdraw(&pallet_services_payment::Pallet::::parachain_tank(*para_id), remaining_to_pay).into_result(true).is_ok() }); } @@ -781,7 +792,7 @@ parameter_types! { impl pallet_services_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; /// Handler for fees - type OnChargeForBlockCredit = ChargeForBlockCredit; + type OnChargeForBlock = (); /// Currency type for fee payment type Currency = Balances; /// Provider of a block cost which can adjust from block to block @@ -873,17 +884,11 @@ impl RegistrarHooks for DanceboxRegistrarHooks { e, ); } - // Remove all credits from pallet_services_payment - if let Err(e) = ServicesPayment::set_credits(RuntimeOrigin::root(), para_id, 0) { - log::warn!( - "Failed to set_credits to 0 after para id {} deregistered: {:?}", - u32::from(para_id), - e, - ); - } // Remove bootnodes from pallet_data_preservers DataPreservers::para_deregistered(para_id); + ServicesPayment::para_deregistered(para_id); + Weight::default() } diff --git a/runtime/dancebox/tests/common/mod.rs b/runtime/dancebox/tests/common/mod.rs index ce7379d9e..8364a2546 100644 --- a/runtime/dancebox/tests/common/mod.rs +++ b/runtime/dancebox/tests/common/mod.rs @@ -17,7 +17,9 @@ use { cumulus_primitives_core::{ParaId, PersistedValidationData}, cumulus_primitives_parachain_inherent::ParachainInherentData, - dancebox_runtime::{AuthorInherent, MaxBootNodeUrlLen, MaxBootNodes, MaxLengthTokenSymbol}, + dancebox_runtime::{ + AuthorInherent, BlockProductionCost, MaxBootNodeUrlLen, MaxBootNodes, MaxLengthTokenSymbol, + }, frame_support::{ assert_ok, traits::{OnFinalize, OnInitialize}, @@ -25,6 +27,7 @@ use { nimbus_primitives::{NimbusId, NIMBUS_ENGINE_ID}, pallet_collator_assignment_runtime_api::runtime_decl_for_collator_assignment_api::CollatorAssignmentApi, pallet_registrar_runtime_api::ContainerChainGenesisData, + pallet_services_payment::ProvideBlockProductionCost, parity_scale_codec::Encode, polkadot_parachain_primitives::primitives::HeadData, sp_consensus_aura::AURA_ENGINE_ID, @@ -514,6 +517,11 @@ pub fn current_author() -> AccountId { .clone() } +pub fn block_credits_to_required_balance(number_of_blocks: u32, para_id: ParaId) -> Balance { + let block_cost = BlockProductionCost::block_cost(¶_id).0; + (number_of_blocks as u128).saturating_mul(block_cost) +} + pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const CHARLIE: [u8; 32] = [6u8; 32]; diff --git a/runtime/dancebox/tests/integration_test.rs b/runtime/dancebox/tests/integration_test.rs index cb773dff6..970468e5d 100644 --- a/runtime/dancebox/tests/integration_test.rs +++ b/runtime/dancebox/tests/integration_test.rs @@ -24,7 +24,7 @@ use { CollatorSelectionInvulnerablesValue, MigrateBootNodes, MigrateConfigurationParathreads, MigrateInvulnerables, MigrateServicesPaymentAddCredits, }, - BlockProductionCost, RewardsCollatorCommission, + RewardsCollatorCommission, }, dp_core::well_known_keys, frame_support::{assert_noop, assert_ok, BoundedVec}, @@ -41,7 +41,6 @@ use { pallet_registrar_runtime_api::{ runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, }, - pallet_services_payment::ProvideBlockProductionCost, parity_scale_codec::Encode, sp_consensus_aura::AURA_ENGINE_ID, sp_core::Get, @@ -558,8 +557,7 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1001.into()) )); assert_ok!(Registrar::register( origin_of(ALICE.into()), @@ -578,8 +576,7 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1002.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1002.into()) )); // Assignment should happen after 2 sessions @@ -653,8 +650,7 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1001.into()) )); // Assignment should happen after 2 sessions @@ -783,11 +779,10 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); // Purchase 1 credit less that what is needed let credits_1001 = dancebox_runtime::Period::get() * 2 - 1; - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - credits_1001, - None, + credits_1001 )); // Assignment should happen after 2 sessions @@ -800,11 +795,10 @@ fn test_paras_registered_but_not_enough_credits() { assert_eq!(assignment.container_chains.get(&1001u32.into()), None); // Now purchase the missing block credit - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - 1, - None, + credits_1001 + 1 )); run_to_session(4u32); @@ -865,11 +859,10 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); // Purchase only enough credits for 1 session let credits_1001 = dancebox_runtime::Period::get() * 2; - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - credits_1001, - None, + credits_1001 )); // Assignment should happen after 2 sessions @@ -4635,23 +4628,25 @@ fn test_can_buy_credits_before_registering_para() { // Try to buy the maximum amount of credits let balance_before = System::account(AccountId::from(ALICE)).data.free; + assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - u32::MAX, - None, + block_credits_to_required_balance(u32::MAX, 1001.into()) )); let balance_after = System::account(AccountId::from(ALICE)).data.free; - // But only up to MaxCreditsStored have actually been purchased - let credits = pallet_services_payment::BlockProductionCredits::::get( - &ParaId::from(1001), - ) - .unwrap_or_default(); - assert_eq!(credits, dancebox_runtime::MaxCreditsStored::get()); + // Now parachain tank should have this amount + let balance_tank = System::account(ServicesPayment::parachain_tank(1001.into())) + .data + .free; + + assert_eq!( + balance_tank, + block_credits_to_required_balance(u32::MAX, 1001.into()) + ); - let expected_cost = BlockProductionCost::::block_cost(&ParaId::from(1001)).0 - * u128::from(dancebox_runtime::MaxCreditsStored::get()); + let expected_cost = block_credits_to_required_balance(u32::MAX, 1001.into()); assert_eq!(balance_before - balance_after, expected_cost); }); } @@ -4714,19 +4709,30 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - dancebox_runtime::MaxCreditsStored::get() - 1, - None, + block_credits_to_required_balance( + dancebox_runtime::MaxCreditsStored::get() - 1, + 1001.into() + ) )); let balance_after = System::account(AccountId::from(ALICE)).data.free; - let credits = pallet_services_payment::BlockProductionCredits::::get( - &ParaId::from(1001), - ) - .unwrap_or_default(); - assert_eq!(credits, dancebox_runtime::MaxCreditsStored::get() - 1); + // Now parachain tank should have this amount + let balance_tank = System::account(ServicesPayment::parachain_tank(1001.into())) + .data + .free; - let expected_cost = BlockProductionCost::::block_cost(&ParaId::from(1001)).0 - * u128::from(dancebox_runtime::MaxCreditsStored::get() - 1); + assert_eq!( + balance_tank, + block_credits_to_required_balance( + dancebox_runtime::MaxCreditsStored::get() - 1, + 1001.into() + ) + ); + + let expected_cost = block_credits_to_required_balance( + dancebox_runtime::MaxCreditsStored::get() - 1, + 1001.into(), + ); assert_eq!(balance_before - balance_after, expected_cost); // Now register para @@ -4745,7 +4751,7 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { 1001.into() )); - // We received 1 free credit, because we cannot have more than MaxCreditsStored + // We received aññ free credits, because we cannot have more than MaxCreditsStored let credits = pallet_services_payment::BlockProductionCredits::::get( &ParaId::from(1001), ) @@ -5035,3 +5041,243 @@ fn test_register_parathread() { ); }); } + +#[test] +fn test_ed_plus_two_sessions_purchase_works() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Need to reset credits to 0 because now parachains are given free credits on register + assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); + let credits_1001 = + block_credits_to_required_balance(dancebox_runtime::Period::get() * 2, 1001.into()) + + dancebox_runtime::EXISTENTIAL_DEPOSIT; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!( + assignment.container_chains[&1001u32.into()], + vec![CHARLIE.into(), DAVE.into()] + ); + + // Simulate block inclusion from container chain 1001 + let mut sproof: ParaHeaderSproofBuilder = ParaHeaderSproofBuilder::default(); + let slot: u64 = 5; + let mut s = ParaHeaderSproofBuilderItem::default(); + s.para_id = 1001.into(); + s.author_id = HeaderAs::NonEncoded(sp_runtime::generic::Header:: { + parent_hash: Default::default(), + number: 1, + state_root: Default::default(), + extrinsics_root: Default::default(), + digest: sp_runtime::generic::Digest { + logs: vec![DigestItem::PreRuntime(AURA_ENGINE_ID, slot.encode())], + }, + }); + sproof.items.push(s); + set_author_noting_inherent_data(sproof); + + run_block(); + + // After this it should not be assigned anymore, since credits are not payable + run_to_session(4u32); + // Nobody should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); + }); +} + +#[test] +fn test_ed_plus_two_sessions_minus_1_purchase_fails() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Need to reset credits to 0 because now parachains are given free credits on register + assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); + let credits_1001 = + block_credits_to_required_balance(dancebox_runtime::Period::get() * 2, 1001.into()) + + dancebox_runtime::EXISTENTIAL_DEPOSIT + - 1; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should not be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); + }); +} + +#[test] +fn test_credits_with_purchase_can_be_combined() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Set 1 session of free credits and purchase 1 session of credits + assert_ok!(ServicesPayment::set_credits( + root_origin(), + 1001.into(), + dancebox_runtime::Period::get() + )); + let credits_1001 = + block_credits_to_required_balance(dancebox_runtime::Period::get(), 1001.into()) + + dancebox_runtime::EXISTENTIAL_DEPOSIT; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!( + assignment.container_chains[&1001u32.into()], + vec![CHARLIE.into(), DAVE.into()] + ); + }); +} diff --git a/runtime/flashbox/src/lib.rs b/runtime/flashbox/src/lib.rs index 0e4bdd564..6d2ece965 100644 --- a/runtime/flashbox/src/lib.rs +++ b/runtime/flashbox/src/lib.rs @@ -42,7 +42,7 @@ use { pallet_prelude::DispatchResult, parameter_types, traits::{ - fungible::{Balanced, Credit}, + fungible::{Balanced, Credit, Inspect}, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, InsideBoth, InstanceFilter, OffchainWorker, OnFinalize, OnIdle, OnInitialize, OnRuntimeUpgrade, @@ -65,7 +65,7 @@ use { pallet_invulnerables::InvulnerableRewardDistribution, pallet_registrar::RegistrarHooks, pallet_registrar_runtime_api::ContainerChainGenesisData, - pallet_services_payment::{ChargeForBlockCredit, ProvideBlockProductionCost}, + pallet_services_payment::ProvideBlockProductionCost, pallet_session::{SessionManager, ShouldEndSession}, pallet_transaction_payment::{ConstFeeMultiplier, CurrencyAdapter, Multiplier}, polkadot_runtime_common::BlockHashCount, @@ -579,10 +579,22 @@ impl RemoveParaIdsWithNoCredits for RemoveParaIdsWithNoCreditsImpl { let credits_for_2_sessions = 2 * blocks_per_session; para_ids.retain(|para_id| { // Check if the container chain has enough credits for producing blocks for 2 sessions - let credits = pallet_services_payment::BlockProductionCredits::::get(para_id) + let free_credits = pallet_services_payment::BlockProductionCredits::::get(para_id) .unwrap_or_default(); - credits >= credits_for_2_sessions + // Return if we can survive with free credits + if free_credits >= credits_for_2_sessions { + return true + } + + let remaining_credits = credits_for_2_sessions.saturating_sub(free_credits); + + let (block_production_costs, _) = ::ProvideBlockProductionCost::block_cost(para_id); + // let's check if we can withdraw + let remaining_to_pay = (remaining_credits as u128).saturating_mul(block_production_costs); + // This should take into account whether we tank goes below ED + // The true refers to keepAlive + Balances::can_withdraw(&pallet_services_payment::Pallet::::parachain_tank(*para_id), remaining_to_pay).into_result(true).is_ok() }); } @@ -648,7 +660,7 @@ parameter_types! { impl pallet_services_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; /// Handler for fees - type OnChargeForBlockCredit = ChargeForBlockCredit; + type OnChargeForBlock = (); /// Currency type for fee payment type Currency = Balances; /// Provider of a block cost which can adjust from block to block @@ -740,17 +752,11 @@ impl RegistrarHooks for FlashboxRegistrarHooks { e, ); } - // Remove all credits from pallet_services_payment - if let Err(e) = ServicesPayment::set_credits(RuntimeOrigin::root(), para_id, 0) { - log::warn!( - "Failed to set_credits to 0 after para id {} deregistered: {:?}", - u32::from(para_id), - e, - ); - } // Remove bootnodes from pallet_data_preservers DataPreservers::para_deregistered(para_id); + ServicesPayment::para_deregistered(para_id); + Weight::default() } diff --git a/runtime/flashbox/tests/common/mod.rs b/runtime/flashbox/tests/common/mod.rs index ff1db93ba..5f09066bc 100644 --- a/runtime/flashbox/tests/common/mod.rs +++ b/runtime/flashbox/tests/common/mod.rs @@ -17,7 +17,9 @@ use { cumulus_primitives_core::{ParaId, PersistedValidationData}, cumulus_primitives_parachain_inherent::ParachainInherentData, - flashbox_runtime::{AuthorInherent, MaxBootNodeUrlLen, MaxBootNodes, MaxLengthTokenSymbol}, + flashbox_runtime::{ + AuthorInherent, BlockProductionCost, MaxBootNodeUrlLen, MaxBootNodes, MaxLengthTokenSymbol, + }, frame_support::{ assert_ok, traits::{OnFinalize, OnInitialize}, @@ -25,6 +27,7 @@ use { nimbus_primitives::{NimbusId, NIMBUS_ENGINE_ID}, pallet_collator_assignment_runtime_api::runtime_decl_for_collator_assignment_api::CollatorAssignmentApi, pallet_registrar_runtime_api::ContainerChainGenesisData, + pallet_services_payment::ProvideBlockProductionCost, parity_scale_codec::Encode, polkadot_parachain_primitives::primitives::HeadData, sp_consensus_aura::AURA_ENGINE_ID, @@ -436,6 +439,11 @@ pub fn current_author() -> AccountId { .clone() } +pub fn block_credits_to_required_balance(number_of_blocks: u32, para_id: ParaId) -> Balance { + let block_cost = BlockProductionCost::block_cost(¶_id).0; + (number_of_blocks as u128).saturating_mul(block_cost) +} + pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const CHARLIE: [u8; 32] = [6u8; 32]; diff --git a/runtime/flashbox/tests/integration_test.rs b/runtime/flashbox/tests/integration_test.rs index bf47d003b..2309f5b3f 100644 --- a/runtime/flashbox/tests/integration_test.rs +++ b/runtime/flashbox/tests/integration_test.rs @@ -20,7 +20,6 @@ use { common::*, cumulus_primitives_core::ParaId, dp_core::well_known_keys, - flashbox_runtime::BlockProductionCost, frame_support::{assert_noop, assert_ok, BoundedVec}, nimbus_primitives::NIMBUS_KEY_ID, pallet_author_noting::ContainerChainBlockInfo, @@ -29,7 +28,6 @@ use { pallet_registrar_runtime_api::{ runtime_decl_for_registrar_api::RegistrarApi, ContainerChainGenesisData, }, - pallet_services_payment::ProvideBlockProductionCost, parity_scale_codec::Encode, sp_consensus_aura::AURA_ENGINE_ID, sp_core::Get, @@ -545,8 +543,7 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1001.into()) )); assert_ok!(Registrar::register( origin_of(ALICE.into()), @@ -565,8 +562,7 @@ fn test_authors_paras_inserted_a_posteriori() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1002.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1002.into()) )); // Assignment should happen after 2 sessions @@ -640,8 +636,7 @@ fn test_authors_paras_inserted_a_posteriori_with_collators_already_assigned() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - 100_000, - None, + block_credits_to_required_balance(1000, 1001.into()) )); // Assignment should happen after 2 sessions @@ -770,11 +765,10 @@ fn test_paras_registered_but_not_enough_credits() { assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); // Purchase 1 credit less that what is needed let credits_1001 = flashbox_runtime::Period::get() * 2 - 1; - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - credits_1001, - None, + credits_1001 )); // Assignment should happen after 2 sessions @@ -787,11 +781,10 @@ fn test_paras_registered_but_not_enough_credits() { assert_eq!(assignment.container_chains.get(&1001u32.into()), None); // Now purchase the missing block credit - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - 1, - None, + credits_1001 + 1 )); run_to_session(4u32); @@ -852,11 +845,10 @@ fn test_paras_registered_but_only_credits_for_1_session() { assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); // Purchase only enough credits for 1 session let credits_1001 = flashbox_runtime::Period::get() * 2; - assert_ok!(ServicesPayment::purchase_credits( - origin_of(ALICE.into()), + assert_ok!(ServicesPayment::set_credits( + root_origin(), 1001.into(), - credits_1001, - None, + credits_1001 )); // Assignment should happen after 2 sessions @@ -2504,20 +2496,21 @@ fn test_can_buy_credits_before_registering_para() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - u32::MAX, - None, + block_credits_to_required_balance(u32::MAX, 1001.into()) )); let balance_after = System::account(AccountId::from(ALICE)).data.free; - // But only up to MaxCreditsStored have actually been purchased - let credits = pallet_services_payment::BlockProductionCredits::::get( - &ParaId::from(1001), - ) - .unwrap_or_default(); - assert_eq!(credits, flashbox_runtime::MaxCreditsStored::get()); + // Now parachain tank should have this amount + let balance_tank = System::account(ServicesPayment::parachain_tank(1001.into())) + .data + .free; + + assert_eq!( + balance_tank, + block_credits_to_required_balance(u32::MAX, 1001.into()) + ); - let expected_cost = BlockProductionCost::::block_cost(&ParaId::from(1001)).0 - * u128::from(flashbox_runtime::MaxCreditsStored::get()); + let expected_cost = block_credits_to_required_balance(u32::MAX, 1001.into()); assert_eq!(balance_before - balance_after, expected_cost); }); } @@ -2580,19 +2573,30 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { assert_ok!(ServicesPayment::purchase_credits( origin_of(ALICE.into()), 1001.into(), - flashbox_runtime::MaxCreditsStored::get() - 1, - None, + block_credits_to_required_balance( + flashbox_runtime::MaxCreditsStored::get() - 1, + 1001.into() + ) )); let balance_after = System::account(AccountId::from(ALICE)).data.free; - let credits = pallet_services_payment::BlockProductionCredits::::get( - &ParaId::from(1001), - ) - .unwrap_or_default(); - assert_eq!(credits, flashbox_runtime::MaxCreditsStored::get() - 1); + // Now parachain tank should have this amount + let balance_tank = System::account(ServicesPayment::parachain_tank(1001.into())) + .data + .free; - let expected_cost = BlockProductionCost::::block_cost(&ParaId::from(1001)).0 - * u128::from(flashbox_runtime::MaxCreditsStored::get() - 1); + assert_eq!( + balance_tank, + block_credits_to_required_balance( + flashbox_runtime::MaxCreditsStored::get() - 1, + 1001.into() + ) + ); + + let expected_cost = block_credits_to_required_balance( + flashbox_runtime::MaxCreditsStored::get() - 1, + 1001.into(), + ); assert_eq!(balance_before - balance_after, expected_cost); // Now register para @@ -2611,7 +2615,7 @@ fn test_can_buy_credits_before_registering_para_and_receive_free_credits() { 1001.into() )); - // We received 1 free credit, because we cannot have more than MaxCreditsStored + // We received aññ free credits, because we cannot have more than MaxCreditsStored let credits = pallet_services_payment::BlockProductionCredits::::get( &ParaId::from(1001), ) @@ -2746,3 +2750,243 @@ fn test_register_parathread() { ); }); } + +#[test] +fn test_ed_plus_two_sessions_purchase_works() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Need to reset credits to 0 because now parachains are given free credits on register + assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); + let credits_1001 = + block_credits_to_required_balance(flashbox_runtime::Period::get() * 2, 1001.into()) + + flashbox_runtime::EXISTENTIAL_DEPOSIT; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!( + assignment.container_chains[&1001u32.into()], + vec![CHARLIE.into(), DAVE.into()] + ); + + // Simulate block inclusion from container chain 1001 + let mut sproof: ParaHeaderSproofBuilder = ParaHeaderSproofBuilder::default(); + let slot: u64 = 5; + let mut s = ParaHeaderSproofBuilderItem::default(); + s.para_id = 1001.into(); + s.author_id = HeaderAs::NonEncoded(sp_runtime::generic::Header:: { + parent_hash: Default::default(), + number: 1, + state_root: Default::default(), + extrinsics_root: Default::default(), + digest: sp_runtime::generic::Digest { + logs: vec![DigestItem::PreRuntime(AURA_ENGINE_ID, slot.encode())], + }, + }); + sproof.items.push(s); + set_author_noting_inherent_data(sproof); + + run_block(); + + // After this it should not be assigned anymore, since credits are not payable + run_to_session(4u32); + // Nobody should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); + }); +} + +#[test] +fn test_ed_plus_two_sessions_minus_1_purchase_fails() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Need to reset credits to 0 because now parachains are given free credits on register + assert_ok!(ServicesPayment::set_credits(root_origin(), 1001.into(), 0)); + let credits_1001 = + block_credits_to_required_balance(flashbox_runtime::Period::get() * 2, 1001.into()) + + flashbox_runtime::EXISTENTIAL_DEPOSIT + - 1; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should not be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!(assignment.container_chains.get(&1001u32.into()), None,); + }); +} + +#[test] +fn test_credits_with_purchase_can_be_combined() { + 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), + (AccountId::from(CHARLIE), 100_000 * UNIT), + (AccountId::from(DAVE), 100_000 * UNIT), + ]) + .with_collators(vec![ + (AccountId::from(ALICE), 210 * UNIT), + (AccountId::from(BOB), 100 * UNIT), + (AccountId::from(CHARLIE), 100 * UNIT), + (AccountId::from(DAVE), 100 * UNIT), + ]) + .with_config(default_config()) + .build() + .execute_with(|| { + run_to_block(2); + // Assert current slot gets updated + assert_eq!(current_slot(), 1u64); + assert!(current_author() == AccountId::from(BOB)); + + // Alice and Bob collate in our chain + let alice_id = get_aura_id_from_seed(&AccountId::from(ALICE).to_string()); + let bob_id = get_aura_id_from_seed(&AccountId::from(BOB).to_string()); + + assert_eq!(authorities(), vec![alice_id, bob_id]); + + assert_ok!(Registrar::register( + origin_of(ALICE.into()), + 1001.into(), + empty_genesis_data() + )); + assert_ok!(DataPreservers::set_boot_nodes( + origin_of(ALICE.into()), + 1001.into(), + dummy_boot_nodes() + )); + assert_ok!(Registrar::mark_valid_for_collating( + root_origin(), + 1001.into() + )); + // Set 1 session of free credits and purchase 1 session of credits + assert_ok!(ServicesPayment::set_credits( + root_origin(), + 1001.into(), + flashbox_runtime::Period::get() + )); + let credits_1001 = + block_credits_to_required_balance(flashbox_runtime::Period::get(), 1001.into()) + + flashbox_runtime::EXISTENTIAL_DEPOSIT; + + // Fill the tank + assert_ok!(ServicesPayment::purchase_credits( + origin_of(ALICE.into()), + 1001.into(), + credits_1001 + )); + + // Assignment should happen after 2 sessions + run_to_session(1u32); + let assignment = CollatorAssignment::collator_container_chain(); + assert!(assignment.container_chains.is_empty()); + run_to_session(2u32); + // Charlie and Dave should be assigned to para 1001 + let assignment = CollatorAssignment::collator_container_chain(); + assert_eq!( + assignment.container_chains[&1001u32.into()], + vec![CHARLIE.into(), DAVE.into()] + ); + }); +} diff --git a/test/suites/common-tanssi/services-payment/test_service_payment_removes_tank_money.ts b/test/suites/common-tanssi/services-payment/test_service_payment_removes_tank_money.ts new file mode 100644 index 000000000..3a1475d2e --- /dev/null +++ b/test/suites/common-tanssi/services-payment/test_service_payment_removes_tank_money.ts @@ -0,0 +1,58 @@ +import "@tanssi/api-augment"; +import { describeSuite, expect, beforeAll } from "@moonwall/cli"; +import { ApiPromise } from "@polkadot/api"; +import { KeyringPair } from "@moonwall/util"; +import { jumpSessions, fetchIssuance } from "util/block"; +import { paraIdTank } from "util/payment"; + +describeSuite({ + id: "CT0604", + title: "Services payment test suite", + foundationMethods: "dev", + testCases: ({ it, context }) => { + let polkadotJs: ApiPromise; + let alice: KeyringPair; + const blocksPerSession = 5n; + const paraId2001 = 2001n; + const costPerBlock = 1_000_000n; + let balanceTankBefore; + beforeAll(async () => { + polkadotJs = context.polkadotJs(); + alice = context.keyring.alice; + const tx2000OneSession = polkadotJs.tx.servicesPayment.setCredits(paraId2001, 0); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2000OneSession).signAsync(alice)]); + const existentialDeposit = await polkadotJs.consts.balances.existentialDeposit.toBigInt(); + // Now, buy some credits for container chain 2001 + const purchasedCredits = blocksPerSession * costPerBlock + existentialDeposit; + const tx = polkadotJs.tx.servicesPayment.purchaseCredits(paraId2001, purchasedCredits); + await context.createBlock([await tx.signAsync(alice)]); + balanceTankBefore = (await polkadotJs.query.system.account(paraIdTank(paraId2001))).data.free.toBigInt(); + expect(balanceTankBefore, `Tank should have been filled`).toBe(purchasedCredits); + }); + it({ + id: "E01", + title: "We deregister 2000, check the issuance drops", + test: async function () { + // We deregister the chain + const deregister2001 = polkadotJs.tx.sudo.sudo(polkadotJs.tx.registrar.deregister(paraId2001)); + await context.createBlock([await deregister2001.signAsync(alice)]); + // Check that after 2 sessions, tank is empty and chain is deregistered + await jumpSessions(context, 2); + const balanceTank = ( + await polkadotJs.query.system.account(paraIdTank(paraId2001)) + ).data.free.toBigInt(); + expect(balanceTank, `Tank should have been removed`).toBe(0n); + + const blockNumber = (await polkadotJs.rpc.chain.getHeader()).number.toNumber(); + const apiAtBlockBefore = await polkadotJs.at(await polkadotJs.rpc.chain.getBlockHash(blockNumber - 1)); + const supplyBefore = (await apiAtBlockBefore.query.balances.totalIssuance()).toBigInt(); + const supplyAfter = (await polkadotJs.query.balances.totalIssuance()).toBigInt(); + const blockIssuance = await fetchIssuance(await polkadotJs.query.system.events()); + const issuanceDiff = supplyAfter - supplyBefore; + expect(issuanceDiff, `Tank should have been removed`).toBe( + blockIssuance.amount.toBigInt() - balanceTankBefore + ); + }, + }); + }, +}); diff --git a/test/suites/common-tanssi/services-payment/test_services_pament_credit_buying_free_combined.ts b/test/suites/common-tanssi/services-payment/test_services_pament_credit_buying_free_combined.ts new file mode 100644 index 000000000..886e3bf53 --- /dev/null +++ b/test/suites/common-tanssi/services-payment/test_services_pament_credit_buying_free_combined.ts @@ -0,0 +1,90 @@ +import "@tanssi/api-augment"; +import { describeSuite, expect, beforeAll } from "@moonwall/cli"; +import { ApiPromise } from "@polkadot/api"; +import { KeyringPair } from "@moonwall/util"; +import { jumpSessions } from "util/block"; + +describeSuite({ + id: "CT0603", + title: "Services payment test suite", + foundationMethods: "dev", + testCases: ({ it, context }) => { + let polkadotJs: ApiPromise; + let alice: KeyringPair; + const blocksPerSession = 5n; + const paraId2000 = 2000n; + const paraId2001 = 2001n; + const costPerBlock = 1_000_000n; + beforeAll(async () => { + polkadotJs = context.polkadotJs(); + alice = context.keyring.alice; + }); + + it({ + id: "E01", + title: "Collators are unassigned when a container chain does not have enough credits", + test: async function () { + // Create blocks until authorNoting.blockNum does not increase anymore. + // Check that collatorAssignment does not have collators and num credits is less than 2 sessions. + + const tx2000free = polkadotJs.tx.servicesPayment.setCredits(paraId2000, 0n); + const tx2001free = polkadotJs.tx.servicesPayment.setCredits(paraId2001, 0n); + + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2000free).signAsync(alice)]); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2001free).signAsync(alice)]); + + // Check that after 2 sessions, container chain 2000 has collators and is producing blocks + await jumpSessions(context, 2); + + const collators = await polkadotJs.query.collatorAssignment.collatorContainerChain(); + expect( + collators.toJSON().containerChains[paraId2000], + `Container chain ${paraId2000} should have 0 collators` + ).toBeUndefined(); + }, + }); + it({ + id: "E02", + title: "Collators are not assigned when we buy 2 session + ED -1", + test: async function () { + const tx2000OneSession = polkadotJs.tx.servicesPayment.setCredits(paraId2000, blocksPerSession); + await context.createBlock([await polkadotJs.tx.sudo.sudo(tx2000OneSession).signAsync(alice)]); + const existentialDeposit = await polkadotJs.consts.balances.existentialDeposit.toBigInt(); + // Now, buy some credits for container chain 2000. we only buy ones session -1 + const purchasedCredits = blocksPerSession * costPerBlock + existentialDeposit - 1n; + // Check that after 2 sessions, container chain 2000 has not collators + const tx = polkadotJs.tx.servicesPayment.purchaseCredits(paraId2000, purchasedCredits); + await context.createBlock([await tx.signAsync(alice)]); + + // Check that after 2 sessions, container chain 2000 has 0 collators and is not producing blocks + await jumpSessions(context, 2); + + const collators = await polkadotJs.query.collatorAssignment.collatorContainerChain(); + expect( + collators.toJSON().containerChains[paraId2000], + `Container chain ${paraId2000} should have 0 collators` + ).toBeUndefined(); + }, + }); + it({ + id: "E03", + title: "Collators are assigned when we buy at least 2 session + ED", + test: async function () { + // Now, buy the remaining + const purchasedCredits = 1n; + // Purchase the remaining 1 + const tx = polkadotJs.tx.servicesPayment.purchaseCredits(paraId2000, purchasedCredits); + await context.createBlock([await tx.signAsync(alice)]); + + // Check that after 2 sessions, container chain 2000 has collators and is producing blocks + await jumpSessions(context, 2); + + const collators = await polkadotJs.query.collatorAssignment.collatorContainerChain(); + expect( + collators.toJSON().containerChains[paraId2000].length, + `Container chain ${paraId2000} has 0 collators` + ).toBeGreaterThan(0); + }, + }); + }, +}); diff --git a/test/suites/common-tanssi/services-payment/test_services_payment.ts b/test/suites/common-tanssi/services-payment/test_services_payment.ts index 6a1270c53..bd2170426 100644 --- a/test/suites/common-tanssi/services-payment/test_services_payment.ts +++ b/test/suites/common-tanssi/services-payment/test_services_payment.ts @@ -3,6 +3,7 @@ import { describeSuite, expect, beforeAll } from "@moonwall/cli"; import { ApiPromise } from "@polkadot/api"; import { generateKeyringPair, KeyringPair } from "@moonwall/util"; import { jumpSessions } from "util/block"; +import { paraIdTank } from "util/payment"; describeSuite({ id: "CT0601", @@ -192,18 +193,19 @@ describeSuite({ const balanceBefore = ( await polkadotJs.query.system.account(randomAccount.address) ).data.free.toBigInt(); - const credits1 = (await polkadotJs.query.servicesPayment.blockProductionCredits(paraId)).toJSON(); - const purchasedCredits = 100n * blocksPerSession; + const purchasedCredits = 1000n * blocksPerSession; - const tx = polkadotJs.tx.servicesPayment.purchaseCredits(paraId, purchasedCredits, null); + const requiredBalance = purchasedCredits * 1_000_000n; + const tx = polkadotJs.tx.servicesPayment.purchaseCredits(paraId, requiredBalance); await context.createBlock([await tx.signAsync(randomAccount)]); const balanceAfter = ( await polkadotJs.query.system.account(randomAccount.address) ).data.free.toBigInt(); expect(balanceAfter).toBeLessThan(balanceBefore); - const credits2 = (await polkadotJs.query.servicesPayment.blockProductionCredits(paraId)).toJSON(); - expect(BigInt(credits2)).toBe(BigInt(credits1) + purchasedCredits); + + const balanceTank = (await polkadotJs.query.system.account(paraIdTank(paraId))).data.free.toBigInt(); + expect(balanceTank).toBe(requiredBalance); // Check that after 2 sessions, container chain 2000 has collators and is producing blocks await jumpSessions(context, 2); @@ -213,20 +215,23 @@ describeSuite({ collators.toJSON().containerChains[paraId].length, `Container chain ${paraId} has 0 collators` ).toBeGreaterThan(0); + expect(balanceTank).toBe(requiredBalance); // Create a block, the block number should increase, and the number of credits should decrease - const credits3 = (await polkadotJs.query.servicesPayment.blockProductionCredits(paraId)).toJSON(); const containerBlockNum3 = await (await polkadotJs.query.authorNoting.latestAuthor(paraId)).toJSON() .blockNumber; await context.createBlock(); - const credits4 = (await polkadotJs.query.servicesPayment.blockProductionCredits(paraId)).toJSON(); + const containerBlockNum4 = await (await polkadotJs.query.authorNoting.latestAuthor(paraId)).toJSON() .blockNumber; expect(containerBlockNum3, "container chain 2000 did not create a block").toBeLessThan( containerBlockNum4 ); - expect(credits3, "container chain 2000 created a block without burning any credits").toBeGreaterThan( - credits4 + const balanceTankAfter = ( + await polkadotJs.query.system.account(paraIdTank(paraId)) + ).data.free.toBigInt(); + expect(balanceTank, "container chain 2000 created a block without burning any credits").toBeGreaterThan( + balanceTankAfter ); }, }); diff --git a/test/suites/dev-tanssi/weights/test_set_latest_author_data_weight.ts b/test/suites/dev-tanssi/weights/test_set_latest_author_data_weight.ts index ac8a12e5d..28bee03e3 100644 --- a/test/suites/dev-tanssi/weights/test_set_latest_author_data_weight.ts +++ b/test/suites/dev-tanssi/weights/test_set_latest_author_data_weight.ts @@ -12,8 +12,8 @@ describeSuite({ id: "E01", title: "Weight should be match expected", test: async function () { - const expectedRefTime = new BN(1_064_263_621); - const expectedProofSize = new BN(6_745); + const expectedRefTime = new BN(1_108_762_621); + const expectedProofSize = new BN(9_212); await context.createBlock(); diff --git a/test/suites/para/test_tanssi_containers.ts b/test/suites/para/test_tanssi_containers.ts index 7cf7a8823..7a79ce017 100644 --- a/test/suites/para/test_tanssi_containers.ts +++ b/test/suites/para/test_tanssi_containers.ts @@ -239,7 +239,10 @@ describeSuite({ const chainSpec2002 = JSON.parse(spec2002); const containerChainGenesisData = chainSpecToContainerChainGenesisData(paraApi, chainSpec2002); const tx1 = paraApi.tx.registrar.register(2002, containerChainGenesisData); - const tx2 = paraApi.tx.servicesPayment.purchaseCredits(2002, 100000, null); + const purchasedCredits = 100000n; + const requiredBalance = purchasedCredits * 1_000_000n; + + const tx2 = paraApi.tx.servicesPayment.purchaseCredits(2002, requiredBalance); const tx12 = paraApi.tx.utility.batchAll([tx1, tx2]); await signAndSendAndInclude(tx12, alice); const bootNodes = [ diff --git a/test/util/payment.ts b/test/util/payment.ts new file mode 100644 index 000000000..4cfc48cda --- /dev/null +++ b/test/util/payment.ts @@ -0,0 +1,13 @@ +import { bnToU8a, stringToU8a } from "@polkadot/util"; +import { blake2AsU8a } from "@polkadot/util-crypto"; + +// Tank account is blake2(b"modlpy/serpayment" + parahain ID) +export function paraIdTank(paraId: any): any { + const seedBytes = stringToU8a("modlpy/serpayment"); + const paraIdBytes = bnToU8a(paraId, { bitLength: 32 }); + const combinedBytes = new Uint8Array(seedBytes.length + paraIdBytes.length); + combinedBytes.set(seedBytes); + combinedBytes.set(paraIdBytes, seedBytes.length); + const para_tank = blake2AsU8a(combinedBytes, 256); + return para_tank; +} diff --git a/typescript-api/src/dancebox/interfaces/augment-api-events.ts b/typescript-api/src/dancebox/interfaces/augment-api-events.ts index 6a546f7ce..dd648dbb3 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-events.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-events.ts @@ -939,8 +939,8 @@ declare module "@polkadot/api-base/types/events" { >; CreditsPurchased: AugmentedEvent< ApiType, - [paraId: u32, payer: AccountId32, fee: u128, creditsPurchased: u32, creditsRemaining: u32], - { paraId: u32; payer: AccountId32; fee: u128; creditsPurchased: u32; creditsRemaining: u32 } + [paraId: u32, payer: AccountId32, credit: u128], + { paraId: u32; payer: AccountId32; credit: u128 } >; CreditsSet: AugmentedEvent; /** Generic event */ diff --git a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts index d70257e77..5766f5cc7 100644 --- a/typescript-api/src/dancebox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/dancebox/interfaces/augment-api-tx.ts @@ -1563,10 +1563,9 @@ declare module "@polkadot/api-base/types/submittable" { purchaseCredits: AugmentedSubmittable< ( paraId: u32 | AnyNumber | Uint8Array, - credits: u32 | AnyNumber | Uint8Array, - maxPricePerCredit: Option | null | Uint8Array | u128 | AnyNumber + credit: u128 | AnyNumber | Uint8Array ) => SubmittableExtrinsic, - [u32, u32, Option] + [u32, u128] >; /** See [`Pallet::set_credits`]. */ setCredits: AugmentedSubmittable< diff --git a/typescript-api/src/dancebox/interfaces/lookup.ts b/typescript-api/src/dancebox/interfaces/lookup.ts index 707ab642c..ad3b46a89 100644 --- a/typescript-api/src/dancebox/interfaces/lookup.ts +++ b/typescript-api/src/dancebox/interfaces/lookup.ts @@ -478,9 +478,7 @@ export default { CreditsPurchased: { paraId: "u32", payer: "AccountId32", - fee: "u128", - creditsPurchased: "u32", - creditsRemaining: "u32", + credit: "u128", }, CreditBurned: { paraId: "u32", @@ -2307,8 +2305,7 @@ export default { _enum: { purchase_credits: { paraId: "u32", - credits: "u32", - maxPricePerCredit: "Option", + credit: "u128", }, set_credits: { paraId: "u32", @@ -2320,7 +2317,7 @@ export default { }, }, }, - /** Lookup264: pallet_data_preservers::pallet::Call */ + /** Lookup263: pallet_data_preservers::pallet::Call */ PalletDataPreserversCall: { _enum: { set_boot_nodes: { @@ -2329,7 +2326,7 @@ export default { }, }, }, - /** Lookup268: pallet_invulnerables::pallet::Call */ + /** Lookup267: pallet_invulnerables::pallet::Call */ PalletInvulnerablesCall: { _enum: { set_invulnerables: { @@ -2346,7 +2343,7 @@ export default { }, }, }, - /** Lookup269: pallet_session::pallet::Call */ + /** Lookup268: pallet_session::pallet::Call */ PalletSessionCall: { _enum: { set_keys: { @@ -2359,19 +2356,19 @@ export default { purge_keys: "Null", }, }, - /** Lookup270: dancebox_runtime::SessionKeys */ + /** Lookup269: dancebox_runtime::SessionKeys */ DanceboxRuntimeSessionKeys: { nimbus: "NimbusPrimitivesNimbusCryptoPublic", }, - /** Lookup271: nimbus_primitives::nimbus_crypto::Public */ + /** Lookup270: nimbus_primitives::nimbus_crypto::Public */ NimbusPrimitivesNimbusCryptoPublic: "SpCoreSr25519Public", - /** Lookup272: sp_core::sr25519::Public */ + /** Lookup271: sp_core::sr25519::Public */ SpCoreSr25519Public: "[u8;32]", - /** Lookup273: pallet_author_inherent::pallet::Call */ + /** Lookup272: pallet_author_inherent::pallet::Call */ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"], }, - /** Lookup274: pallet_pooled_staking::pallet::Call */ + /** Lookup273: pallet_pooled_staking::pallet::Call */ PalletPooledStakingCall: { _enum: { rebalance_hold: { @@ -2405,16 +2402,16 @@ export default { }, }, }, - /** Lookup275: pallet_pooled_staking::pallet::AllTargetPool */ + /** Lookup274: pallet_pooled_staking::pallet::AllTargetPool */ PalletPooledStakingAllTargetPool: { _enum: ["Joining", "AutoCompounding", "ManualRewards", "Leaving"], }, - /** Lookup277: pallet_pooled_staking::pallet::PendingOperationQuery */ + /** Lookup276: pallet_pooled_staking::pallet::PendingOperationQuery */ PalletPooledStakingPendingOperationQuery: { delegator: "AccountId32", operation: "PalletPooledStakingPendingOperationKey", }, - /** Lookup278: pallet_pooled_staking::pallet::PendingOperationKey */ + /** Lookup277: pallet_pooled_staking::pallet::PendingOperationKey */ PalletPooledStakingPendingOperationKey: { _enum: { JoiningAutoCompounding: { @@ -2431,14 +2428,14 @@ export default { }, }, }, - /** Lookup279: pallet_pooled_staking::pallet::SharesOrStake */ + /** Lookup278: pallet_pooled_staking::pallet::SharesOrStake */ PalletPooledStakingSharesOrStake: { _enum: { Shares: "u128", Stake: "u128", }, }, - /** Lookup282: cumulus_pallet_xcmp_queue::pallet::Call */ + /** Lookup281: cumulus_pallet_xcmp_queue::pallet::Call */ CumulusPalletXcmpQueueCall: { _enum: { service_overweight: { @@ -2485,7 +2482,7 @@ export default { }, }, }, - /** Lookup283: cumulus_pallet_dmp_queue::pallet::Call */ + /** Lookup282: cumulus_pallet_dmp_queue::pallet::Call */ CumulusPalletDmpQueueCall: { _enum: { service_overweight: { @@ -2494,7 +2491,7 @@ export default { }, }, }, - /** Lookup284: pallet_xcm::pallet::Call */ + /** Lookup283: pallet_xcm::pallet::Call */ PalletXcmCall: { _enum: { send: { @@ -2549,7 +2546,7 @@ export default { }, }, }, - /** Lookup285: xcm::VersionedXcm */ + /** Lookup284: xcm::VersionedXcm */ XcmVersionedXcm: { _enum: { __Unused0: "Null", @@ -2558,9 +2555,9 @@ export default { V3: "XcmV3Xcm", }, }, - /** Lookup286: xcm::v2::Xcm */ + /** Lookup285: xcm::v2::Xcm */ XcmV2Xcm: "Vec", - /** Lookup288: xcm::v2::Instruction */ + /** Lookup287: xcm::v2::Instruction */ XcmV2Instruction: { _enum: { WithdrawAsset: "XcmV2MultiassetMultiAssets", @@ -2656,7 +2653,7 @@ export default { UnsubscribeVersion: "Null", }, }, - /** Lookup289: xcm::v2::Response */ + /** Lookup288: xcm::v2::Response */ XcmV2Response: { _enum: { Null: "Null", @@ -2665,7 +2662,7 @@ export default { Version: "u32", }, }, - /** Lookup292: xcm::v2::traits::Error */ + /** Lookup291: xcm::v2::traits::Error */ XcmV2TraitsError: { _enum: { Overflow: "Null", @@ -2696,14 +2693,14 @@ export default { WeightNotComputable: "Null", }, }, - /** Lookup293: xcm::v2::multiasset::MultiAssetFilter */ + /** Lookup292: xcm::v2::multiasset::MultiAssetFilter */ XcmV2MultiassetMultiAssetFilter: { _enum: { Definite: "XcmV2MultiassetMultiAssets", Wild: "XcmV2MultiassetWildMultiAsset", }, }, - /** Lookup294: xcm::v2::multiasset::WildMultiAsset */ + /** Lookup293: xcm::v2::multiasset::WildMultiAsset */ XcmV2MultiassetWildMultiAsset: { _enum: { All: "Null", @@ -2713,18 +2710,18 @@ export default { }, }, }, - /** Lookup295: xcm::v2::multiasset::WildFungibility */ + /** Lookup294: xcm::v2::multiasset::WildFungibility */ XcmV2MultiassetWildFungibility: { _enum: ["Fungible", "NonFungible"], }, - /** Lookup296: xcm::v2::WeightLimit */ + /** Lookup295: xcm::v2::WeightLimit */ XcmV2WeightLimit: { _enum: { Unlimited: "Null", Limited: "Compact", }, }, - /** Lookup305: pallet_assets::pallet::Call */ + /** Lookup304: pallet_assets::pallet::Call */ PalletAssetsCall: { _enum: { create: { @@ -2874,7 +2871,7 @@ export default { }, }, }, - /** Lookup306: pallet_foreign_asset_creator::pallet::Call */ + /** Lookup305: pallet_foreign_asset_creator::pallet::Call */ PalletForeignAssetCreatorCall: { _enum: { create_foreign_asset: { @@ -2896,7 +2893,7 @@ export default { }, }, }, - /** Lookup307: pallet_asset_rate::pallet::Call */ + /** Lookup306: pallet_asset_rate::pallet::Call */ PalletAssetRateCall: { _enum: { create: { @@ -2912,7 +2909,7 @@ export default { }, }, }, - /** Lookup308: pallet_root_testing::pallet::Call */ + /** Lookup307: pallet_root_testing::pallet::Call */ PalletRootTestingCall: { _enum: { fill_block: { @@ -2920,27 +2917,27 @@ export default { }, }, }, - /** Lookup309: pallet_sudo::pallet::Error */ + /** Lookup308: pallet_sudo::pallet::Error */ PalletSudoError: { _enum: ["RequireSudo"], }, - /** Lookup310: pallet_utility::pallet::Error */ + /** Lookup309: pallet_utility::pallet::Error */ PalletUtilityError: { _enum: ["TooManyCalls"], }, - /** Lookup313: pallet_proxy::ProxyDefinition */ + /** Lookup312: pallet_proxy::ProxyDefinition */ PalletProxyProxyDefinition: { delegate: "AccountId32", proxyType: "DanceboxRuntimeProxyType", delay: "u32", }, - /** Lookup317: pallet_proxy::Announcement */ + /** Lookup316: pallet_proxy::Announcement */ PalletProxyAnnouncement: { real: "AccountId32", callHash: "H256", height: "u32", }, - /** Lookup319: pallet_proxy::pallet::Error */ + /** Lookup318: pallet_proxy::pallet::Error */ PalletProxyError: { _enum: [ "TooMany", @@ -2953,34 +2950,34 @@ export default { "NoSelfProxy", ], }, - /** Lookup320: pallet_migrations::pallet::Error */ + /** Lookup319: pallet_migrations::pallet::Error */ PalletMigrationsError: { _enum: ["PreimageMissing", "WrongUpperBound", "PreimageIsTooBig", "PreimageAlreadyExists"], }, - /** Lookup321: pallet_maintenance_mode::pallet::Error */ + /** Lookup320: pallet_maintenance_mode::pallet::Error */ PalletMaintenanceModeError: { _enum: ["AlreadyInMaintenanceMode", "NotInMaintenanceMode"], }, - /** Lookup322: pallet_tx_pause::pallet::Error */ + /** Lookup321: pallet_tx_pause::pallet::Error */ PalletTxPauseError: { _enum: ["IsPaused", "IsUnpaused", "Unpausable", "NotFound"], }, - /** Lookup324: pallet_balances::types::BalanceLock */ + /** Lookup323: pallet_balances::types::BalanceLock */ PalletBalancesBalanceLock: { id: "[u8;8]", amount: "u128", reasons: "PalletBalancesReasons", }, - /** Lookup325: pallet_balances::types::Reasons */ + /** Lookup324: pallet_balances::types::Reasons */ PalletBalancesReasons: { _enum: ["Fee", "Misc", "All"], }, - /** Lookup328: pallet_balances::types::ReserveData */ + /** Lookup327: pallet_balances::types::ReserveData */ PalletBalancesReserveData: { id: "[u8;8]", amount: "u128", }, - /** Lookup332: dancebox_runtime::RuntimeHoldReason */ + /** Lookup331: dancebox_runtime::RuntimeHoldReason */ DanceboxRuntimeRuntimeHoldReason: { _enum: { __Unused0: "Null", @@ -3020,16 +3017,16 @@ export default { PooledStaking: "PalletPooledStakingHoldReason", }, }, - /** Lookup333: pallet_pooled_staking::pallet::HoldReason */ + /** Lookup332: pallet_pooled_staking::pallet::HoldReason */ PalletPooledStakingHoldReason: { _enum: ["PooledStake"], }, - /** Lookup336: pallet_balances::types::IdAmount */ + /** Lookup335: pallet_balances::types::IdAmount */ PalletBalancesIdAmount: { id: "[u8;8]", amount: "u128", }, - /** Lookup338: pallet_balances::pallet::Error */ + /** Lookup337: pallet_balances::pallet::Error */ PalletBalancesError: { _enum: [ "VestingBalance", @@ -3044,18 +3041,18 @@ export default { "TooManyFreezes", ], }, - /** Lookup339: pallet_transaction_payment::Releases */ + /** Lookup338: pallet_transaction_payment::Releases */ PalletTransactionPaymentReleases: { _enum: ["V1Ancient", "V2"], }, - /** Lookup340: pallet_identity::types::Registration> */ + /** Lookup339: pallet_identity::types::Registration> */ PalletIdentityRegistration: { judgements: "Vec<(u32,PalletIdentityJudgement)>", deposit: "u128", info: "PalletIdentitySimpleIdentityInfo", }, /** - * Lookup348: pallet_identity::types::RegistrarInfo */ PalletIdentityRegistrarInfo: { @@ -3063,7 +3060,7 @@ export default { fee: "u128", fields: "PalletIdentityBitFlags", }, - /** Lookup350: pallet_identity::pallet::Error */ + /** Lookup349: pallet_identity::pallet::Error */ PalletIdentityError: { _enum: [ "TooManySubAccounts", @@ -3086,16 +3083,16 @@ export default { "JudgementPaymentFailed", ], }, - /** Lookup355: tp_traits::ParathreadParams */ + /** Lookup354: tp_traits::ParathreadParams */ TpTraitsParathreadParams: { slotFrequency: "TpTraitsSlotFrequency", }, - /** Lookup361: pallet_registrar::pallet::DepositInfo */ + /** Lookup360: pallet_registrar::pallet::DepositInfo */ PalletRegistrarDepositInfo: { creator: "AccountId32", deposit: "u128", }, - /** Lookup362: pallet_registrar::pallet::Error */ + /** Lookup361: pallet_registrar::pallet::Error */ PalletRegistrarError: { _enum: [ "ParaIdAlreadyRegistered", @@ -3110,7 +3107,7 @@ export default { "NotAParathread", ], }, - /** Lookup363: pallet_configuration::HostConfiguration */ + /** Lookup362: pallet_configuration::HostConfiguration */ PalletConfigurationHostConfiguration: { maxCollators: "u32", minOrchestratorCollators: "u32", @@ -3121,21 +3118,21 @@ export default { parathreadsPerCollator: "u32", targetContainerChainFullness: "Perbill", }, - /** Lookup366: pallet_configuration::pallet::Error */ + /** Lookup365: pallet_configuration::pallet::Error */ PalletConfigurationError: { _enum: ["InvalidNewValue"], }, - /** Lookup367: dp_collator_assignment::AssignedCollators */ + /** Lookup366: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsAccountId32: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup372: pallet_author_noting::pallet::ContainerChainBlockInfo */ + /** Lookup371: pallet_author_noting::pallet::ContainerChainBlockInfo */ PalletAuthorNotingContainerChainBlockInfo: { blockNumber: "u32", author: "AccountId32", }, - /** Lookup373: pallet_author_noting::pallet::Error */ + /** Lookup372: pallet_author_noting::pallet::Error */ PalletAuthorNotingError: { _enum: [ "FailedReading", @@ -3147,39 +3144,39 @@ export default { "NonAuraDigest", ], }, - /** Lookup374: dp_collator_assignment::AssignedCollators */ + /** Lookup373: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsPublic: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup379: pallet_services_payment::pallet::Error */ + /** Lookup378: pallet_services_payment::pallet::Error */ PalletServicesPaymentError: { _enum: ["InsufficientFundsToPurchaseCredits", "InsufficientCredits", "CreditPriceTooExpensive"], }, - /** Lookup380: pallet_data_preservers::pallet::Error */ + /** Lookup379: pallet_data_preservers::pallet::Error */ PalletDataPreserversError: { _enum: ["NoBootNodes"], }, - /** Lookup382: pallet_invulnerables::pallet::Error */ + /** Lookup381: pallet_invulnerables::pallet::Error */ PalletInvulnerablesError: { _enum: ["TooManyInvulnerables", "AlreadyInvulnerable", "NotInvulnerable"], }, - /** Lookup387: sp_core::crypto::KeyTypeId */ + /** Lookup386: sp_core::crypto::KeyTypeId */ SpCoreCryptoKeyTypeId: "[u8;4]", - /** Lookup388: pallet_session::pallet::Error */ + /** Lookup387: pallet_session::pallet::Error */ PalletSessionError: { _enum: ["InvalidProof", "NoAssociatedValidatorId", "DuplicatedKey", "NoKeys", "NoAccount"], }, - /** Lookup392: pallet_author_inherent::pallet::Error */ + /** Lookup391: pallet_author_inherent::pallet::Error */ PalletAuthorInherentError: { _enum: ["AuthorAlreadySet", "NoAccountId", "CannotBeAuthor"], }, - /** Lookup394: pallet_pooled_staking::candidate::EligibleCandidate */ + /** Lookup393: pallet_pooled_staking::candidate::EligibleCandidate */ PalletPooledStakingCandidateEligibleCandidate: { candidate: "AccountId32", stake: "u128", }, - /** Lookup397: pallet_pooled_staking::pallet::PoolsKey */ + /** Lookup396: pallet_pooled_staking::pallet::PoolsKey */ PalletPooledStakingPoolsKey: { _enum: { CandidateTotalStake: "Null", @@ -3221,7 +3218,7 @@ export default { }, }, }, - /** Lookup399: pallet_pooled_staking::pallet::Error */ + /** Lookup398: pallet_pooled_staking::pallet::Error */ PalletPooledStakingError: { _enum: { InvalidPalletSetting: "Null", @@ -3240,26 +3237,26 @@ export default { SwapResultsInZeroShares: "Null", }, }, - /** Lookup400: pallet_inflation_rewards::pallet::ChainsToRewardValue */ + /** Lookup399: pallet_inflation_rewards::pallet::ChainsToRewardValue */ PalletInflationRewardsChainsToRewardValue: { paraIds: "Vec", rewardsPerChain: "u128", }, - /** Lookup402: cumulus_pallet_xcmp_queue::InboundChannelDetails */ + /** Lookup401: cumulus_pallet_xcmp_queue::InboundChannelDetails */ CumulusPalletXcmpQueueInboundChannelDetails: { sender: "u32", state: "CumulusPalletXcmpQueueInboundState", messageMetadata: "Vec<(u32,PolkadotParachainPrimitivesPrimitivesXcmpMessageFormat)>", }, - /** Lookup403: cumulus_pallet_xcmp_queue::InboundState */ + /** Lookup402: cumulus_pallet_xcmp_queue::InboundState */ CumulusPalletXcmpQueueInboundState: { _enum: ["Ok", "Suspended"], }, - /** Lookup406: polkadot_parachain_primitives::primitives::XcmpMessageFormat */ + /** Lookup405: polkadot_parachain_primitives::primitives::XcmpMessageFormat */ PolkadotParachainPrimitivesPrimitivesXcmpMessageFormat: { _enum: ["ConcatenatedVersionedXcm", "ConcatenatedEncodedBlob", "Signals"], }, - /** Lookup409: cumulus_pallet_xcmp_queue::OutboundChannelDetails */ + /** Lookup408: cumulus_pallet_xcmp_queue::OutboundChannelDetails */ CumulusPalletXcmpQueueOutboundChannelDetails: { recipient: "u32", state: "CumulusPalletXcmpQueueOutboundState", @@ -3267,11 +3264,11 @@ export default { firstIndex: "u16", lastIndex: "u16", }, - /** Lookup410: cumulus_pallet_xcmp_queue::OutboundState */ + /** Lookup409: cumulus_pallet_xcmp_queue::OutboundState */ CumulusPalletXcmpQueueOutboundState: { _enum: ["Ok", "Suspended"], }, - /** Lookup412: cumulus_pallet_xcmp_queue::QueueConfigData */ + /** Lookup411: cumulus_pallet_xcmp_queue::QueueConfigData */ CumulusPalletXcmpQueueQueueConfigData: { suspendThreshold: "u32", dropThreshold: "u32", @@ -3280,27 +3277,27 @@ export default { weightRestrictDecay: "SpWeightsWeightV2Weight", xcmpMaxIndividualWeight: "SpWeightsWeightV2Weight", }, - /** Lookup414: cumulus_pallet_xcmp_queue::pallet::Error */ + /** Lookup413: cumulus_pallet_xcmp_queue::pallet::Error */ CumulusPalletXcmpQueueError: { _enum: ["FailedToSend", "BadXcmOrigin", "BadXcm", "BadOverweightIndex", "WeightOverLimit"], }, - /** Lookup415: cumulus_pallet_xcm::pallet::Error */ + /** Lookup414: cumulus_pallet_xcm::pallet::Error */ CumulusPalletXcmError: "Null", - /** Lookup416: cumulus_pallet_dmp_queue::ConfigData */ + /** Lookup415: cumulus_pallet_dmp_queue::ConfigData */ CumulusPalletDmpQueueConfigData: { maxIndividual: "SpWeightsWeightV2Weight", }, - /** Lookup417: cumulus_pallet_dmp_queue::PageIndexData */ + /** Lookup416: cumulus_pallet_dmp_queue::PageIndexData */ CumulusPalletDmpQueuePageIndexData: { beginUsed: "u32", endUsed: "u32", overweightCount: "u64", }, - /** Lookup420: cumulus_pallet_dmp_queue::pallet::Error */ + /** Lookup419: cumulus_pallet_dmp_queue::pallet::Error */ CumulusPalletDmpQueueError: { _enum: ["Unknown", "OverLimit"], }, - /** Lookup421: pallet_xcm::pallet::QueryStatus */ + /** Lookup420: pallet_xcm::pallet::QueryStatus */ PalletXcmQueryStatus: { _enum: { Pending: { @@ -3319,7 +3316,7 @@ export default { }, }, }, - /** Lookup425: xcm::VersionedResponse */ + /** Lookup424: xcm::VersionedResponse */ XcmVersionedResponse: { _enum: { __Unused0: "Null", @@ -3328,7 +3325,7 @@ export default { V3: "XcmV3Response", }, }, - /** Lookup431: pallet_xcm::pallet::VersionMigrationStage */ + /** Lookup430: pallet_xcm::pallet::VersionMigrationStage */ PalletXcmVersionMigrationStage: { _enum: { MigrateSupportedVersion: "Null", @@ -3337,7 +3334,7 @@ export default { MigrateAndNotifyOldTargets: "Null", }, }, - /** Lookup433: xcm::VersionedAssetId */ + /** Lookup432: xcm::VersionedAssetId */ XcmVersionedAssetId: { _enum: { __Unused0: "Null", @@ -3346,14 +3343,14 @@ export default { V3: "XcmV3MultiassetAssetId", }, }, - /** Lookup434: pallet_xcm::pallet::RemoteLockedFungibleRecord */ + /** Lookup433: pallet_xcm::pallet::RemoteLockedFungibleRecord */ PalletXcmRemoteLockedFungibleRecord: { amount: "u128", owner: "XcmVersionedMultiLocation", locker: "XcmVersionedMultiLocation", consumers: "Vec<(Null,u128)>", }, - /** Lookup441: pallet_xcm::pallet::Error */ + /** Lookup440: pallet_xcm::pallet::Error */ PalletXcmError: { _enum: [ "Unreachable", @@ -3378,7 +3375,7 @@ export default { "InUse", ], }, - /** Lookup442: pallet_assets::types::AssetDetails */ + /** Lookup441: pallet_assets::types::AssetDetails */ PalletAssetsAssetDetails: { owner: "AccountId32", issuer: "AccountId32", @@ -3393,22 +3390,22 @@ export default { approvals: "u32", status: "PalletAssetsAssetStatus", }, - /** Lookup443: pallet_assets::types::AssetStatus */ + /** Lookup442: pallet_assets::types::AssetStatus */ PalletAssetsAssetStatus: { _enum: ["Live", "Frozen", "Destroying"], }, - /** Lookup445: pallet_assets::types::AssetAccount */ + /** Lookup444: pallet_assets::types::AssetAccount */ PalletAssetsAssetAccount: { balance: "u128", status: "PalletAssetsAccountStatus", reason: "PalletAssetsExistenceReason", extra: "Null", }, - /** Lookup446: pallet_assets::types::AccountStatus */ + /** Lookup445: pallet_assets::types::AccountStatus */ PalletAssetsAccountStatus: { _enum: ["Liquid", "Frozen", "Blocked"], }, - /** Lookup447: pallet_assets::types::ExistenceReason */ + /** Lookup446: pallet_assets::types::ExistenceReason */ PalletAssetsExistenceReason: { _enum: { Consumer: "Null", @@ -3418,12 +3415,12 @@ export default { DepositFrom: "(AccountId32,u128)", }, }, - /** Lookup449: pallet_assets::types::Approval */ + /** Lookup448: pallet_assets::types::Approval */ PalletAssetsApproval: { amount: "u128", deposit: "u128", }, - /** Lookup450: pallet_assets::types::AssetMetadata> */ + /** Lookup449: pallet_assets::types::AssetMetadata> */ PalletAssetsAssetMetadata: { deposit: "u128", name: "Bytes", @@ -3431,7 +3428,7 @@ export default { decimals: "u8", isFrozen: "bool", }, - /** Lookup452: pallet_assets::pallet::Error */ + /** Lookup451: pallet_assets::pallet::Error */ PalletAssetsError: { _enum: [ "BalanceLow", @@ -3456,15 +3453,15 @@ export default { "CallbackFailed", ], }, - /** Lookup453: pallet_foreign_asset_creator::pallet::Error */ + /** Lookup452: pallet_foreign_asset_creator::pallet::Error */ PalletForeignAssetCreatorError: { _enum: ["AssetAlreadyExists", "AssetDoesNotExist"], }, - /** Lookup454: pallet_asset_rate::pallet::Error */ + /** Lookup453: pallet_asset_rate::pallet::Error */ PalletAssetRateError: { _enum: ["UnknownAssetKind", "AlreadyExists"], }, - /** Lookup459: sp_runtime::MultiSignature */ + /** Lookup458: sp_runtime::MultiSignature */ SpRuntimeMultiSignature: { _enum: { Ed25519: "SpCoreEd25519Signature", @@ -3472,26 +3469,26 @@ export default { Ecdsa: "SpCoreEcdsaSignature", }, }, - /** Lookup460: sp_core::ed25519::Signature */ + /** Lookup459: sp_core::ed25519::Signature */ SpCoreEd25519Signature: "[u8;64]", - /** Lookup462: sp_core::sr25519::Signature */ + /** Lookup461: sp_core::sr25519::Signature */ SpCoreSr25519Signature: "[u8;64]", - /** Lookup463: sp_core::ecdsa::Signature */ + /** Lookup462: sp_core::ecdsa::Signature */ SpCoreEcdsaSignature: "[u8;65]", - /** Lookup466: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ + /** Lookup465: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ FrameSystemExtensionsCheckNonZeroSender: "Null", - /** Lookup467: frame_system::extensions::check_spec_version::CheckSpecVersion */ + /** Lookup466: frame_system::extensions::check_spec_version::CheckSpecVersion */ FrameSystemExtensionsCheckSpecVersion: "Null", - /** Lookup468: frame_system::extensions::check_tx_version::CheckTxVersion */ + /** Lookup467: frame_system::extensions::check_tx_version::CheckTxVersion */ FrameSystemExtensionsCheckTxVersion: "Null", - /** Lookup469: frame_system::extensions::check_genesis::CheckGenesis */ + /** Lookup468: frame_system::extensions::check_genesis::CheckGenesis */ FrameSystemExtensionsCheckGenesis: "Null", - /** Lookup472: frame_system::extensions::check_nonce::CheckNonce */ + /** Lookup471: frame_system::extensions::check_nonce::CheckNonce */ FrameSystemExtensionsCheckNonce: "Compact", - /** Lookup473: frame_system::extensions::check_weight::CheckWeight */ + /** Lookup472: frame_system::extensions::check_weight::CheckWeight */ FrameSystemExtensionsCheckWeight: "Null", - /** Lookup474: pallet_transaction_payment::ChargeTransactionPayment */ + /** Lookup473: pallet_transaction_payment::ChargeTransactionPayment */ PalletTransactionPaymentChargeTransactionPayment: "Compact", - /** Lookup475: dancebox_runtime::Runtime */ + /** Lookup474: 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 8bbffe2f7..39569862a 100644 --- a/typescript-api/src/dancebox/interfaces/types-lookup.ts +++ b/typescript-api/src/dancebox/interfaces/types-lookup.ts @@ -710,9 +710,7 @@ declare module "@polkadot/types/lookup" { readonly asCreditsPurchased: { readonly paraId: u32; readonly payer: AccountId32; - readonly fee: u128; - readonly creditsPurchased: u32; - readonly creditsRemaining: u32; + readonly credit: u128; } & Struct; readonly isCreditBurned: boolean; readonly asCreditBurned: { @@ -3101,8 +3099,7 @@ declare module "@polkadot/types/lookup" { readonly isPurchaseCredits: boolean; readonly asPurchaseCredits: { readonly paraId: u32; - readonly credits: u32; - readonly maxPricePerCredit: Option; + readonly credit: u128; } & Struct; readonly isSetCredits: boolean; readonly asSetCredits: { @@ -3117,7 +3114,7 @@ declare module "@polkadot/types/lookup" { readonly type: "PurchaseCredits" | "SetCredits" | "SetGivenFreeCredits"; } - /** @name PalletDataPreserversCall (264) */ + /** @name PalletDataPreserversCall (263) */ interface PalletDataPreserversCall extends Enum { readonly isSetBootNodes: boolean; readonly asSetBootNodes: { @@ -3127,7 +3124,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetBootNodes"; } - /** @name PalletInvulnerablesCall (268) */ + /** @name PalletInvulnerablesCall (267) */ interface PalletInvulnerablesCall extends Enum { readonly isSetInvulnerables: boolean; readonly asSetInvulnerables: { @@ -3144,7 +3141,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetInvulnerables" | "AddInvulnerable" | "RemoveInvulnerable"; } - /** @name PalletSessionCall (269) */ + /** @name PalletSessionCall (268) */ interface PalletSessionCall extends Enum { readonly isSetKeys: boolean; readonly asSetKeys: { @@ -3155,24 +3152,24 @@ declare module "@polkadot/types/lookup" { readonly type: "SetKeys" | "PurgeKeys"; } - /** @name DanceboxRuntimeSessionKeys (270) */ + /** @name DanceboxRuntimeSessionKeys (269) */ interface DanceboxRuntimeSessionKeys extends Struct { readonly nimbus: NimbusPrimitivesNimbusCryptoPublic; } - /** @name NimbusPrimitivesNimbusCryptoPublic (271) */ + /** @name NimbusPrimitivesNimbusCryptoPublic (270) */ interface NimbusPrimitivesNimbusCryptoPublic extends SpCoreSr25519Public {} - /** @name SpCoreSr25519Public (272) */ + /** @name SpCoreSr25519Public (271) */ interface SpCoreSr25519Public extends U8aFixed {} - /** @name PalletAuthorInherentCall (273) */ + /** @name PalletAuthorInherentCall (272) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletPooledStakingCall (274) */ + /** @name PalletPooledStakingCall (273) */ interface PalletPooledStakingCall extends Enum { readonly isRebalanceHold: boolean; readonly asRebalanceHold: { @@ -3220,7 +3217,7 @@ declare module "@polkadot/types/lookup" { | "SwapPool"; } - /** @name PalletPooledStakingAllTargetPool (275) */ + /** @name PalletPooledStakingAllTargetPool (274) */ interface PalletPooledStakingAllTargetPool extends Enum { readonly isJoining: boolean; readonly isAutoCompounding: boolean; @@ -3229,13 +3226,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Joining" | "AutoCompounding" | "ManualRewards" | "Leaving"; } - /** @name PalletPooledStakingPendingOperationQuery (277) */ + /** @name PalletPooledStakingPendingOperationQuery (276) */ interface PalletPooledStakingPendingOperationQuery extends Struct { readonly delegator: AccountId32; readonly operation: PalletPooledStakingPendingOperationKey; } - /** @name PalletPooledStakingPendingOperationKey (278) */ + /** @name PalletPooledStakingPendingOperationKey (277) */ interface PalletPooledStakingPendingOperationKey extends Enum { readonly isJoiningAutoCompounding: boolean; readonly asJoiningAutoCompounding: { @@ -3255,7 +3252,7 @@ declare module "@polkadot/types/lookup" { readonly type: "JoiningAutoCompounding" | "JoiningManualRewards" | "Leaving"; } - /** @name PalletPooledStakingSharesOrStake (279) */ + /** @name PalletPooledStakingSharesOrStake (278) */ interface PalletPooledStakingSharesOrStake extends Enum { readonly isShares: boolean; readonly asShares: u128; @@ -3264,7 +3261,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Shares" | "Stake"; } - /** @name CumulusPalletXcmpQueueCall (282) */ + /** @name CumulusPalletXcmpQueueCall (281) */ interface CumulusPalletXcmpQueueCall extends Enum { readonly isServiceOverweight: boolean; readonly asServiceOverweight: { @@ -3309,7 +3306,7 @@ declare module "@polkadot/types/lookup" { | "UpdateXcmpMaxIndividualWeight"; } - /** @name CumulusPalletDmpQueueCall (283) */ + /** @name CumulusPalletDmpQueueCall (282) */ interface CumulusPalletDmpQueueCall extends Enum { readonly isServiceOverweight: boolean; readonly asServiceOverweight: { @@ -3319,7 +3316,7 @@ declare module "@polkadot/types/lookup" { readonly type: "ServiceOverweight"; } - /** @name PalletXcmCall (284) */ + /** @name PalletXcmCall (283) */ interface PalletXcmCall extends Enum { readonly isSend: boolean; readonly asSend: { @@ -3396,7 +3393,7 @@ declare module "@polkadot/types/lookup" { | "ForceSuspension"; } - /** @name XcmVersionedXcm (285) */ + /** @name XcmVersionedXcm (284) */ interface XcmVersionedXcm extends Enum { readonly isV2: boolean; readonly asV2: XcmV2Xcm; @@ -3405,10 +3402,10 @@ declare module "@polkadot/types/lookup" { readonly type: "V2" | "V3"; } - /** @name XcmV2Xcm (286) */ + /** @name XcmV2Xcm (285) */ interface XcmV2Xcm extends Vec {} - /** @name XcmV2Instruction (288) */ + /** @name XcmV2Instruction (287) */ interface XcmV2Instruction extends Enum { readonly isWithdrawAsset: boolean; readonly asWithdrawAsset: XcmV2MultiassetMultiAssets; @@ -3556,7 +3553,7 @@ declare module "@polkadot/types/lookup" { | "UnsubscribeVersion"; } - /** @name XcmV2Response (289) */ + /** @name XcmV2Response (288) */ interface XcmV2Response extends Enum { readonly isNull: boolean; readonly isAssets: boolean; @@ -3568,7 +3565,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Null" | "Assets" | "ExecutionResult" | "Version"; } - /** @name XcmV2TraitsError (292) */ + /** @name XcmV2TraitsError (291) */ interface XcmV2TraitsError extends Enum { readonly isOverflow: boolean; readonly isUnimplemented: boolean; @@ -3627,7 +3624,7 @@ declare module "@polkadot/types/lookup" { | "WeightNotComputable"; } - /** @name XcmV2MultiassetMultiAssetFilter (293) */ + /** @name XcmV2MultiassetMultiAssetFilter (292) */ interface XcmV2MultiassetMultiAssetFilter extends Enum { readonly isDefinite: boolean; readonly asDefinite: XcmV2MultiassetMultiAssets; @@ -3636,7 +3633,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Definite" | "Wild"; } - /** @name XcmV2MultiassetWildMultiAsset (294) */ + /** @name XcmV2MultiassetWildMultiAsset (293) */ interface XcmV2MultiassetWildMultiAsset extends Enum { readonly isAll: boolean; readonly isAllOf: boolean; @@ -3647,14 +3644,14 @@ declare module "@polkadot/types/lookup" { readonly type: "All" | "AllOf"; } - /** @name XcmV2MultiassetWildFungibility (295) */ + /** @name XcmV2MultiassetWildFungibility (294) */ interface XcmV2MultiassetWildFungibility extends Enum { readonly isFungible: boolean; readonly isNonFungible: boolean; readonly type: "Fungible" | "NonFungible"; } - /** @name XcmV2WeightLimit (296) */ + /** @name XcmV2WeightLimit (295) */ interface XcmV2WeightLimit extends Enum { readonly isUnlimited: boolean; readonly isLimited: boolean; @@ -3662,7 +3659,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Unlimited" | "Limited"; } - /** @name PalletAssetsCall (305) */ + /** @name PalletAssetsCall (304) */ interface PalletAssetsCall extends Enum { readonly isCreate: boolean; readonly asCreate: { @@ -3876,7 +3873,7 @@ declare module "@polkadot/types/lookup" { | "Block"; } - /** @name PalletForeignAssetCreatorCall (306) */ + /** @name PalletForeignAssetCreatorCall (305) */ interface PalletForeignAssetCreatorCall extends Enum { readonly isCreateForeignAsset: boolean; readonly asCreateForeignAsset: { @@ -3906,7 +3903,7 @@ declare module "@polkadot/types/lookup" { | "DestroyForeignAsset"; } - /** @name PalletAssetRateCall (307) */ + /** @name PalletAssetRateCall (306) */ interface PalletAssetRateCall extends Enum { readonly isCreate: boolean; readonly asCreate: { @@ -3925,7 +3922,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Create" | "Update" | "Remove"; } - /** @name PalletRootTestingCall (308) */ + /** @name PalletRootTestingCall (307) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -3934,33 +3931,33 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock"; } - /** @name PalletSudoError (309) */ + /** @name PalletSudoError (308) */ interface PalletSudoError extends Enum { readonly isRequireSudo: boolean; readonly type: "RequireSudo"; } - /** @name PalletUtilityError (310) */ + /** @name PalletUtilityError (309) */ interface PalletUtilityError extends Enum { readonly isTooManyCalls: boolean; readonly type: "TooManyCalls"; } - /** @name PalletProxyProxyDefinition (313) */ + /** @name PalletProxyProxyDefinition (312) */ interface PalletProxyProxyDefinition extends Struct { readonly delegate: AccountId32; readonly proxyType: DanceboxRuntimeProxyType; readonly delay: u32; } - /** @name PalletProxyAnnouncement (317) */ + /** @name PalletProxyAnnouncement (316) */ interface PalletProxyAnnouncement extends Struct { readonly real: AccountId32; readonly callHash: H256; readonly height: u32; } - /** @name PalletProxyError (319) */ + /** @name PalletProxyError (318) */ interface PalletProxyError extends Enum { readonly isTooMany: boolean; readonly isNotFound: boolean; @@ -3981,7 +3978,7 @@ declare module "@polkadot/types/lookup" { | "NoSelfProxy"; } - /** @name PalletMigrationsError (320) */ + /** @name PalletMigrationsError (319) */ interface PalletMigrationsError extends Enum { readonly isPreimageMissing: boolean; readonly isWrongUpperBound: boolean; @@ -3990,14 +3987,14 @@ declare module "@polkadot/types/lookup" { readonly type: "PreimageMissing" | "WrongUpperBound" | "PreimageIsTooBig" | "PreimageAlreadyExists"; } - /** @name PalletMaintenanceModeError (321) */ + /** @name PalletMaintenanceModeError (320) */ interface PalletMaintenanceModeError extends Enum { readonly isAlreadyInMaintenanceMode: boolean; readonly isNotInMaintenanceMode: boolean; readonly type: "AlreadyInMaintenanceMode" | "NotInMaintenanceMode"; } - /** @name PalletTxPauseError (322) */ + /** @name PalletTxPauseError (321) */ interface PalletTxPauseError extends Enum { readonly isIsPaused: boolean; readonly isIsUnpaused: boolean; @@ -4006,14 +4003,14 @@ declare module "@polkadot/types/lookup" { readonly type: "IsPaused" | "IsUnpaused" | "Unpausable" | "NotFound"; } - /** @name PalletBalancesBalanceLock (324) */ + /** @name PalletBalancesBalanceLock (323) */ interface PalletBalancesBalanceLock extends Struct { readonly id: U8aFixed; readonly amount: u128; readonly reasons: PalletBalancesReasons; } - /** @name PalletBalancesReasons (325) */ + /** @name PalletBalancesReasons (324) */ interface PalletBalancesReasons extends Enum { readonly isFee: boolean; readonly isMisc: boolean; @@ -4021,32 +4018,32 @@ declare module "@polkadot/types/lookup" { readonly type: "Fee" | "Misc" | "All"; } - /** @name PalletBalancesReserveData (328) */ + /** @name PalletBalancesReserveData (327) */ interface PalletBalancesReserveData extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name DanceboxRuntimeRuntimeHoldReason (332) */ + /** @name DanceboxRuntimeRuntimeHoldReason (331) */ interface DanceboxRuntimeRuntimeHoldReason extends Enum { readonly isPooledStaking: boolean; readonly asPooledStaking: PalletPooledStakingHoldReason; readonly type: "PooledStaking"; } - /** @name PalletPooledStakingHoldReason (333) */ + /** @name PalletPooledStakingHoldReason (332) */ interface PalletPooledStakingHoldReason extends Enum { readonly isPooledStake: boolean; readonly type: "PooledStake"; } - /** @name PalletBalancesIdAmount (336) */ + /** @name PalletBalancesIdAmount (335) */ interface PalletBalancesIdAmount extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name PalletBalancesError (338) */ + /** @name PalletBalancesError (337) */ interface PalletBalancesError extends Enum { readonly isVestingBalance: boolean; readonly isLiquidityRestrictions: boolean; @@ -4071,28 +4068,28 @@ declare module "@polkadot/types/lookup" { | "TooManyFreezes"; } - /** @name PalletTransactionPaymentReleases (339) */ + /** @name PalletTransactionPaymentReleases (338) */ interface PalletTransactionPaymentReleases extends Enum { readonly isV1Ancient: boolean; readonly isV2: boolean; readonly type: "V1Ancient" | "V2"; } - /** @name PalletIdentityRegistration (340) */ + /** @name PalletIdentityRegistration (339) */ interface PalletIdentityRegistration extends Struct { readonly judgements: Vec>; readonly deposit: u128; readonly info: PalletIdentitySimpleIdentityInfo; } - /** @name PalletIdentityRegistrarInfo (348) */ + /** @name PalletIdentityRegistrarInfo (347) */ interface PalletIdentityRegistrarInfo extends Struct { readonly account: AccountId32; readonly fee: u128; readonly fields: PalletIdentityBitFlags; } - /** @name PalletIdentityError (350) */ + /** @name PalletIdentityError (349) */ interface PalletIdentityError extends Enum { readonly isTooManySubAccounts: boolean; readonly isNotFound: boolean; @@ -4133,18 +4130,18 @@ declare module "@polkadot/types/lookup" { | "JudgementPaymentFailed"; } - /** @name TpTraitsParathreadParams (355) */ + /** @name TpTraitsParathreadParams (354) */ interface TpTraitsParathreadParams extends Struct { readonly slotFrequency: TpTraitsSlotFrequency; } - /** @name PalletRegistrarDepositInfo (361) */ + /** @name PalletRegistrarDepositInfo (360) */ interface PalletRegistrarDepositInfo extends Struct { readonly creator: AccountId32; readonly deposit: u128; } - /** @name PalletRegistrarError (362) */ + /** @name PalletRegistrarError (361) */ interface PalletRegistrarError extends Enum { readonly isParaIdAlreadyRegistered: boolean; readonly isParaIdNotRegistered: boolean; @@ -4169,7 +4166,7 @@ declare module "@polkadot/types/lookup" { | "NotAParathread"; } - /** @name PalletConfigurationHostConfiguration (363) */ + /** @name PalletConfigurationHostConfiguration (362) */ interface PalletConfigurationHostConfiguration extends Struct { readonly maxCollators: u32; readonly minOrchestratorCollators: u32; @@ -4181,25 +4178,25 @@ declare module "@polkadot/types/lookup" { readonly targetContainerChainFullness: Perbill; } - /** @name PalletConfigurationError (366) */ + /** @name PalletConfigurationError (365) */ interface PalletConfigurationError extends Enum { readonly isInvalidNewValue: boolean; readonly type: "InvalidNewValue"; } - /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (367) */ + /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (366) */ interface DpCollatorAssignmentAssignedCollatorsAccountId32 extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletAuthorNotingContainerChainBlockInfo (372) */ + /** @name PalletAuthorNotingContainerChainBlockInfo (371) */ interface PalletAuthorNotingContainerChainBlockInfo extends Struct { readonly blockNumber: u32; readonly author: AccountId32; } - /** @name PalletAuthorNotingError (373) */ + /** @name PalletAuthorNotingError (372) */ interface PalletAuthorNotingError extends Enum { readonly isFailedReading: boolean; readonly isFailedDecodingHeader: boolean; @@ -4218,13 +4215,13 @@ declare module "@polkadot/types/lookup" { | "NonAuraDigest"; } - /** @name DpCollatorAssignmentAssignedCollatorsPublic (374) */ + /** @name DpCollatorAssignmentAssignedCollatorsPublic (373) */ interface DpCollatorAssignmentAssignedCollatorsPublic extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletServicesPaymentError (379) */ + /** @name PalletServicesPaymentError (378) */ interface PalletServicesPaymentError extends Enum { readonly isInsufficientFundsToPurchaseCredits: boolean; readonly isInsufficientCredits: boolean; @@ -4232,13 +4229,13 @@ declare module "@polkadot/types/lookup" { readonly type: "InsufficientFundsToPurchaseCredits" | "InsufficientCredits" | "CreditPriceTooExpensive"; } - /** @name PalletDataPreserversError (380) */ + /** @name PalletDataPreserversError (379) */ interface PalletDataPreserversError extends Enum { readonly isNoBootNodes: boolean; readonly type: "NoBootNodes"; } - /** @name PalletInvulnerablesError (382) */ + /** @name PalletInvulnerablesError (381) */ interface PalletInvulnerablesError extends Enum { readonly isTooManyInvulnerables: boolean; readonly isAlreadyInvulnerable: boolean; @@ -4246,10 +4243,10 @@ declare module "@polkadot/types/lookup" { readonly type: "TooManyInvulnerables" | "AlreadyInvulnerable" | "NotInvulnerable"; } - /** @name SpCoreCryptoKeyTypeId (387) */ + /** @name SpCoreCryptoKeyTypeId (386) */ interface SpCoreCryptoKeyTypeId extends U8aFixed {} - /** @name PalletSessionError (388) */ + /** @name PalletSessionError (387) */ interface PalletSessionError extends Enum { readonly isInvalidProof: boolean; readonly isNoAssociatedValidatorId: boolean; @@ -4259,7 +4256,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InvalidProof" | "NoAssociatedValidatorId" | "DuplicatedKey" | "NoKeys" | "NoAccount"; } - /** @name PalletAuthorInherentError (392) */ + /** @name PalletAuthorInherentError (391) */ interface PalletAuthorInherentError extends Enum { readonly isAuthorAlreadySet: boolean; readonly isNoAccountId: boolean; @@ -4267,13 +4264,13 @@ declare module "@polkadot/types/lookup" { readonly type: "AuthorAlreadySet" | "NoAccountId" | "CannotBeAuthor"; } - /** @name PalletPooledStakingCandidateEligibleCandidate (394) */ + /** @name PalletPooledStakingCandidateEligibleCandidate (393) */ interface PalletPooledStakingCandidateEligibleCandidate extends Struct { readonly candidate: AccountId32; readonly stake: u128; } - /** @name PalletPooledStakingPoolsKey (397) */ + /** @name PalletPooledStakingPoolsKey (396) */ interface PalletPooledStakingPoolsKey extends Enum { readonly isCandidateTotalStake: boolean; readonly isJoiningShares: boolean; @@ -4343,7 +4340,7 @@ declare module "@polkadot/types/lookup" { | "LeavingSharesHeldStake"; } - /** @name PalletPooledStakingError (399) */ + /** @name PalletPooledStakingError (398) */ interface PalletPooledStakingError extends Enum { readonly isInvalidPalletSetting: boolean; readonly isDisabledFeature: boolean; @@ -4377,27 +4374,27 @@ declare module "@polkadot/types/lookup" { | "SwapResultsInZeroShares"; } - /** @name PalletInflationRewardsChainsToRewardValue (400) */ + /** @name PalletInflationRewardsChainsToRewardValue (399) */ interface PalletInflationRewardsChainsToRewardValue extends Struct { readonly paraIds: Vec; readonly rewardsPerChain: u128; } - /** @name CumulusPalletXcmpQueueInboundChannelDetails (402) */ + /** @name CumulusPalletXcmpQueueInboundChannelDetails (401) */ interface CumulusPalletXcmpQueueInboundChannelDetails extends Struct { readonly sender: u32; readonly state: CumulusPalletXcmpQueueInboundState; readonly messageMetadata: Vec>; } - /** @name CumulusPalletXcmpQueueInboundState (403) */ + /** @name CumulusPalletXcmpQueueInboundState (402) */ interface CumulusPalletXcmpQueueInboundState extends Enum { readonly isOk: boolean; readonly isSuspended: boolean; readonly type: "Ok" | "Suspended"; } - /** @name PolkadotParachainPrimitivesPrimitivesXcmpMessageFormat (406) */ + /** @name PolkadotParachainPrimitivesPrimitivesXcmpMessageFormat (405) */ interface PolkadotParachainPrimitivesPrimitivesXcmpMessageFormat extends Enum { readonly isConcatenatedVersionedXcm: boolean; readonly isConcatenatedEncodedBlob: boolean; @@ -4405,7 +4402,7 @@ declare module "@polkadot/types/lookup" { readonly type: "ConcatenatedVersionedXcm" | "ConcatenatedEncodedBlob" | "Signals"; } - /** @name CumulusPalletXcmpQueueOutboundChannelDetails (409) */ + /** @name CumulusPalletXcmpQueueOutboundChannelDetails (408) */ interface CumulusPalletXcmpQueueOutboundChannelDetails extends Struct { readonly recipient: u32; readonly state: CumulusPalletXcmpQueueOutboundState; @@ -4414,14 +4411,14 @@ declare module "@polkadot/types/lookup" { readonly lastIndex: u16; } - /** @name CumulusPalletXcmpQueueOutboundState (410) */ + /** @name CumulusPalletXcmpQueueOutboundState (409) */ interface CumulusPalletXcmpQueueOutboundState extends Enum { readonly isOk: boolean; readonly isSuspended: boolean; readonly type: "Ok" | "Suspended"; } - /** @name CumulusPalletXcmpQueueQueueConfigData (412) */ + /** @name CumulusPalletXcmpQueueQueueConfigData (411) */ interface CumulusPalletXcmpQueueQueueConfigData extends Struct { readonly suspendThreshold: u32; readonly dropThreshold: u32; @@ -4431,7 +4428,7 @@ declare module "@polkadot/types/lookup" { readonly xcmpMaxIndividualWeight: SpWeightsWeightV2Weight; } - /** @name CumulusPalletXcmpQueueError (414) */ + /** @name CumulusPalletXcmpQueueError (413) */ interface CumulusPalletXcmpQueueError extends Enum { readonly isFailedToSend: boolean; readonly isBadXcmOrigin: boolean; @@ -4441,29 +4438,29 @@ declare module "@polkadot/types/lookup" { readonly type: "FailedToSend" | "BadXcmOrigin" | "BadXcm" | "BadOverweightIndex" | "WeightOverLimit"; } - /** @name CumulusPalletXcmError (415) */ + /** @name CumulusPalletXcmError (414) */ type CumulusPalletXcmError = Null; - /** @name CumulusPalletDmpQueueConfigData (416) */ + /** @name CumulusPalletDmpQueueConfigData (415) */ interface CumulusPalletDmpQueueConfigData extends Struct { readonly maxIndividual: SpWeightsWeightV2Weight; } - /** @name CumulusPalletDmpQueuePageIndexData (417) */ + /** @name CumulusPalletDmpQueuePageIndexData (416) */ interface CumulusPalletDmpQueuePageIndexData extends Struct { readonly beginUsed: u32; readonly endUsed: u32; readonly overweightCount: u64; } - /** @name CumulusPalletDmpQueueError (420) */ + /** @name CumulusPalletDmpQueueError (419) */ interface CumulusPalletDmpQueueError extends Enum { readonly isUnknown: boolean; readonly isOverLimit: boolean; readonly type: "Unknown" | "OverLimit"; } - /** @name PalletXcmQueryStatus (421) */ + /** @name PalletXcmQueryStatus (420) */ interface PalletXcmQueryStatus extends Enum { readonly isPending: boolean; readonly asPending: { @@ -4485,7 +4482,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Pending" | "VersionNotifier" | "Ready"; } - /** @name XcmVersionedResponse (425) */ + /** @name XcmVersionedResponse (424) */ interface XcmVersionedResponse extends Enum { readonly isV2: boolean; readonly asV2: XcmV2Response; @@ -4494,7 +4491,7 @@ declare module "@polkadot/types/lookup" { readonly type: "V2" | "V3"; } - /** @name PalletXcmVersionMigrationStage (431) */ + /** @name PalletXcmVersionMigrationStage (430) */ interface PalletXcmVersionMigrationStage extends Enum { readonly isMigrateSupportedVersion: boolean; readonly isMigrateVersionNotifiers: boolean; @@ -4508,14 +4505,14 @@ declare module "@polkadot/types/lookup" { | "MigrateAndNotifyOldTargets"; } - /** @name XcmVersionedAssetId (433) */ + /** @name XcmVersionedAssetId (432) */ interface XcmVersionedAssetId extends Enum { readonly isV3: boolean; readonly asV3: XcmV3MultiassetAssetId; readonly type: "V3"; } - /** @name PalletXcmRemoteLockedFungibleRecord (434) */ + /** @name PalletXcmRemoteLockedFungibleRecord (433) */ interface PalletXcmRemoteLockedFungibleRecord extends Struct { readonly amount: u128; readonly owner: XcmVersionedMultiLocation; @@ -4523,7 +4520,7 @@ declare module "@polkadot/types/lookup" { readonly consumers: Vec>; } - /** @name PalletXcmError (441) */ + /** @name PalletXcmError (440) */ interface PalletXcmError extends Enum { readonly isUnreachable: boolean; readonly isSendFailure: boolean; @@ -4568,7 +4565,7 @@ declare module "@polkadot/types/lookup" { | "InUse"; } - /** @name PalletAssetsAssetDetails (442) */ + /** @name PalletAssetsAssetDetails (441) */ interface PalletAssetsAssetDetails extends Struct { readonly owner: AccountId32; readonly issuer: AccountId32; @@ -4584,7 +4581,7 @@ declare module "@polkadot/types/lookup" { readonly status: PalletAssetsAssetStatus; } - /** @name PalletAssetsAssetStatus (443) */ + /** @name PalletAssetsAssetStatus (442) */ interface PalletAssetsAssetStatus extends Enum { readonly isLive: boolean; readonly isFrozen: boolean; @@ -4592,7 +4589,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Live" | "Frozen" | "Destroying"; } - /** @name PalletAssetsAssetAccount (445) */ + /** @name PalletAssetsAssetAccount (444) */ interface PalletAssetsAssetAccount extends Struct { readonly balance: u128; readonly status: PalletAssetsAccountStatus; @@ -4600,7 +4597,7 @@ declare module "@polkadot/types/lookup" { readonly extra: Null; } - /** @name PalletAssetsAccountStatus (446) */ + /** @name PalletAssetsAccountStatus (445) */ interface PalletAssetsAccountStatus extends Enum { readonly isLiquid: boolean; readonly isFrozen: boolean; @@ -4608,7 +4605,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Liquid" | "Frozen" | "Blocked"; } - /** @name PalletAssetsExistenceReason (447) */ + /** @name PalletAssetsExistenceReason (446) */ interface PalletAssetsExistenceReason extends Enum { readonly isConsumer: boolean; readonly isSufficient: boolean; @@ -4620,13 +4617,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Consumer" | "Sufficient" | "DepositHeld" | "DepositRefunded" | "DepositFrom"; } - /** @name PalletAssetsApproval (449) */ + /** @name PalletAssetsApproval (448) */ interface PalletAssetsApproval extends Struct { readonly amount: u128; readonly deposit: u128; } - /** @name PalletAssetsAssetMetadata (450) */ + /** @name PalletAssetsAssetMetadata (449) */ interface PalletAssetsAssetMetadata extends Struct { readonly deposit: u128; readonly name: Bytes; @@ -4635,7 +4632,7 @@ declare module "@polkadot/types/lookup" { readonly isFrozen: bool; } - /** @name PalletAssetsError (452) */ + /** @name PalletAssetsError (451) */ interface PalletAssetsError extends Enum { readonly isBalanceLow: boolean; readonly isNoAccount: boolean; @@ -4680,21 +4677,21 @@ declare module "@polkadot/types/lookup" { | "CallbackFailed"; } - /** @name PalletForeignAssetCreatorError (453) */ + /** @name PalletForeignAssetCreatorError (452) */ interface PalletForeignAssetCreatorError extends Enum { readonly isAssetAlreadyExists: boolean; readonly isAssetDoesNotExist: boolean; readonly type: "AssetAlreadyExists" | "AssetDoesNotExist"; } - /** @name PalletAssetRateError (454) */ + /** @name PalletAssetRateError (453) */ interface PalletAssetRateError extends Enum { readonly isUnknownAssetKind: boolean; readonly isAlreadyExists: boolean; readonly type: "UnknownAssetKind" | "AlreadyExists"; } - /** @name SpRuntimeMultiSignature (459) */ + /** @name SpRuntimeMultiSignature (458) */ interface SpRuntimeMultiSignature extends Enum { readonly isEd25519: boolean; readonly asEd25519: SpCoreEd25519Signature; @@ -4705,36 +4702,36 @@ declare module "@polkadot/types/lookup" { readonly type: "Ed25519" | "Sr25519" | "Ecdsa"; } - /** @name SpCoreEd25519Signature (460) */ + /** @name SpCoreEd25519Signature (459) */ interface SpCoreEd25519Signature extends U8aFixed {} - /** @name SpCoreSr25519Signature (462) */ + /** @name SpCoreSr25519Signature (461) */ interface SpCoreSr25519Signature extends U8aFixed {} - /** @name SpCoreEcdsaSignature (463) */ + /** @name SpCoreEcdsaSignature (462) */ interface SpCoreEcdsaSignature extends U8aFixed {} - /** @name FrameSystemExtensionsCheckNonZeroSender (466) */ + /** @name FrameSystemExtensionsCheckNonZeroSender (465) */ type FrameSystemExtensionsCheckNonZeroSender = Null; - /** @name FrameSystemExtensionsCheckSpecVersion (467) */ + /** @name FrameSystemExtensionsCheckSpecVersion (466) */ type FrameSystemExtensionsCheckSpecVersion = Null; - /** @name FrameSystemExtensionsCheckTxVersion (468) */ + /** @name FrameSystemExtensionsCheckTxVersion (467) */ type FrameSystemExtensionsCheckTxVersion = Null; - /** @name FrameSystemExtensionsCheckGenesis (469) */ + /** @name FrameSystemExtensionsCheckGenesis (468) */ type FrameSystemExtensionsCheckGenesis = Null; - /** @name FrameSystemExtensionsCheckNonce (472) */ + /** @name FrameSystemExtensionsCheckNonce (471) */ interface FrameSystemExtensionsCheckNonce extends Compact {} - /** @name FrameSystemExtensionsCheckWeight (473) */ + /** @name FrameSystemExtensionsCheckWeight (472) */ type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTransactionPaymentChargeTransactionPayment (474) */ + /** @name PalletTransactionPaymentChargeTransactionPayment (473) */ interface PalletTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name DanceboxRuntimeRuntime (475) */ + /** @name DanceboxRuntimeRuntime (474) */ type DanceboxRuntimeRuntime = Null; } // declare module diff --git a/typescript-api/src/flashbox/interfaces/augment-api-events.ts b/typescript-api/src/flashbox/interfaces/augment-api-events.ts index 0cb7730b4..61cd8d495 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-events.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-events.ts @@ -350,8 +350,8 @@ declare module "@polkadot/api-base/types/events" { >; CreditsPurchased: AugmentedEvent< ApiType, - [paraId: u32, payer: AccountId32, fee: u128, creditsPurchased: u32, creditsRemaining: u32], - { paraId: u32; payer: AccountId32; fee: u128; creditsPurchased: u32; creditsRemaining: u32 } + [paraId: u32, payer: AccountId32, credit: u128], + { paraId: u32; payer: AccountId32; credit: u128 } >; CreditsSet: AugmentedEvent; /** Generic event */ diff --git a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts index 7ecf49dd8..45e57bfdf 100644 --- a/typescript-api/src/flashbox/interfaces/augment-api-tx.ts +++ b/typescript-api/src/flashbox/interfaces/augment-api-tx.ts @@ -841,10 +841,9 @@ declare module "@polkadot/api-base/types/submittable" { purchaseCredits: AugmentedSubmittable< ( paraId: u32 | AnyNumber | Uint8Array, - credits: u32 | AnyNumber | Uint8Array, - maxPricePerCredit: Option | null | Uint8Array | u128 | AnyNumber + credit: u128 | AnyNumber | Uint8Array ) => SubmittableExtrinsic, - [u32, u32, Option] + [u32, u128] >; /** See [`Pallet::set_credits`]. */ setCredits: AugmentedSubmittable< diff --git a/typescript-api/src/flashbox/interfaces/lookup.ts b/typescript-api/src/flashbox/interfaces/lookup.ts index e49c605e6..69d92c4c8 100644 --- a/typescript-api/src/flashbox/interfaces/lookup.ts +++ b/typescript-api/src/flashbox/interfaces/lookup.ts @@ -478,9 +478,7 @@ export default { CreditsPurchased: { paraId: "u32", payer: "AccountId32", - fee: "u128", - creditsPurchased: "u32", - creditsRemaining: "u32", + credit: "u128", }, CreditBurned: { paraId: "u32", @@ -1240,8 +1238,7 @@ export default { _enum: { purchase_credits: { paraId: "u32", - credits: "u32", - maxPricePerCredit: "Option", + credit: "u128", }, set_credits: { paraId: "u32", @@ -1253,7 +1250,7 @@ export default { }, }, }, - /** Lookup203: pallet_data_preservers::pallet::Call */ + /** Lookup202: pallet_data_preservers::pallet::Call */ PalletDataPreserversCall: { _enum: { set_boot_nodes: { @@ -1262,7 +1259,7 @@ export default { }, }, }, - /** Lookup207: pallet_invulnerables::pallet::Call */ + /** Lookup206: pallet_invulnerables::pallet::Call */ PalletInvulnerablesCall: { _enum: { set_invulnerables: { @@ -1279,7 +1276,7 @@ export default { }, }, }, - /** Lookup208: pallet_session::pallet::Call */ + /** Lookup207: pallet_session::pallet::Call */ PalletSessionCall: { _enum: { set_keys: { @@ -1292,19 +1289,19 @@ export default { purge_keys: "Null", }, }, - /** Lookup209: flashbox_runtime::SessionKeys */ + /** Lookup208: flashbox_runtime::SessionKeys */ FlashboxRuntimeSessionKeys: { nimbus: "NimbusPrimitivesNimbusCryptoPublic", }, - /** Lookup210: nimbus_primitives::nimbus_crypto::Public */ + /** Lookup209: nimbus_primitives::nimbus_crypto::Public */ NimbusPrimitivesNimbusCryptoPublic: "SpCoreSr25519Public", - /** Lookup211: sp_core::sr25519::Public */ + /** Lookup210: sp_core::sr25519::Public */ SpCoreSr25519Public: "[u8;32]", - /** Lookup212: pallet_author_inherent::pallet::Call */ + /** Lookup211: pallet_author_inherent::pallet::Call */ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"], }, - /** Lookup213: pallet_root_testing::pallet::Call */ + /** Lookup212: pallet_root_testing::pallet::Call */ PalletRootTestingCall: { _enum: { fill_block: { @@ -1312,27 +1309,27 @@ export default { }, }, }, - /** Lookup214: pallet_sudo::pallet::Error */ + /** Lookup213: pallet_sudo::pallet::Error */ PalletSudoError: { _enum: ["RequireSudo"], }, - /** Lookup215: pallet_utility::pallet::Error */ + /** Lookup214: pallet_utility::pallet::Error */ PalletUtilityError: { _enum: ["TooManyCalls"], }, - /** Lookup218: pallet_proxy::ProxyDefinition */ + /** Lookup217: pallet_proxy::ProxyDefinition */ PalletProxyProxyDefinition: { delegate: "AccountId32", proxyType: "FlashboxRuntimeProxyType", delay: "u32", }, - /** Lookup222: pallet_proxy::Announcement */ + /** Lookup221: pallet_proxy::Announcement */ PalletProxyAnnouncement: { real: "AccountId32", callHash: "H256", height: "u32", }, - /** Lookup224: pallet_proxy::pallet::Error */ + /** Lookup223: pallet_proxy::pallet::Error */ PalletProxyError: { _enum: [ "TooMany", @@ -1345,41 +1342,41 @@ export default { "NoSelfProxy", ], }, - /** Lookup225: pallet_migrations::pallet::Error */ + /** Lookup224: pallet_migrations::pallet::Error */ PalletMigrationsError: { _enum: ["PreimageMissing", "WrongUpperBound", "PreimageIsTooBig", "PreimageAlreadyExists"], }, - /** Lookup226: pallet_maintenance_mode::pallet::Error */ + /** Lookup225: pallet_maintenance_mode::pallet::Error */ PalletMaintenanceModeError: { _enum: ["AlreadyInMaintenanceMode", "NotInMaintenanceMode"], }, - /** Lookup227: pallet_tx_pause::pallet::Error */ + /** Lookup226: pallet_tx_pause::pallet::Error */ PalletTxPauseError: { _enum: ["IsPaused", "IsUnpaused", "Unpausable", "NotFound"], }, - /** Lookup229: pallet_balances::types::BalanceLock */ + /** Lookup228: pallet_balances::types::BalanceLock */ PalletBalancesBalanceLock: { id: "[u8;8]", amount: "u128", reasons: "PalletBalancesReasons", }, - /** Lookup230: pallet_balances::types::Reasons */ + /** Lookup229: pallet_balances::types::Reasons */ PalletBalancesReasons: { _enum: ["Fee", "Misc", "All"], }, - /** Lookup233: pallet_balances::types::ReserveData */ + /** Lookup232: pallet_balances::types::ReserveData */ PalletBalancesReserveData: { id: "[u8;8]", amount: "u128", }, - /** Lookup237: flashbox_runtime::RuntimeHoldReason */ + /** Lookup236: flashbox_runtime::RuntimeHoldReason */ FlashboxRuntimeRuntimeHoldReason: "Null", - /** Lookup240: pallet_balances::types::IdAmount */ + /** Lookup239: pallet_balances::types::IdAmount */ PalletBalancesIdAmount: { id: "[u8;8]", amount: "u128", }, - /** Lookup242: pallet_balances::pallet::Error */ + /** Lookup241: pallet_balances::pallet::Error */ PalletBalancesError: { _enum: [ "VestingBalance", @@ -1394,18 +1391,18 @@ export default { "TooManyFreezes", ], }, - /** Lookup243: pallet_transaction_payment::Releases */ + /** Lookup242: pallet_transaction_payment::Releases */ PalletTransactionPaymentReleases: { _enum: ["V1Ancient", "V2"], }, - /** Lookup244: pallet_identity::types::Registration> */ + /** Lookup243: pallet_identity::types::Registration> */ PalletIdentityRegistration: { judgements: "Vec<(u32,PalletIdentityJudgement)>", deposit: "u128", info: "PalletIdentitySimpleIdentityInfo", }, /** - * Lookup252: pallet_identity::types::RegistrarInfo */ PalletIdentityRegistrarInfo: { @@ -1413,7 +1410,7 @@ export default { fee: "u128", fields: "PalletIdentityBitFlags", }, - /** Lookup254: pallet_identity::pallet::Error */ + /** Lookup253: pallet_identity::pallet::Error */ PalletIdentityError: { _enum: [ "TooManySubAccounts", @@ -1436,16 +1433,16 @@ export default { "JudgementPaymentFailed", ], }, - /** Lookup259: tp_traits::ParathreadParams */ + /** Lookup258: tp_traits::ParathreadParams */ TpTraitsParathreadParams: { slotFrequency: "TpTraitsSlotFrequency", }, - /** Lookup265: pallet_registrar::pallet::DepositInfo */ + /** Lookup264: pallet_registrar::pallet::DepositInfo */ PalletRegistrarDepositInfo: { creator: "AccountId32", deposit: "u128", }, - /** Lookup266: pallet_registrar::pallet::Error */ + /** Lookup265: pallet_registrar::pallet::Error */ PalletRegistrarError: { _enum: [ "ParaIdAlreadyRegistered", @@ -1460,7 +1457,7 @@ export default { "NotAParathread", ], }, - /** Lookup267: pallet_configuration::HostConfiguration */ + /** Lookup266: pallet_configuration::HostConfiguration */ PalletConfigurationHostConfiguration: { maxCollators: "u32", minOrchestratorCollators: "u32", @@ -1471,21 +1468,21 @@ export default { parathreadsPerCollator: "u32", targetContainerChainFullness: "Perbill", }, - /** Lookup270: pallet_configuration::pallet::Error */ + /** Lookup269: pallet_configuration::pallet::Error */ PalletConfigurationError: { _enum: ["InvalidNewValue"], }, - /** Lookup271: dp_collator_assignment::AssignedCollators */ + /** Lookup270: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsAccountId32: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup276: pallet_author_noting::pallet::ContainerChainBlockInfo */ + /** Lookup275: pallet_author_noting::pallet::ContainerChainBlockInfo */ PalletAuthorNotingContainerChainBlockInfo: { blockNumber: "u32", author: "AccountId32", }, - /** Lookup277: pallet_author_noting::pallet::Error */ + /** Lookup276: pallet_author_noting::pallet::Error */ PalletAuthorNotingError: { _enum: [ "FailedReading", @@ -1497,39 +1494,39 @@ export default { "NonAuraDigest", ], }, - /** Lookup278: dp_collator_assignment::AssignedCollators */ + /** Lookup277: dp_collator_assignment::AssignedCollators */ DpCollatorAssignmentAssignedCollatorsPublic: { orchestratorChain: "Vec", containerChains: "BTreeMap>", }, - /** Lookup283: pallet_services_payment::pallet::Error */ + /** Lookup282: pallet_services_payment::pallet::Error */ PalletServicesPaymentError: { _enum: ["InsufficientFundsToPurchaseCredits", "InsufficientCredits", "CreditPriceTooExpensive"], }, - /** Lookup284: pallet_data_preservers::pallet::Error */ + /** Lookup283: pallet_data_preservers::pallet::Error */ PalletDataPreserversError: { _enum: ["NoBootNodes"], }, - /** Lookup286: pallet_invulnerables::pallet::Error */ + /** Lookup285: pallet_invulnerables::pallet::Error */ PalletInvulnerablesError: { _enum: ["TooManyInvulnerables", "AlreadyInvulnerable", "NotInvulnerable"], }, - /** Lookup291: sp_core::crypto::KeyTypeId */ + /** Lookup290: sp_core::crypto::KeyTypeId */ SpCoreCryptoKeyTypeId: "[u8;4]", - /** Lookup292: pallet_session::pallet::Error */ + /** Lookup291: pallet_session::pallet::Error */ PalletSessionError: { _enum: ["InvalidProof", "NoAssociatedValidatorId", "DuplicatedKey", "NoKeys", "NoAccount"], }, - /** Lookup296: pallet_author_inherent::pallet::Error */ + /** Lookup295: pallet_author_inherent::pallet::Error */ PalletAuthorInherentError: { _enum: ["AuthorAlreadySet", "NoAccountId", "CannotBeAuthor"], }, - /** Lookup297: pallet_inflation_rewards::pallet::ChainsToRewardValue */ + /** Lookup296: pallet_inflation_rewards::pallet::ChainsToRewardValue */ PalletInflationRewardsChainsToRewardValue: { paraIds: "Vec", rewardsPerChain: "u128", }, - /** Lookup302: sp_runtime::MultiSignature */ + /** Lookup301: sp_runtime::MultiSignature */ SpRuntimeMultiSignature: { _enum: { Ed25519: "SpCoreEd25519Signature", @@ -1537,26 +1534,26 @@ export default { Ecdsa: "SpCoreEcdsaSignature", }, }, - /** Lookup303: sp_core::ed25519::Signature */ + /** Lookup302: sp_core::ed25519::Signature */ SpCoreEd25519Signature: "[u8;64]", - /** Lookup305: sp_core::sr25519::Signature */ + /** Lookup304: sp_core::sr25519::Signature */ SpCoreSr25519Signature: "[u8;64]", - /** Lookup306: sp_core::ecdsa::Signature */ + /** Lookup305: sp_core::ecdsa::Signature */ SpCoreEcdsaSignature: "[u8;65]", - /** Lookup309: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ + /** Lookup308: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender */ FrameSystemExtensionsCheckNonZeroSender: "Null", - /** Lookup310: frame_system::extensions::check_spec_version::CheckSpecVersion */ + /** Lookup309: frame_system::extensions::check_spec_version::CheckSpecVersion */ FrameSystemExtensionsCheckSpecVersion: "Null", - /** Lookup311: frame_system::extensions::check_tx_version::CheckTxVersion */ + /** Lookup310: frame_system::extensions::check_tx_version::CheckTxVersion */ FrameSystemExtensionsCheckTxVersion: "Null", - /** Lookup312: frame_system::extensions::check_genesis::CheckGenesis */ + /** Lookup311: frame_system::extensions::check_genesis::CheckGenesis */ FrameSystemExtensionsCheckGenesis: "Null", - /** Lookup315: frame_system::extensions::check_nonce::CheckNonce */ + /** Lookup314: frame_system::extensions::check_nonce::CheckNonce */ FrameSystemExtensionsCheckNonce: "Compact", - /** Lookup316: frame_system::extensions::check_weight::CheckWeight */ + /** Lookup315: frame_system::extensions::check_weight::CheckWeight */ FrameSystemExtensionsCheckWeight: "Null", - /** Lookup317: pallet_transaction_payment::ChargeTransactionPayment */ + /** Lookup316: pallet_transaction_payment::ChargeTransactionPayment */ PalletTransactionPaymentChargeTransactionPayment: "Compact", - /** Lookup318: flashbox_runtime::Runtime */ + /** Lookup317: 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 217fca157..fc327a435 100644 --- a/typescript-api/src/flashbox/interfaces/types-lookup.ts +++ b/typescript-api/src/flashbox/interfaces/types-lookup.ts @@ -710,9 +710,7 @@ declare module "@polkadot/types/lookup" { readonly asCreditsPurchased: { readonly paraId: u32; readonly payer: AccountId32; - readonly fee: u128; - readonly creditsPurchased: u32; - readonly creditsRemaining: u32; + readonly credit: u128; } & Struct; readonly isCreditBurned: boolean; readonly asCreditBurned: { @@ -1606,8 +1604,7 @@ declare module "@polkadot/types/lookup" { readonly isPurchaseCredits: boolean; readonly asPurchaseCredits: { readonly paraId: u32; - readonly credits: u32; - readonly maxPricePerCredit: Option; + readonly credit: u128; } & Struct; readonly isSetCredits: boolean; readonly asSetCredits: { @@ -1622,7 +1619,7 @@ declare module "@polkadot/types/lookup" { readonly type: "PurchaseCredits" | "SetCredits" | "SetGivenFreeCredits"; } - /** @name PalletDataPreserversCall (203) */ + /** @name PalletDataPreserversCall (202) */ interface PalletDataPreserversCall extends Enum { readonly isSetBootNodes: boolean; readonly asSetBootNodes: { @@ -1632,7 +1629,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetBootNodes"; } - /** @name PalletInvulnerablesCall (207) */ + /** @name PalletInvulnerablesCall (206) */ interface PalletInvulnerablesCall extends Enum { readonly isSetInvulnerables: boolean; readonly asSetInvulnerables: { @@ -1649,7 +1646,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetInvulnerables" | "AddInvulnerable" | "RemoveInvulnerable"; } - /** @name PalletSessionCall (208) */ + /** @name PalletSessionCall (207) */ interface PalletSessionCall extends Enum { readonly isSetKeys: boolean; readonly asSetKeys: { @@ -1660,24 +1657,24 @@ declare module "@polkadot/types/lookup" { readonly type: "SetKeys" | "PurgeKeys"; } - /** @name FlashboxRuntimeSessionKeys (209) */ + /** @name FlashboxRuntimeSessionKeys (208) */ interface FlashboxRuntimeSessionKeys extends Struct { readonly nimbus: NimbusPrimitivesNimbusCryptoPublic; } - /** @name NimbusPrimitivesNimbusCryptoPublic (210) */ + /** @name NimbusPrimitivesNimbusCryptoPublic (209) */ interface NimbusPrimitivesNimbusCryptoPublic extends SpCoreSr25519Public {} - /** @name SpCoreSr25519Public (211) */ + /** @name SpCoreSr25519Public (210) */ interface SpCoreSr25519Public extends U8aFixed {} - /** @name PalletAuthorInherentCall (212) */ + /** @name PalletAuthorInherentCall (211) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletRootTestingCall (213) */ + /** @name PalletRootTestingCall (212) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -1686,33 +1683,33 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock"; } - /** @name PalletSudoError (214) */ + /** @name PalletSudoError (213) */ interface PalletSudoError extends Enum { readonly isRequireSudo: boolean; readonly type: "RequireSudo"; } - /** @name PalletUtilityError (215) */ + /** @name PalletUtilityError (214) */ interface PalletUtilityError extends Enum { readonly isTooManyCalls: boolean; readonly type: "TooManyCalls"; } - /** @name PalletProxyProxyDefinition (218) */ + /** @name PalletProxyProxyDefinition (217) */ interface PalletProxyProxyDefinition extends Struct { readonly delegate: AccountId32; readonly proxyType: FlashboxRuntimeProxyType; readonly delay: u32; } - /** @name PalletProxyAnnouncement (222) */ + /** @name PalletProxyAnnouncement (221) */ interface PalletProxyAnnouncement extends Struct { readonly real: AccountId32; readonly callHash: H256; readonly height: u32; } - /** @name PalletProxyError (224) */ + /** @name PalletProxyError (223) */ interface PalletProxyError extends Enum { readonly isTooMany: boolean; readonly isNotFound: boolean; @@ -1733,7 +1730,7 @@ declare module "@polkadot/types/lookup" { | "NoSelfProxy"; } - /** @name PalletMigrationsError (225) */ + /** @name PalletMigrationsError (224) */ interface PalletMigrationsError extends Enum { readonly isPreimageMissing: boolean; readonly isWrongUpperBound: boolean; @@ -1742,14 +1739,14 @@ declare module "@polkadot/types/lookup" { readonly type: "PreimageMissing" | "WrongUpperBound" | "PreimageIsTooBig" | "PreimageAlreadyExists"; } - /** @name PalletMaintenanceModeError (226) */ + /** @name PalletMaintenanceModeError (225) */ interface PalletMaintenanceModeError extends Enum { readonly isAlreadyInMaintenanceMode: boolean; readonly isNotInMaintenanceMode: boolean; readonly type: "AlreadyInMaintenanceMode" | "NotInMaintenanceMode"; } - /** @name PalletTxPauseError (227) */ + /** @name PalletTxPauseError (226) */ interface PalletTxPauseError extends Enum { readonly isIsPaused: boolean; readonly isIsUnpaused: boolean; @@ -1758,14 +1755,14 @@ declare module "@polkadot/types/lookup" { readonly type: "IsPaused" | "IsUnpaused" | "Unpausable" | "NotFound"; } - /** @name PalletBalancesBalanceLock (229) */ + /** @name PalletBalancesBalanceLock (228) */ interface PalletBalancesBalanceLock extends Struct { readonly id: U8aFixed; readonly amount: u128; readonly reasons: PalletBalancesReasons; } - /** @name PalletBalancesReasons (230) */ + /** @name PalletBalancesReasons (229) */ interface PalletBalancesReasons extends Enum { readonly isFee: boolean; readonly isMisc: boolean; @@ -1773,22 +1770,22 @@ declare module "@polkadot/types/lookup" { readonly type: "Fee" | "Misc" | "All"; } - /** @name PalletBalancesReserveData (233) */ + /** @name PalletBalancesReserveData (232) */ interface PalletBalancesReserveData extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name FlashboxRuntimeRuntimeHoldReason (237) */ + /** @name FlashboxRuntimeRuntimeHoldReason (236) */ type FlashboxRuntimeRuntimeHoldReason = Null; - /** @name PalletBalancesIdAmount (240) */ + /** @name PalletBalancesIdAmount (239) */ interface PalletBalancesIdAmount extends Struct { readonly id: U8aFixed; readonly amount: u128; } - /** @name PalletBalancesError (242) */ + /** @name PalletBalancesError (241) */ interface PalletBalancesError extends Enum { readonly isVestingBalance: boolean; readonly isLiquidityRestrictions: boolean; @@ -1813,28 +1810,28 @@ declare module "@polkadot/types/lookup" { | "TooManyFreezes"; } - /** @name PalletTransactionPaymentReleases (243) */ + /** @name PalletTransactionPaymentReleases (242) */ interface PalletTransactionPaymentReleases extends Enum { readonly isV1Ancient: boolean; readonly isV2: boolean; readonly type: "V1Ancient" | "V2"; } - /** @name PalletIdentityRegistration (244) */ + /** @name PalletIdentityRegistration (243) */ interface PalletIdentityRegistration extends Struct { readonly judgements: Vec>; readonly deposit: u128; readonly info: PalletIdentitySimpleIdentityInfo; } - /** @name PalletIdentityRegistrarInfo (252) */ + /** @name PalletIdentityRegistrarInfo (251) */ interface PalletIdentityRegistrarInfo extends Struct { readonly account: AccountId32; readonly fee: u128; readonly fields: PalletIdentityBitFlags; } - /** @name PalletIdentityError (254) */ + /** @name PalletIdentityError (253) */ interface PalletIdentityError extends Enum { readonly isTooManySubAccounts: boolean; readonly isNotFound: boolean; @@ -1875,18 +1872,18 @@ declare module "@polkadot/types/lookup" { | "JudgementPaymentFailed"; } - /** @name TpTraitsParathreadParams (259) */ + /** @name TpTraitsParathreadParams (258) */ interface TpTraitsParathreadParams extends Struct { readonly slotFrequency: TpTraitsSlotFrequency; } - /** @name PalletRegistrarDepositInfo (265) */ + /** @name PalletRegistrarDepositInfo (264) */ interface PalletRegistrarDepositInfo extends Struct { readonly creator: AccountId32; readonly deposit: u128; } - /** @name PalletRegistrarError (266) */ + /** @name PalletRegistrarError (265) */ interface PalletRegistrarError extends Enum { readonly isParaIdAlreadyRegistered: boolean; readonly isParaIdNotRegistered: boolean; @@ -1911,7 +1908,7 @@ declare module "@polkadot/types/lookup" { | "NotAParathread"; } - /** @name PalletConfigurationHostConfiguration (267) */ + /** @name PalletConfigurationHostConfiguration (266) */ interface PalletConfigurationHostConfiguration extends Struct { readonly maxCollators: u32; readonly minOrchestratorCollators: u32; @@ -1923,25 +1920,25 @@ declare module "@polkadot/types/lookup" { readonly targetContainerChainFullness: Perbill; } - /** @name PalletConfigurationError (270) */ + /** @name PalletConfigurationError (269) */ interface PalletConfigurationError extends Enum { readonly isInvalidNewValue: boolean; readonly type: "InvalidNewValue"; } - /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (271) */ + /** @name DpCollatorAssignmentAssignedCollatorsAccountId32 (270) */ interface DpCollatorAssignmentAssignedCollatorsAccountId32 extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletAuthorNotingContainerChainBlockInfo (276) */ + /** @name PalletAuthorNotingContainerChainBlockInfo (275) */ interface PalletAuthorNotingContainerChainBlockInfo extends Struct { readonly blockNumber: u32; readonly author: AccountId32; } - /** @name PalletAuthorNotingError (277) */ + /** @name PalletAuthorNotingError (276) */ interface PalletAuthorNotingError extends Enum { readonly isFailedReading: boolean; readonly isFailedDecodingHeader: boolean; @@ -1960,13 +1957,13 @@ declare module "@polkadot/types/lookup" { | "NonAuraDigest"; } - /** @name DpCollatorAssignmentAssignedCollatorsPublic (278) */ + /** @name DpCollatorAssignmentAssignedCollatorsPublic (277) */ interface DpCollatorAssignmentAssignedCollatorsPublic extends Struct { readonly orchestratorChain: Vec; readonly containerChains: BTreeMap>; } - /** @name PalletServicesPaymentError (283) */ + /** @name PalletServicesPaymentError (282) */ interface PalletServicesPaymentError extends Enum { readonly isInsufficientFundsToPurchaseCredits: boolean; readonly isInsufficientCredits: boolean; @@ -1974,13 +1971,13 @@ declare module "@polkadot/types/lookup" { readonly type: "InsufficientFundsToPurchaseCredits" | "InsufficientCredits" | "CreditPriceTooExpensive"; } - /** @name PalletDataPreserversError (284) */ + /** @name PalletDataPreserversError (283) */ interface PalletDataPreserversError extends Enum { readonly isNoBootNodes: boolean; readonly type: "NoBootNodes"; } - /** @name PalletInvulnerablesError (286) */ + /** @name PalletInvulnerablesError (285) */ interface PalletInvulnerablesError extends Enum { readonly isTooManyInvulnerables: boolean; readonly isAlreadyInvulnerable: boolean; @@ -1988,10 +1985,10 @@ declare module "@polkadot/types/lookup" { readonly type: "TooManyInvulnerables" | "AlreadyInvulnerable" | "NotInvulnerable"; } - /** @name SpCoreCryptoKeyTypeId (291) */ + /** @name SpCoreCryptoKeyTypeId (290) */ interface SpCoreCryptoKeyTypeId extends U8aFixed {} - /** @name PalletSessionError (292) */ + /** @name PalletSessionError (291) */ interface PalletSessionError extends Enum { readonly isInvalidProof: boolean; readonly isNoAssociatedValidatorId: boolean; @@ -2001,7 +1998,7 @@ declare module "@polkadot/types/lookup" { readonly type: "InvalidProof" | "NoAssociatedValidatorId" | "DuplicatedKey" | "NoKeys" | "NoAccount"; } - /** @name PalletAuthorInherentError (296) */ + /** @name PalletAuthorInherentError (295) */ interface PalletAuthorInherentError extends Enum { readonly isAuthorAlreadySet: boolean; readonly isNoAccountId: boolean; @@ -2009,13 +2006,13 @@ declare module "@polkadot/types/lookup" { readonly type: "AuthorAlreadySet" | "NoAccountId" | "CannotBeAuthor"; } - /** @name PalletInflationRewardsChainsToRewardValue (297) */ + /** @name PalletInflationRewardsChainsToRewardValue (296) */ interface PalletInflationRewardsChainsToRewardValue extends Struct { readonly paraIds: Vec; readonly rewardsPerChain: u128; } - /** @name SpRuntimeMultiSignature (302) */ + /** @name SpRuntimeMultiSignature (301) */ interface SpRuntimeMultiSignature extends Enum { readonly isEd25519: boolean; readonly asEd25519: SpCoreEd25519Signature; @@ -2026,36 +2023,36 @@ declare module "@polkadot/types/lookup" { readonly type: "Ed25519" | "Sr25519" | "Ecdsa"; } - /** @name SpCoreEd25519Signature (303) */ + /** @name SpCoreEd25519Signature (302) */ interface SpCoreEd25519Signature extends U8aFixed {} - /** @name SpCoreSr25519Signature (305) */ + /** @name SpCoreSr25519Signature (304) */ interface SpCoreSr25519Signature extends U8aFixed {} - /** @name SpCoreEcdsaSignature (306) */ + /** @name SpCoreEcdsaSignature (305) */ interface SpCoreEcdsaSignature extends U8aFixed {} - /** @name FrameSystemExtensionsCheckNonZeroSender (309) */ + /** @name FrameSystemExtensionsCheckNonZeroSender (308) */ type FrameSystemExtensionsCheckNonZeroSender = Null; - /** @name FrameSystemExtensionsCheckSpecVersion (310) */ + /** @name FrameSystemExtensionsCheckSpecVersion (309) */ type FrameSystemExtensionsCheckSpecVersion = Null; - /** @name FrameSystemExtensionsCheckTxVersion (311) */ + /** @name FrameSystemExtensionsCheckTxVersion (310) */ type FrameSystemExtensionsCheckTxVersion = Null; - /** @name FrameSystemExtensionsCheckGenesis (312) */ + /** @name FrameSystemExtensionsCheckGenesis (311) */ type FrameSystemExtensionsCheckGenesis = Null; - /** @name FrameSystemExtensionsCheckNonce (315) */ + /** @name FrameSystemExtensionsCheckNonce (314) */ interface FrameSystemExtensionsCheckNonce extends Compact {} - /** @name FrameSystemExtensionsCheckWeight (316) */ + /** @name FrameSystemExtensionsCheckWeight (315) */ type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTransactionPaymentChargeTransactionPayment (317) */ + /** @name PalletTransactionPaymentChargeTransactionPayment (316) */ interface PalletTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name FlashboxRuntimeRuntime (318) */ + /** @name FlashboxRuntimeRuntime (317) */ type FlashboxRuntimeRuntime = Null; } // declare module