Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

configuration: optionally read pending configs in migration #7489

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

slumber
Copy link
Contributor

@slumber slumber commented Jul 11, 2023

Follows up #7396

CI was failing because of warning caused in migration. The warning is coming from defensive_proof call on optional value of PendingConfigs, which is actually allowed to be None. My bad for blindly copying code from #6271.

@slumber slumber added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. E0-runtime_migration PR introduces code that might require downstream chains to run a runtime upgrade. labels Jul 11, 2023
@slumber
Copy link
Contributor Author

slumber commented Jul 11, 2023

Despite the fact that the warning is gone, there's still Corrupted state ....

@slumber
Copy link
Contributor Author

slumber commented Jul 11, 2023

Reasoning behind failing CI:

https://github.com/paritytech/polkadot/blob/master/runtime/parachains/src/configuration/migration_ump.rs
This migration schedules config upgrade for a set of values, without altering the struct.

Note that this migration does it based on current code of host config, the one we're supposed to have after applying new (v7) migration.

It adds another item to PendingConfigs, of version 7, when trying to upgrade it from v6 to v7 we fail with "Corrupted state".

Why is this harmless?

We can't skip this migration based on pallet storage version, it's supposed to be applied for v6, the same way my config migration is supposed to be applied for v6.
UMP migration is already part of release, and it's not guarded against being re-executed. However, since we fail to read pending config upgrades, ump migration will be discarded with execution of v7 (we failed to read it).
Assuming it was previously applied, this is ok.

Solution?

Linked migration was supposed to bump storage version (unfortunately it didn't). Then we could guard against re-executing it, thus mitigating read-error. However, altering migration that was already applied sounds bad to me, even though it could work in theory.

So unless V0943 migrations get dropped, only option is to ignore this warning.

@ordian
Copy link
Member

ordian commented Jul 11, 2023

Assuming it was previously applied, this is ok.

UMP migration was not applied on Polkadot yet:

pub const MAX_UPWARD_QUEUE_SIZE: u32 = 1 * 1024 * 1024;
pub const MAX_UPWARD_QUEUE_COUNT: u32 = 174762;
pub const MAX_UPWARD_MESSAGE_SIZE: u32 = (1 << 16) - 5; // Checked in test `max_upward_message_size`.
pub const MAX_UPWARD_MESSAGE_NUM_PER_CANDIDATE: u32 = 16;

Screenshot from 2023-07-11 17-46-22

But it probably will be by the time v7 hits the runtime.

@ggwpez
Copy link
Member

ggwpez commented Jul 11, 2023

Polkadot should upgrade to .43 in 16 days or so?
So you can probably already remove the .43 migrations (and older) to fix this. I have to admit that this UmpLimits "migration" was very hacky, but the limits needed to be bumped synchronously with the runtime upgrade for security reasons...

@ordian
Copy link
Member

ordian commented Jul 11, 2023

Why are runtime migration checks are failing btw? Is that expected? I don't see them failing on other PRs.

@slumber
Copy link
Contributor Author

slumber commented Jul 11, 2023

Polkadot should upgrade to .43 in 16 days or so? So you can probably already remove the .43 migrations (and older) to fix this. I have to admit that this UmpLimits "migration" was very hacky, but the limits needed to be bumped synchronously with the runtime upgrade for security reasons...

We can do this in a follow-up to address the warning.

@slumber
Copy link
Contributor Author

slumber commented Jul 11, 2023

Why are runtime migration checks are failing btw? Is that expected? I don't see them failing on other PRs.

#7489 (comment) is exact explanation. I've merged config migration very recently so there're no PRs built on top of it

@ggwpez
Copy link
Member

ggwpez commented Jul 11, 2023

We can do this in a follow-up to address the warning.

Then we have to ensure that this does not get into a release. I am not sure if the runtime 1.0.0 release is already branched off.

@slumber
Copy link
Contributor Author

slumber commented Jul 11, 2023

We can do this in a follow-up to address the warning.

Then we have to ensure that this does not get into a release. I am not sure if the runtime 1.0.0 release is already branched off.

It's safe to be released as long as we drop earlier migrations? I meant that this PR addresses unrelated thing and don't want to include these changes here.

@ordian
Copy link
Member

ordian commented Jul 12, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit e13d10c into master Jul 12, 2023
@paritytech-processbot paritytech-processbot bot deleted the slumber-migration-warning branch July 12, 2023 09:22
@ordian
Copy link
Member

ordian commented Jul 12, 2023

Polkadot should upgrade to .43 in 16 days or so? So you can probably already remove the .43 migrations (and older) to fix this. I have to admit that this UmpLimits "migration" was very hacky, but the limits needed to be bumped synchronously with the runtime upgrade for security reasons...

We can do this in a follow-up to address the warning.

Please do.

Why are runtime migration checks are failing btw? Is that expected? I don't see them failing on other PRs.

#7489 (comment) is exact explanation. I've merged config migration very recently so there're no PRs built on top of it

Yeah, sorry, I misinterpreted the explanation to be for the previous PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. E0-runtime_migration PR introduces code that might require downstream chains to run a runtime upgrade.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants