From ba7329c3a7313d381da00028ed675ff70c09a82d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 19 Aug 2024 11:52:01 +0300 Subject: [PATCH] [#103] common: Disallow downgrading contracts `PrevVersion` marks suitable version that we can upgrade from. However, we can have multiple minor versions, so, currently an upgrade from v0.19.3 to v0.19.1 is possible. Prevent this with an additional check. Signed-off-by: Evgenii Stratonikov --- common/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/version.go b/common/version.go index 8ceec23..3427df9 100644 --- a/common/version.go +++ b/common/version.go @@ -32,7 +32,7 @@ func CheckVersion(from int) { if from < PrevVersion { panic(ErrVersionMismatch + ": expected >=" + std.Itoa(PrevVersion, 10)) } - if from == Version { + if Version <= from { panic(ErrAlreadyUpdated + ": " + std.Itoa(Version, 10)) } }