-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relay Chain Accounts to Asset Hub Migration #515
Relay Chain Accounts to Asset Hub Migration #515
Conversation
/// | ||
/// Since the `reserved` and `frozen` balances will be known on a receiving side (AH) they will | ||
/// be calculated there. | ||
pub fn get_consumer_count(_who: &T::AccountId, _info: &AccountInfoFor<T>) -> u8 { |
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.
pub fn get_consumer_count(_who: &T::AccountId, _info: &AccountInfoFor<T>) -> u8 { | |
pub fn count_consumers(_who: &T::AccountId, _info: &AccountInfoFor<T>) -> u8 { |
So you want to query every pallet on how many refs it expects?
This can probably be worked on in parallel.
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.
LGTM going to prepare a dev branch for AHM.
// `Self::get_consumer_count` and `Self::get_provider_count` functions. | ||
SystemAccount::<T>::mutate(&who, |a| { | ||
a.consumers = 0; | ||
a.providers = 1; |
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.
We could place a flag on the account that it was migrated. Not sure if its needed, but then we would know which accounts got moved, which stayed and which got created after the migration.
pub fn migrate_accounts( | ||
maybe_last_key: Option<T::AccountId>, | ||
weight_counter: &mut WeightMeter, | ||
) -> Result<Option<Option<T::AccountId>>, ()> { |
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.
Why a double option?
/// Migrating account balances. | ||
MigratingAccounts { | ||
// Last migrated account | ||
last_key: Option<AccountId>, |
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.
Does None
mean that it is done or that it is not yet started?
last_key: Option<AccountId>, | ||
}, | ||
/// Some next stage | ||
TODO, |
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 guess it would go through each pallet here?
with_transaction_opaque_err::<Option<Option<T::AccountId>>, (), _>(|| { | ||
match Self::migrate_accounts(last_key, &mut weight_counter) { | ||
Ok(ok) => TransactionOutcome::Commit(Ok(ok)), | ||
Err(err) => TransactionOutcome::Commit(Err(err)), |
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.
Could also roll back and try with a smaller batch size next block.
return weight_counter.consumed(); | ||
} | ||
|
||
// TODO init |
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.
Note to self: This is probably where development should continue.
Yes going to do this. Comments can be address async. |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
fd8d0c2
into
polkadot-fellows:dev-asset-hub-migration
This PR is not intended to be merged into the master branch but into a dedicated Asset Hub migration working branch. Please create such a branch if you have the necessary permissions and change the base for this PR.
The PR introduces two pallets designed for the Asset Hub migration, Relay Chain migrator (rc-migrator) and Asset Hub migrator (ah-migrator). Please refer to the code base for more docs.
Currently, these pallets handle only the migration of Relay Chain accounts. They are intended to support the migration of all migrating pallets and act as managers for the overall migration process.
It might be helpful to merge this PR into the dev branch to use this initial setup as a base for further development.
[x] Does not require a CHANGELOG entry