• Bastian Köcher's avatar
    Fix parachain upgrade scheduling when done by the owner/root (#3341) · 12eb285d
    Bastian Köcher authored
    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.
    12eb285d