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] Scheduler Pallet #569

Merged

Conversation

muharem
Copy link
Contributor

@muharem muharem commented Jan 30, 2025

meant to be merged into dev-asset-hub-migration

The migration for the Scheduler pallet from Relay Chain to Asset Hub.

Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

Looks good, just one Q if we need to migrate it in general 😅

pallets/ah-migrator/src/call.rs Show resolved Hide resolved
@@ -267,6 +274,16 @@ pub mod pallet {
count_bad: u32,
},
ReferendaProcessed,
SchedulerMessagesReceived {
Copy link
Member

Choose a reason for hiding this comment

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

I added a generic variant with a PalletName that we can use as to not copy&paste this always for new pallets.

pallets/ah-migrator/src/scheduler.rs Outdated Show resolved Hide resolved
pallets/ah-migrator/src/scheduler.rs Show resolved Hide resolved
pallets/ah-migrator/src/scheduler.rs Show resolved Hide resolved
pallets/ah-migrator/src/scheduler.rs Outdated Show resolved Hide resolved
) -> Result<Option<Self::Key>, Self::Error> {
let mut last_key = last_key.unwrap_or(SchedulerStage::IncompleteSince);
let mut messages = Vec::new();

Copy link
Member

Choose a reason for hiding this comment

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

We also have to go through all pallets on_initialize code and possibly disable it during the migration. Otherwise some pallets may break from partial state being migrated. I will add it as TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I have an idea how to do it for the scheduler

},
SchedulerStage::Agenda(last_key) => {
let mut iter = if let Some(last_key) = last_key {
alias::Agenda::<T>::iter_from_key(last_key)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if you have to call hashed_key_for. Did you try it it migrates all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, I will double check. I used iter_from_key for all other pallets migrations

Copy link
Member

Choose a reason for hiding this comment

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

Yea but it is tricky since it sometimes does still catch a subset. We will see when testing, it could be a likely culprit when entries are missing.

return Err(Error::<T>::FailedToConvertCall);
};

log::info!("MAPPED CALL: {:?}", call);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ups, my debug log

@muharem
Copy link
Contributor Author

muharem commented Jan 31, 2025

Looks good, just one Q if we need to migrate it in general 😅

I thought about it, and I think the simplest is to just migrate it. We might have passed referendums' calls that scheduled to be enacted. Also we have referenda pallet's service calls that already scheduled. We pause the scheduler for the time of migration and those overdue call would just be dispatched when migration ends. Otherwise we need some custom logic for these calls. The presented approach seems to be the simplest to me.

muharem and others added 3 commits January 31, 2025 12:36
@muharem muharem marked this pull request as ready for review January 31, 2025 05:02
@ggwpez
Copy link
Member

ggwpez commented Jan 31, 2025

The presented approach seems to be the simplest to me.

Yea sounds good.

@ggwpez ggwpez merged commit 74e3980 into polkadot-fellows:dev-asset-hub-migration Jan 31, 2025
28 of 53 checks passed
@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.

2 participants