Files
osmosis-labs-osmosis/app/export.go
Adam Tucker 5bff2163b8 feat: sdk v0.50.x upgrade (#8274)
* initial push

* delete

* tidy

* add replace

* proto

* excludes

* update go mods

* fix

* initial pass through modules

* checkpoint

* checkpoint

* another round

* fork update with fixes

* fork bumps

* more fixes

* move to cosmosdb

* signModeHandler fix

* more fixes

* store fixes

* checkpoint

* checkpoint

* more event fixes

* GetSigners fix for tests

* get signers fixes

* smart account fixes

* fixes

* checkpoint

* txfees completion

* more errors

* rosetta import

* address simulation

* smart account get sign bytes

* disable streaming service

* some test fixes

* as signer proto

* fix some tests

* fix superfluid test

* more fixes

* fix gamm keeper test with note

* fix authz serialization

* fix validate basic test

* incentives test fix

* fix lockup test

* begin and end block fixes

* fix epochs tests

* fix all upgrade tests

* fix txfees test

* fix e2e init test

* more fixes

* updated ibctesting overrides. Removed unnecessary receiver length check test (now checked on ibc sends). Rate limit tests pass

* smart account integration test fixes

* SetAccount no longer needed. Done internally.

* more set account issues

* gas checks are not needed when using selected authenticators. That was a legacy check

* fix accounts and codec

* using codec with proper "osmo" prefix. The default test codec uses "cosmos" and there's no way to override it

* fix ibc-hooks tests

* streaming fixes

* upgrade handler

* tidy

* golang bump 1.22

* prevent circular dep

* update osmoutils

* tidy

* remove local replaces for testing

* set up module.go

* fix dockerfile for local work

* module changes

* fix e2e

* more ci fixes

* fix simulator

* lints

* remove wrap

* lints

* lints

* clean up the TODOs

* more todo clean ups

* comments

* comments

* move test outside of osmoutils

* clean up go mods

* fix errors for GetDelegation

* return error instead of panic

* chore: fix build

* fix weird error check

* ignore words

* more spelling fixes

* final spelling errors

* Revert "more spelling fixes"

This reverts commit 5c8698ba6d.

* redo spelling check

---------

Co-authored-by: Nicolas Lara <nicolaslara@gmail.com>
Co-authored-by: PaddyMc <paddymchale@hotmail.com>
2024-05-24 15:16:37 -05:00

54 lines
1.6 KiB
Go

package app
import (
"encoding/json"
"fmt"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking"
)
// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
func (app *OsmosisApp) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string,
) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()})
// We export at last height + 1, because that's the height at which
// Tendermint will start InitChain.
height := app.LastBlockHeight() + 1
if forZeroHeight {
return servertypes.ExportedApp{}, fmt.Errorf("forZeroHeight not supported")
}
genState, err := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport)
if err != nil {
return servertypes.ExportedApp{}, err
}
appState, err := json.MarshalIndent(genState, "", " ")
if err != nil {
return servertypes.ExportedApp{}, err
}
validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
return servertypes.ExportedApp{
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
}, err
}
func (app *OsmosisApp) ExportState(ctx sdk.Context) map[string]json.RawMessage {
export, err := app.mm.ExportGenesis(ctx, app.AppCodec())
if err != nil {
panic(err)
}
return export
}