Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): register wasm snapshot extension for state-sync #2114

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@

app.SetAnteHandler(initAnteHandlers(encodingConfig, keys, keepers, appOpts))

// Register wasm snapshot extension for state-sync compatibility
// MUST be done before loading the version
app.registerWasmSnapshotExtension(keepers)

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand Down Expand Up @@ -453,6 +457,22 @@
return messageRouter
}

func (app *AxelarApp) registerWasmSnapshotExtension(keepers *KeeperCache) {
// Register wasm snapshot extension to enable state-sync compatibility for wasm.
// MUST be done before loading the version
// Requires the snapshot store to be created and registered as a BaseAppOption
if IsWasmEnabled() {
if manager := app.SnapshotManager(); manager != nil {
err := manager.RegisterExtensions(
wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), getKeeper[wasm.Keeper](keepers)),
)
if err != nil {
panic(fmt.Errorf("failed to register snapshot extension: %s", err))

Check warning on line 470 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L466-L470

Added lines #L466 - L470 were not covered by tests
}
}
}
}

func (app *AxelarApp) setUpgradeBehaviour(configurator module.Configurator, keepers *KeeperCache) {
app.upgradeKeeper.SetUpgradeHandler(
upgradeName(app.Version()),
Expand Down
Loading