Skip to content
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

Allow minor releases before the block height #320

Merged
merged 12 commits into from
Oct 4, 2023

Conversation

stevenlanders
Copy link
Contributor

@stevenlanders stevenlanders commented Sep 28, 2023

Describe your changes and provide context

  • If a pending minor release is running and it's before the block height, apply the upgrade
  • If a pending release has been applied and before the block height, don't panic
  • If a release is past the block height, regardless of type, panic

One can pass an upgradeType to info as follows

seid tx gov submit-proposal software-upgrade ... --upgrade-info '{"upgradeType":"minor"}'

Testing performed to validate your change

  • Unit Tests
  • Local Testing:
    • Passed minor upgrade proposal in future block, and verified I could upgrade before that block
    • Passed minor upgrade proposal in future block, and verified it panics if not upgraded at that block
    • Passed major upgrade proposal in future block, and verified I could NOT upgrade before that block
    • Skip height continues to work for major and minor releases (a skip-height applies to the deadline block for minor)

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #320 (73b405d) into main (2066dbf) will increase coverage by 0.02%.
The diff coverage is 90.38%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #320      +/-   ##
==========================================
+ Coverage   55.38%   55.40%   +0.02%     
==========================================
  Files         620      620              
  Lines       51639    51669      +30     
==========================================
+ Hits        28598    28626      +28     
- Misses      20959    20960       +1     
- Partials     2082     2083       +1     
Files Coverage Δ
x/upgrade/keeper/keeper.go 83.52% <ø> (ø)
x/upgrade/types/plan.go 97.43% <100.00%> (+1.13%) ⬆️
x/upgrade/abci.go 91.02% <87.50%> (-2.31%) ⬇️

... and 1 file with indirect coverage changes

@stevenlanders stevenlanders changed the title Allow minor releases before the block height (WIP) Allow minor releases before the block height Sep 29, 2023
x/upgrade/abci.go Outdated Show resolved Hide resolved
x/upgrade/types/plan.go Show resolved Hide resolved
if !k.HasHandler(plan.Name) {
panicUpgradeNeeded(k, ctx, plan)
}
applyUpgrade(k, ctx, plan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the other discussion we were doing, if the upgrade plan gets cleared after applying upgrade, wouldnt this cause issue for generating apphash since it does affect the stored state?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial thought was that the upgrade action was stateless since registered plans stay registered, but if we specifically clear stuff out upon running upgrades, this may cause issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - I updated with the new logic (see next commit)

panicUpgradeNeeded(k, ctx, plan)
}
applyUpgrade(k, ctx, plan)
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a node is behind, and it sees the current scheduled plan being a minor version (e.g. 1.3.0->1.3.1) but there is a "future" (future only to that node; it is already the current scheduled plan for up-to-date nodes) major version (e.g. 1.3.1->2.0.0), and it uses the 2.0.0 binary, then it would only panic once it passes the 1.3.1 upgrade height, which might result in bad data being written because of changes in 2.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed in thread, but for other's purposes, we determined that this scenario and logic exists today and are electing to focus on the minimum change to allow the minor releases at the moment.

Comment on lines +61 to 62
skipUpgrade(k, ctx, plan)
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: combine into
return skipUpgrade(k, ctx, plan)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be cool, but this isn't yet legal golang :)

func (p Plan) UpgradeDetails() UpgradeDetails {
var details UpgradeDetails
if err := json.Unmarshal([]byte(p.Info), &details); err != nil {
// invalid json, assume no upgrade details
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an error log here for failed to unmarshal upgrade info so that we know something bad is happening??

@stevenlanders
Copy link
Contributor Author

FYI - leaving this open until integration-tests work on sei-chain

@stevenlanders stevenlanders merged commit b64945e into main Oct 4, 2023
15 checks passed
@stevenlanders stevenlanders deleted the allow-minor-releases-ahead-of-block-height branch October 4, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants