-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conversation
Looks like the best thing to do here is to migrate some of the crowdloan code to not depend on the |
* update fund account to use index * fix integration tests * Update runtime/common/src/crowdloan.rs
@@ -271,31 +274,52 @@ pub mod pallet { | |||
pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult { | |||
Self::ensure_root_para_or_owner(origin, id)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will basically need to be called by Root unless we write specific logic around the owner of the same parachain id being able to do a swap even when the parachain is "locked".
trie_index: TrieIndex, | ||
pub last_period: LeasePeriod, | ||
/// Unique index used to represent this fund. | ||
pub fund_index: FundIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should not require a migration since the encoding is exactly the same as before.
#[pallet::getter(fn next_trie_index)] | ||
pub(super) type NextTrieIndex<T> = StorageValue<_, u32, ValueQuery>; | ||
#[pallet::getter(fn next_fund_index)] | ||
pub(super) type NextFundIndex<T> = StorageValue<_, u32, ValueQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be covered by the migration I have written.
Sans the irregularities with the try-runtime logging we discussed offline, this looks good to me EDIT: logging irregularities seem to be a non-issue, seems to have just been a human error. |
Thanks for this alteration, LGTM. |
@@ -564,6 +576,15 @@ impl<T: Config> Pallet<T> { | |||
|
|||
Ok((ParaGenesisArgs { genesis_head, validation_code, parachain }, deposit)) | |||
} | |||
|
|||
/// Swap a parachain and parathread, which involves scheduling an appropriate lifecycle update. | |||
fn do_thread_and_chain_swap(to_downgrade: ParaId, to_upgrade: ParaId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look over the tests very deeply but the swapping and migration logic looks OK.
bot merge |
* master: (27 commits) Bump `tokio` to 1.17.0 (#4965) bump transaction_version (#4956) Bump tracing-subscriber from 0.3.8 to 0.3.9 (#4954) staking miner: reuse ws conn for remote-ext (#4849) Revert "collator-protocol: short-term fixes for connectivity (#4640)" (#4914) Bump tracing from 0.1.30 to 0.1.31 (#4941) Better spam slots handling (#4845) Bump proc-macro-crate from 1.1.0 to 1.1.2 (#4936) corrected paras code validation event comments (#4932) Companion for refactor election score #10834 (#4927) Companion CI: Make sure to pass the update crates properly (#4928) update digest to v0.10.2 (#4907) Companion for #10832 (#4918) Companion for `Remove u32_trait` (#4920) Bump serde_json from 1.0.78 to 1.0.79 (#4916) Bump rand from 0.8.4 to 0.8.5 (#4917) Remove stale migrations post 9.16 release (#4848) Add proxy type for Kappa Sigma Mu (#4851) Baseline weights for `force_apply_min_commission` (#4896) Allow two Parachains to swap (#4772) ...
This PR polishes the
swap
function available in theparas_registrar
.Specifically, we add the ability for two parachains to swap their slots, in addition to allowing a parachain and a parathread to swap.
To better support this functionality, this PR changes the way that crowdloan accounts are generated. Rather than use the
ParaId
which would be clunky to swap, we use thefund_index
which is unique per crowdloan, and would require no underlying swap.A migration was included to adopt this change in the runtime.
Additional tests were added to verify this functionality, and it will been enabled in Kusama and Polkadot.
paritytech/polkadot-sdk#877