From 7ad53aae209537080d6fd9b3a49ff039be4dce51 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 17 Jun 2022 00:32:37 +0700 Subject: [PATCH] Fix snapshot manager with wasm (#1698) * Update app.go * Update app.go * fmt and changelog Co-authored-by: Roman (cherry picked from commit 8e1b6201a514fb3970c3d6537342d66f38ba0446) --- CHANGELOG.md | 1 + app/app.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f3ad53e49..d430b8cf310 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [1700](https://github.com/osmosis-labs/osmosis/pull/1700) Upgrade sdk fork with missing snapshot manager fix. * [1716](https://github.com/osmosis-labs/osmosis/pull/1716) Fix secondary over-LP shares bug with uneven swap amounts in `CalcJoinPoolShares`. * [1759](https://github.com/osmosis-labs/osmosis/pull/1759) Fix pagination filter in incentives query. +* [1698](https://github.com/osmosis-labs/osmosis/pull/1698) Register wasm snapshotter extension. ## [v9.0.0 - Nitrogen](https://github.com/osmosis-labs/osmosis/releases/tag/v9.0.0) diff --git a/app/app.go b/app/app.go index 9270155005f..4e94d2431e7 100644 --- a/app/app.go +++ b/app/app.go @@ -19,6 +19,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -278,6 +279,16 @@ func NewOsmosisApp( ) app.SetEndBlocker(app.EndBlocker) + // Register snapshot extensions to enable state-sync for wasm. + if manager := app.SnapshotManager(); manager != nil { + err := manager.RegisterExtensions( + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), app.WasmKeeper), + ) + if err != nil { + panic(fmt.Errorf("failed to register snapshot extension: %s", err)) + } + } + if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error())