-
Notifications
You must be signed in to change notification settings - Fork 112
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
[AHM] Sovereign Account Translation #594
Conversation
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]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
pallets/rc-migrator/src/accounts.rs
Outdated
/// - `Ok(None)` if the account is not a Parachain sovereign account | ||
/// - `Ok(Some((ah_account, para_id)))` with the translated account and the para id | ||
/// - `Err(())` otherwise | ||
pub fn try_translate_rc_sovereign_to_ah(acc: T::AccountId) -> Result<Option<(T::AccountId, u16)>, ()> { |
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 is the important function
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.
looks good so far! afaict still needs:
- equivalent function for translating derived SA (given a derivation path param)
- hooking this to the migration - do you plan to test every address if it is derived or use some static list of accounts that should go through this translation? I am guessing the latter.
We wanted to generate this list as first step of the migration - automatically on-chain.
Yes, I did not look into accounts that are derived from SAs. Going to do that in the next MR. |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
To be merged into the AHM working branch. Quote from
accounts.md
:Account Migration
Accounts are migrated with all their balance, locks and reserves at the beginning of the Asset Hub
migration.
User Impact
Users need to be aware that all of their funds will be moved from the Relay chain to the Asset Hub.
The Account ID will stay the same. This ensures that normal user accounts will be to control their
funds on Asset Hub.
Sovereign Account Translation
For parachain sovereign accounts, it is not possible to just use the same account ID. The sovereign
account address of a parachain is calculated differently, depending on whether it is the account on
the Relay or a parachain (like Asset Hub).
There are different kinds of sovereign accounts. In this context, we only focus on these parachain
sovereign accounts:
"para" ++ para_id ++ 00..
"sibl" ++ para_id ++ 00..
Our translation logic inverts the derivation and changes the prefix from
"para"
to"sibl"
forall accounts that match the pattern
"para" ++ para_id ++ 00..
. The full list of translatedaccounts is in this CSV file.
It is advised that parachains check that they can control their account on Asset Hub. They can also
forego this check if they do not need control thereof - for example when they are not holding any
funds on their relay sovereign account. However, please note that someone could still send funds to
that address before or after the migration.
Example for Bifrost: this is the relay sovereign account and it gets translated to this sibling sovereign account.