From 5a08f0094ce01669efe90f823818a3c0685330a9 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Tue, 10 Dec 2024 21:37:35 +0100 Subject: [PATCH] feat(upgrade): add drs validation to allow gov based upgrades (#182) --- app/app.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/app.go b/app/app.go index 2e52a26..32012a3 100644 --- a/app/app.go +++ b/app/app.go @@ -157,6 +157,8 @@ import ( "github.com/dymensionxyz/dymension-rdk/x/rollappparams" rollappparamskeeper "github.com/dymensionxyz/dymension-rdk/x/rollappparams/keeper" rollappparamstypes "github.com/dymensionxyz/dymension-rdk/x/rollappparams/types" + + dymintversion "github.com/dymensionxyz/dymint/version" ) const ( @@ -952,6 +954,13 @@ func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.R resp := app.mm.BeginBlock(ctx, req) resp.ConsensusMessagesResponses = consensusResponses + drsVersion, err := dymintversion.GetDRSVersion() + if err != nil { + panic(fmt.Errorf("Unable to get DRS version from binary: %w", err)) + } + if drsVersion != app.RollappParamsKeeper.Version(ctx) { + panic(fmt.Errorf("DRS version mismatch. rollapp DRS version: %d binary DRS version:%d", app.RollappParamsKeeper.Version(ctx), drsVersion)) + } return resp }