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

Fix upgrade store loader #7817

Merged
merged 6 commits into from
Nov 13, 2020
Merged

Fix upgrade store loader #7817

merged 6 commits into from
Nov 13, 2020

Conversation

chengwenxi
Copy link
Contributor

@chengwenxi chengwenxi commented Nov 5, 2020

Description

The rootmultiStore.lastCommitInfo is empty if it has not been loaded yet, so the rootmultiStore.LastCommitID().version is 0, storeUpgrades will be executed only when upgradeHeight == 0.

If the latest version is returned when rootmultiStore is not loaded, it works.

closes: #6346


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov
Copy link

codecov bot commented Nov 5, 2020

Codecov Report

Merging #7817 (14efd19) into master (0b1a3ee) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master    #7817      +/-   ##
==========================================
- Coverage   54.17%   54.17%   -0.01%     
==========================================
  Files         612      612              
  Lines       38999    39000       +1     
==========================================
  Hits        21129    21129              
- Misses      15697    15698       +1     
  Partials     2173     2173              

@@ -10,9 +10,9 @@ import (
// pattern. This is useful for custom upgrade loading logic.
func UpgradeStoreLoader(upgradeHeight int64, storeUpgrades *store.StoreUpgrades) baseapp.StoreLoader {
return func(ms sdk.CommitMultiStore) error {
if upgradeHeight == ms.LastCommitID().Version {
if upgradeHeight == ms.LastCommitID().Version+1 {
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 stop the node process on beginblock(upgradeHeight), the block is not commited, so it should be LastCommitID().Version+1.

@ethanfrey
Copy link
Contributor

There was a very similar pr for launchpad, was that not also on master?

If this is needed in addition to the launchpad fix, please backport this to the launchpad branch

@chengwenxi
Copy link
Contributor Author

There was a very similar pr for launchpad, was that not also on master?

If this is needed in addition to the launchpad fix, please backport this to the launchpad branch

Is the launchpad branch launchpad/backports? This branch does not seem to support StoreUpgrades.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

ACK, thanks!

I just have 2 small questions, will merge right after they are answered.

x/upgrade/types/storeloader_test.go Outdated Show resolved Hide resolved
x/upgrade/types/storeloader_test.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

@ethanfrey Are you talking about #7531? That got backported correctly from master. I think @chengwenxi is right though, I can't see StoreUpgrades in launchpad either.

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 13, 2020
@mergify mergify bot merged commit 6e3fab8 into cosmos:master Nov 13, 2020
dreamer-zq added a commit to bianjieai/cosmos-sdk that referenced this pull request Nov 16, 2020
chengwenxi added a commit to bianjieai/cosmos-sdk that referenced this pull request Nov 16, 2020
* cherry pick 2ea9cf4

* move sm2 from tendermint to sdk

* fix bug

* register sm2

* fix bug

* fix test error

* fix bug

* fix bug

* cherry-pick from cosmos#7817

* update tendermint version

Co-authored-by: chengwenxi <vincent.ch.cn@gmail.com>
@chengwenxi chengwenxi deleted the vincent-upgrade branch November 19, 2020 01:57
chengwenxi added a commit that referenced this pull request Nov 19, 2020
* cherry pick 2ea9cf4

* move sm2 from tendermint to sdk

* fix bug

* register sm2

* fix bug

* fix test error

* fix bug

* fix bug

* cherry-pick from #7817

* update tendermint version

Co-authored-by: chengwenxi <vincent.ch.cn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade height judgment error
6 participants