-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix: make downgrade verification work again #13936
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.
I provided the supplement comments.
// 2. If the plan is not ready. | ||
// 3. If the plan is ready and skip upgrade height is set for current height. | ||
if !found || !plan.ShouldExecute(ctx) || (plan.ShouldExecute(ctx) && k.IsSkipHeight(ctx.BlockHeight())) { | ||
lastAppliedPlan, _ := k.GetLastCompletedUpgrade(ctx) |
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.
Now GetLastCompletedUpgrade()
is inside of the if !found... block.
} | ||
} | ||
} | ||
|
||
if !found { | ||
return |
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.
The function returns here, where no upgrade plan is on the chain.
Can we add a test case? |
Of course, we can. I added the corresponding unit test. One can check whether the test works as expected:
|
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.
Thank you!
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.
cool, lgtm
(cherry picked from commit b585d17) # Conflicts: # CHANGELOG.md
Description
In the current
BeginBlocker()
of x/upgrade, the downgrade verification logic would not work when no upgrade plan is on the state. It's because theif !found
check is in front of the validation, and if it is, the function returns.This patch would relocate the logic to the front again, but there is little difference from the previous logic. The
GetLastCompletedUpgrade()
is now only invoked where the migration would not needed, so it would not cause the issue #12904 to recur.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change