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] Nomination pools #562

Merged
merged 17 commits into from
Jan 28, 2025
Merged

[AHM] Nomination pools #562

merged 17 commits into from
Jan 28, 2025

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Jan 27, 2025

To be merged into the AHM working branch.

Pallet Nomination Pools

The nomination pools pallet has 15 storage items of which 14 can be migrated without any translation.

Storage Values

All nine storage values are migrated as is in a single message.

Storage Maps

The BondedPools map needs translation for its commission logic. The Commission struct contains an absolute relay timestamp throttle_from and the commission change min_delay.
The translation for both happens upon arrival on the Asset Hub. Ideally, it would be done on the Relay chain side since we have more compute power there but it is not possible since the timestamp translation depends on the Relay number upon arrival on Asset Hub.

The timestamp is translated in rc_to_ah_timestamp and the min_delay is directly passed to RcToAhDelay.

The other five storage maps are migrated as it.

User Impact

Impact here is negligible and only for pool operators - not members:

  • Pool commission change rate (measured in blocks) could be decreased by one block.

  • Pool operators may be able to change the commission rate one block later than anticipated. This is due to the nature or translating blocks of two different blockchains which does not yield unambiguous results.

  • Does not require a CHANGELOG entry

ggwpez added 11 commits January 24, 2025 13:31
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]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez marked this pull request as ready for review January 27, 2025 20:34
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]>
# Storage Maps

The `BondedPools` map needs translation for its commission logic. The Commission struct contains an
absolute relay timestamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible to rework this to continue using the RcBlockNumberProvider as a clock? Is it just because this hasn't been completed yet or is there a reason not to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont see an open MR to do it, so I assume that it will be done in the future. Generally yes, it can very well use the relay block number (and should). We just work off the state of the SDK that we have for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I'll get somebody on it. For these ones which haven't been completed yet but which are intended, I think you can write the migration and keep the number as is, but make a note and we can come back to it if it looks like the pallet won't be ready in time. Might save you a bit of time for these pallets where the mapping introduces some extra work

@@ -30,8 +30,9 @@ 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
- Existing proxies on Asset Hub will now have more permissions and will be able to access the new pallets as well. For example, the `NonTransfer` proxy will also be able to use nomination pools. This may affect security assumptions of previously created proxies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be we rename NoTransfer? and we do not include new pallets under it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about something like NoTransferLegacy or so that is the same as on the Relay and then the normal NoTransfer (No or Non i dont mind).
Then we could translate the proxies in the exact same way and not increase their scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with a good documentation I think it will be good enough.

pallets/rc-migrator/src/lib.rs Show resolved Hide resolved
@@ -216,6 +222,18 @@ pub mod pallet {
/// How many preimage legacy status failed to integrate.
count_bad: u32,
},
/// Received a batch of `RcNomPoolsMessage` that we are going to integrate.
NomPoolsMessagesBatchReceived {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we getting more and more of these identical events. we probably also need similar on rc-migrator side. what if we create some general even with a pallet name as a fixed size string? not sure how convenient that would be.

Copy link
Member Author

@ggwpez ggwpez Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea we could create a new enum that is called like PalletName or so and then use that inside. Just string is not enough because the front-end wont know the variants.

let mut messages = Vec::new();

loop {
if weight_counter.try_consume(Weight::from_all(1)).is_err() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the rc weight counter we can just count for db operations here + transport

/// - AH now: 75
/// - RC time point: 150
/// - Result: 75 + (150 - 100) / 2 = 100
pub fn rc_to_ah_timepoint(rc_timepoint: BlockNumberFor<T>) -> BlockNumberFor<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for all real time sensitive timepoints I am gonna leave RC as a block provider and do not do the mapping. If it just for servicing, my plan is to keep the system block provider.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nom pools pallet is not migrated to RC number provider yet, otherwise i would also prefer that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is in the list, so yes we did plan it
paritytech/polkadot-sdk#6297

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to have it. But turning off the translation here is a two line change so am not too concerned about it.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez merged commit 5feaca0 into dev-asset-hub-migration Jan 28, 2025
24 of 47 checks passed
@ggwpez ggwpez deleted the oty-nom-pools branch January 28, 2025 18:05
@ggwpez ggwpez mentioned this pull request Jan 29, 2025
64 tasks
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.

3 participants