common: Disallow downgrading contracts
Some checks failed
DCO action / DCO (pull_request) Failing after 1m16s
Tests / Tests (1.21) (pull_request) Successful in 1m36s
Tests / Tests (1.22) (pull_request) Successful in 2m0s

`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 <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-08-19 11:52:01 +03:00
parent 82e04b6c32
commit 0e9e5b829d

View file

@ -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))
}
}