From 0fd77f5472a39db6e91f867b571f5ce47127356e Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Thu, 14 Nov 2024 16:10:07 +0530 Subject: [PATCH 1/8] fix (cosmovisor): premature upgrade on restart --- tools/cosmovisor/scanner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index 6b46f85bafa3..0012521d98a4 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -150,7 +150,7 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { // file exist but too early in height currentHeight, _ := fw.checkHeight() - if currentHeight != 0 && currentHeight < info.Height { + if currentHeight < info.Height { return false } From 7cd80e406d3c3923ea06290be384fbfb819b9a03 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 12:04:13 +0530 Subject: [PATCH 2/8] fix tests --- tools/cosmovisor/scanner.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index 0012521d98a4..435488d5df79 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -15,6 +15,8 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" ) +var errUntestAble = errors.New("untestable") + type fileWatcher struct { daemonHome string filename string // full path to a watched file @@ -149,8 +151,8 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { } // file exist but too early in height - currentHeight, _ := fw.checkHeight() - if currentHeight < info.Height { + currentHeight, err := fw.checkHeight() + if (err != nil || currentHeight < info.Height) && err != errUntestAble { // ignore this check for tests return false } @@ -182,7 +184,7 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { // checkHeight checks if the current block height func (fw *fileWatcher) checkHeight() (int64, error) { if testing.Testing() { // we cannot test the command in the test environment - return 0, nil + return 0, errUntestAble } result, err := exec.Command(fw.currentBin, "status", "--home", fw.daemonHome).CombinedOutput() //nolint:gosec // we want to execute the status command From e99e891dc5c6acdc00a61509f274733e5ddf33b6 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 12:13:33 +0530 Subject: [PATCH 3/8] fix lint --- tools/cosmovisor/scanner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index 435488d5df79..008c57357075 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -152,7 +152,7 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { // file exist but too early in height currentHeight, err := fw.checkHeight() - if (err != nil || currentHeight < info.Height) && err != errUntestAble { // ignore this check for tests + if (err != nil || currentHeight < info.Height) && !errors.Is(err, errUntestAble) { // ignore this check for tests return false } From c2f66423429efab119e9b480cfe1c6240ea590be Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 12:29:21 +0530 Subject: [PATCH 4/8] update changelog --- tools/cosmovisor/CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 3dd65d805595..f59f5e87382c 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -40,15 +40,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#21790](https://github.com/cosmos/cosmos-sdk/pull/21790) Add `add-batch-upgrade` command. * [#21972](https://github.com/cosmos/cosmos-sdk/pull/21972) Add `prepare-upgrade` command +* [#21932](https://github.com/cosmos/cosmos-sdk/pull/21932) Add `cosmovisor show-upgrade-info` command to display the upgrade-info.json into stdout. ### Improvements * [#21891](https://github.com/cosmos/cosmos-sdk/pull/21891) create `current` symlink as relative * [#21462](https://github.com/cosmos/cosmos-sdk/pull/21462) Pass `stdin` to binary. + +### Bug Fixes -### Features - -* [#21932](https://github.com/cosmos/cosmos-sdk/pull/21932) Add `cosmovisor show-upgrade-info` command to display the upgrade-info.json into stdout. +* [22528] (https://github.com/cosmos/cosmos-sdk/pull/22528) Fix premature upgrades on restarting cosmovisor. ## v1.6.0 - 2024-08-12 From 25c21eb72a51de5a91ea3b7d38d1142bd755ef12 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 12:30:29 +0530 Subject: [PATCH 5/8] typo --- tools/cosmovisor/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index f59f5e87382c..af417f3fd273 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -49,7 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* [22528] (https://github.com/cosmos/cosmos-sdk/pull/22528) Fix premature upgrades on restarting cosmovisor. +* [#22528] (https://github.com/cosmos/cosmos-sdk/pull/22528) Fix premature upgrades on restarting cosmovisor. ## v1.6.0 - 2024-08-12 From cd2028d492b39376609aa924f310174dd3f3dc1c Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 12:31:23 +0530 Subject: [PATCH 6/8] typo --- tools/cosmovisor/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index af417f3fd273..b99338da8065 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -49,7 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* [#22528] (https://github.com/cosmos/cosmos-sdk/pull/22528) Fix premature upgrades on restarting cosmovisor. +* [#22528](https://github.com/cosmos/cosmos-sdk/pull/22528) Fix premature upgrades on restarting cosmovisor. ## v1.6.0 - 2024-08-12 From 6b837c9bdf16390a0cadf933b85c4cf4709f6b10 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 15 Nov 2024 14:28:11 +0530 Subject: [PATCH 7/8] add version in changelog --- tools/cosmovisor/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index b99338da8065..2a9d456bf925 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -36,6 +36,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## v1.7.0 - 2024-11-15 + ### Features * [#21790](https://github.com/cosmos/cosmos-sdk/pull/21790) Add `add-batch-upgrade` command. From 2b56f7e4cf79912950168b297b8004bb87955b44 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Mon, 18 Nov 2024 12:24:33 +0530 Subject: [PATCH 8/8] change date --- tools/cosmovisor/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 2a9d456bf925..2e8b454ee917 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -## v1.7.0 - 2024-11-15 +## v1.7.0 - 2024-11-18 ### Features