Skip to content
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] Proxy migration #542

Merged
merged 2 commits into from
Jan 14, 2025
Merged

[AHM] Proxy migration #542

merged 2 commits into from
Jan 14, 2025

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Jan 13, 2025

👉 To be merged into the AHM dev branch.

quote from the proxy.md doc:

Pallet Proxy

The proxy pallet consists of two storage variables.

Storage: Proxies

The Proxies storage map maps a delegator to its delegates. It can be translated one-to-one by mapping the ProxyType and Delay fields.

Proxy Type Translation

The different kinds that are possible for a proxy are a runtime injected type. Since these are different for each runtime, we need a converter that maps the Relay to AH ProxyType as close as possible to keep the original intention. The Relay kind is defined here and the AH version here. This is done by injecting a RcToProxyType converter into the Asset Hub migration pallet. This is not bullet proof since it relies on some copy&paste code instead of pulling in the Polkadot runtime into the AH runtime but it is the simplest solution.

Mapping from Relay to AH looks as follows:

  • Any: same
  • NonTransfer: same
  • Governance: newly added
  • Staking: newly added
  • Variant 4: ignore as it is a historic remnant
  • Variant 5: ignore ditto
  • CancelProxy: same
  • Auction: dropped
  • NominationPools: newly added

All variants that serve no purpose anymore on the Relay Chain are deleted from there. For example Staking. The ones that are still usable on the relay like NonTransfer are also deleted since there is no storage deposit taken anymore. (TODO think about what is best here)

Translation of the Delay

The delay of a ProxyDefinition is measured in blocks. These are currently 6 seconds Relay blocks. To translate them to 12s AH blocks, we can divide the number by two.

Storage: Announcements

The Announcements storage maps proxy account IDs to Accouncement. Since an announcement contains a call hash, we cannot translate them for the same reason as with the Multisigs; the preimage of the hash would be either undecodable, decode to something else (security issue) or accidentally decode to the same thing.

We therefore do not migrate the announcements.

User Impact

  • Announcements need to be re-created

  • Proxies of type Auction are not migrated and need to be re-created on the Relay

  • Does not require a CHANGELOG entry

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez force-pushed the oty-ahm-migrations branch from 05f739b to b75f4b7 Compare January 13, 2025 19:19
@bkchr
Copy link
Contributor

bkchr commented Jan 13, 2025

The delay of a ProxyDefinition is measured in blocks. These are currently 6 seconds Relay blocks. To translate them to 12s AH blocks, we can divide the number by two.

We should translate the existing proxies to the relay chain and not the other way around.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez
Copy link
Member Author

ggwpez commented Jan 13, 2025

We should translate the existing proxies to the relay chain and not the other way around.

WDYM? We want to remove everything from the Relay chain as much as possible. Including proxies and balances - if possible.

@bkchr
Copy link
Contributor

bkchr commented Jan 14, 2025

WDYM? We want to remove everything from the Relay chain as much as possible. Including proxies and balances - if possible.

I expressed myself badly. When we upgrade to the SDK release that includes BlockNumberProvider, we should switch to RelayChainBlockNumber as provider. Then we migrate all the existing proxies on AH to the relay chain block number. Later when you do the migration, you only need to migrate the data from the relay chain to AH without touching the delay field.

@ggwpez
Copy link
Member Author

ggwpez commented Jan 14, 2025

I expressed myself badly. When we upgrade to the SDK release that includes BlockNumberProvider, we should switch to RelayChainBlockNumber as provider. Then we migrate all the existing proxies on AH to the relay chain block number. Later when you do the migration, you only need to migrate the data from the relay chain to AH without touching the delay field.

Yea sounds good. Will do once we have it in the SDK and upgraded to it. The change should be rather small from what is now being added.

@ggwpez ggwpez merged commit 9a66f94 into dev-asset-hub-migration Jan 14, 2025
45 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants