Fix parachain upgrade scheduling when done by the owner/root#3341
Merged
Fix parachain upgrade scheduling when done by the owner/root#3341
Conversation
When using `schedule_code_upgrade` to change the code of a parachain in the relay chain runtime, we had already fixed to not set the `GoAhead` signal. This was done to not brick any parachain after the upgrade, because they were seeing the signal without having any upgrade prepared. The remaining problem is that the parachain code is only upgraded after a parachain header was enacted, aka the parachain made some progress. However, this is quite complicated if the parachain is bricked (which is the most common scenario why to manually schedule a code upgrade). Thus, this pull request replaces `SetGoAhead` with `EnactUpgradeDirectly` to signal to the logic that we don't want to set the go ahead signal and that we want to replace the current parachain code directly without waiting for some progress of the parachain.
bkchr
commented
Feb 15, 2024
eskimor
reviewed
Feb 15, 2024
eskimor
approved these changes
Mar 27, 2024
| // be validated against the new validation code. | ||
| // | ||
| // Here we are trying to choose the block number that will have | ||
| // `validation_upgrade_delay` blocks from the relay-parent of inclusion of the the block |
Member
There was a problem hiding this comment.
Nit: Why is this not a match? Would be a tad more future proof in case someone introduces more variants.
sandreim
reviewed
Apr 1, 2024
| weight += T::DbWeight::get().reads_writes(1, 4); | ||
| FutureCodeUpgrades::<T>::insert(&id, expected_at); | ||
| match upgrade_strategy { | ||
| UpgradeStrategy::SetGoAheadSignal => { |
Contributor
There was a problem hiding this comment.
This match arm here seems to be doing what needs to be done for UpgradeStrategy::ApplyAtExpectedBlock.
Member
Author
There was a problem hiding this comment.
LOL. I'm an idiot. Broken it with one of the last commits.
sandreim
approved these changes
Apr 2, 2024
Ank4n
pushed a commit
that referenced
this pull request
Apr 9, 2024
When using `schedule_code_upgrade` to change the code of a parachain in the relay chain runtime, we had already fixed to not set the `GoAhead` signal. This was done to not brick any parachain after the upgrade, because they were seeing the signal without having any upgrade prepared. The remaining problem is that the parachain code is only upgraded after a parachain header was enacted, aka the parachain made some progress. However, this is quite complicated if the parachain is bricked (which is the most common scenario why to manually schedule a code upgrade). Thus, this pull request replaces `SetGoAhead` with `UpgradeStrategy` to signal to the logic kind of strategy want to use. The strategies are either `SetGoAheadSignal` or `ApplyAtExpectedBlock`. `SetGoAheadSignal` sets the go ahead signal as before and awaits a parachain block. `ApplyAtExpectedBlock` schedules the upgrade and applies it directly at the `expected_block` without waiting for the parachain to make any kind of progress.
dharjeezy
pushed a commit
to dharjeezy/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
…ech#3341) When using `schedule_code_upgrade` to change the code of a parachain in the relay chain runtime, we had already fixed to not set the `GoAhead` signal. This was done to not brick any parachain after the upgrade, because they were seeing the signal without having any upgrade prepared. The remaining problem is that the parachain code is only upgraded after a parachain header was enacted, aka the parachain made some progress. However, this is quite complicated if the parachain is bricked (which is the most common scenario why to manually schedule a code upgrade). Thus, this pull request replaces `SetGoAhead` with `UpgradeStrategy` to signal to the logic kind of strategy want to use. The strategies are either `SetGoAheadSignal` or `ApplyAtExpectedBlock`. `SetGoAheadSignal` sets the go ahead signal as before and awaits a parachain block. `ApplyAtExpectedBlock` schedules the upgrade and applies it directly at the `expected_block` without waiting for the parachain to make any kind of progress.
This was referenced Jun 5, 2024
This was referenced Jun 5, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
schedule_code_upgradeto change the code of a parachain in the relay chain runtime, we had already fixed to not set theGoAheadsignal. This was done to not brick any parachain after the upgrade, because they were seeing the signal without having any upgrade prepared. The remaining problem is that the parachain code is only upgraded after a parachain header was enacted, aka the parachain made some progress. However, this is quite complicated if the parachain is bricked (which is the most common scenario why to manually schedule a code upgrade). Thus, this pull request replacesSetGoAheadwithUpgradeStrategyto signal to the logic kind of strategy want to use. The strategies are eitherSetGoAheadSignalorApplyAtExpectedBlock.SetGoAheadSignalsets the go ahead signal as before and awaits a parachain block.ApplyAtExpectedBlockschedules the upgrade and applies it directly at theexpected_blockwithout waiting for the parachain to make any kind of progress.