-
Notifications
You must be signed in to change notification settings - Fork 110
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
[AHM] Scheduler Pallet #569
Conversation
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, just one Q if we need to migrate it in general 😅
@@ -267,6 +274,16 @@ pub mod pallet { | |||
count_bad: u32, | |||
}, | |||
ReferendaProcessed, | |||
SchedulerMessagesReceived { |
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 added a generic variant with a PalletName
that we can use as to not copy&paste this always for new pallets.
) -> Result<Option<Self::Key>, Self::Error> { | ||
let mut last_key = last_key.unwrap_or(SchedulerStage::IncompleteSince); | ||
let mut messages = Vec::new(); | ||
|
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 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
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.
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) |
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.
Not sure if you have to call hashed_key_for
. Did you try it it migrates all?
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 think so, I will double check. I used iter_from_key
for all other pallets migrations
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.
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.
pallets/ah-migrator/src/call.rs
Outdated
return Err(Error::<T>::FailedToConvertCall); | ||
}; | ||
|
||
log::info!("MAPPED CALL: {:?}", call); |
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.
ups, my debug log
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. |
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Yea sounds good. |
74e3980
into
polkadot-fellows:dev-asset-hub-migration
meant to be merged into
dev-asset-hub-migration
The migration for the Scheduler pallet from Relay Chain to Asset Hub.