From 1ca62cb9d06d7e0f2cd96ba1f671bb2492c01426 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:29:06 +0200 Subject: [PATCH] fix(x/consensus)!: update cons params parsing checks (backport #21484) (#21493) Co-authored-by: MSalopek Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + Makefile | 4 ++-- x/consensus/keeper/keeper.go | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44ee41b033eb..383d00033017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (x/consensus) [#21493](https://github.com/cosmos/cosmos-sdk/pull/21493) Fix regression that prevented to upgrade to > v0.50.7 without consensus version params. * (baseapp) [#21256](https://github.com/cosmos/cosmos-sdk/pull/21256) Halt height will not commit the block indicated, meaning that if halt-height is set to 10, only blocks until 9 (included) will be committed. This is to go back to the original behavior before a change was introduced in v0.50.0. * (baseapp) [#21444](https://github.com/cosmos/cosmos-sdk/pull/21444) Follow-up, Return PreBlocker events in FinalizeBlockResponse. diff --git a/Makefile b/Makefile index f6f8b4f4f54d..181de584d26e 100644 --- a/Makefile +++ b/Makefile @@ -467,10 +467,10 @@ localnet-build-dlv: localnet-build-nodes: $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmossdk/simd \ testnet init-files --v 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test - docker-compose up -d + docker compose up -d localnet-stop: - docker-compose down + docker compose down # localnet-start will run a 4-node testnet locally. The nodes are # based off the docker images in: ./contrib/images/simd-env diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 50b5b2d93f6c..b239a9ee5ee7 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -78,6 +78,12 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (* if err != nil { return nil, err } + + // initialize version params with zero value if not set + if paramsProto.Version == nil { + paramsProto.Version = &cmtproto.VersionParams{} + } + params := cmttypes.ConsensusParamsFromProto(paramsProto) nextParams := params.Update(&consensusParams)