diff --git a/CHANGELOG.md b/CHANGELOG.md index e636dfa3aa0..f3734be80b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#2390](https://github.com/osmosis-labs/osmosis/pull/2390) x/mint remove unused mintCoins parameter from AfterDistributeMintedCoin * [#2418](https://github.com/osmosis-labs/osmosis/pull/2418) x/mint remove SetInitialSupplyOffsetDuringMigration from keeper * [#2417](https://github.com/osmosis-labs/osmosis/pull/2417) x/mint unexport keeper `SetLastReductionEpochNum`, `getLastReductionEpochNum`, `CreateDeveloperVestingModuleAccount`, and `MintCoins` +* [#2587](https://github.com/osmosis-labs/osmosis/pull/2587) remove encoding config argument from NewOsmosisApp ### Features diff --git a/app/app.go b/app/app.go index 9a7072acf3f..00c3f93f0e1 100644 --- a/app/app.go +++ b/app/app.go @@ -40,7 +40,6 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/osmosis-labs/osmosis/v11/app/keepers" - appparams "github.com/osmosis-labs/osmosis/v11/app/params" "github.com/osmosis-labs/osmosis/v11/app/upgrades" v10 "github.com/osmosis-labs/osmosis/v11/app/upgrades/v10" v11 "github.com/osmosis-labs/osmosis/v11/app/upgrades/v11" @@ -152,12 +151,12 @@ func NewOsmosisApp( skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, - encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, wasmEnabledProposals []wasm.ProposalType, wasmOpts []wasm.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *OsmosisApp { + encodingConfig := MakeEncodingConfig() appCodec := encodingConfig.Marshaler cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry diff --git a/app/config.go b/app/config.go index f83aa341cc3..6d271c9b836 100644 --- a/app/config.go +++ b/app/config.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - "github.com/osmosis-labs/osmosis/v11/app/params" dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" @@ -30,7 +29,7 @@ func DefaultConfig() network.Config { LegacyAmino: encCfg.Amino, InterfaceRegistry: encCfg.InterfaceRegistry, AccountRetriever: authtypes.AccountRetriever{}, - AppConstructor: NewAppConstructor(encCfg), + AppConstructor: NewAppConstructor(), GenesisState: ModuleBasics.DefaultGenesis(encCfg.Marshaler), TimeoutCommit: 1 * time.Second / 2, ChainID: "osmosis-code-test", @@ -48,11 +47,10 @@ func DefaultConfig() network.Config { } // NewAppConstructor returns a new Osmosis app given encoding type configs. -func NewAppConstructor(encodingCfg params.EncodingConfig) network.AppConstructor { +func NewAppConstructor() network.AppConstructor { return func(val network.Validator) servertypes.Application { return NewOsmosisApp( val.Ctx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0, - encodingCfg, simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts, diff --git a/app/encoding.go b/app/encoding.go index 5c29469a81a..b267d0d1d6a 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/std" ) -// MakeEncodingConfig creates an EncodingConfig for testing. +// MakeEncodingConfig creates an EncodingConfig. func MakeEncodingConfig() params.EncodingConfig { encodingConfig := params.MakeEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/test_helpers.go b/app/test_helpers.go index a85c4c008ca..4e5ba6fb7cd 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -13,7 +13,6 @@ import ( ) var defaultGenesisBz []byte -var defaultEncodingConfig = MakeEncodingConfig() func getDefaultGenesisStateBytes() []byte { if len(defaultGenesisBz) == 0 { @@ -30,7 +29,7 @@ func getDefaultGenesisStateBytes() []byte { // Setup initializes a new OsmosisApp. func Setup(isCheckTx bool) *OsmosisApp { db := dbm.NewMemDB() - app := NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, defaultEncodingConfig, simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) + app := NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) if !isCheckTx { stateBytes := getDefaultGenesisStateBytes() @@ -54,7 +53,7 @@ func SetupTestingAppWithLevelDb(isCheckTx bool) (app *OsmosisApp, cleanupFn func if err != nil { panic(err) } - app = NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig(), simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) + app = NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) if !isCheckTx { genesisState := NewDefaultGenesisState() stateBytes, err := json.MarshalIndent(genesisState, "", " ") diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go index ad303ba8b84..9647963cdaf 100644 --- a/cmd/osmosisd/cmd/root.go +++ b/cmd/osmosisd/cmd/root.go @@ -274,7 +274,6 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - osmosis.MakeEncodingConfig(), // Ideally, we would reuse the one created by NewRootCmd. appOpts, osmosis.GetWasmEnabledProposals(), wasmOpts, @@ -300,13 +299,13 @@ func createOsmosisAppAndExport( encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry) var app *osmosis.OsmosisApp if height != -1 { - app = osmosis.NewOsmosisApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), encCfg, appOpts, osmosis.GetWasmEnabledProposals(), osmosis.EmptyWasmOpts) + app = osmosis.NewOsmosisApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), appOpts, osmosis.GetWasmEnabledProposals(), osmosis.EmptyWasmOpts) if err := app.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - app = osmosis.NewOsmosisApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), encCfg, appOpts, osmosis.GetWasmEnabledProposals(), osmosis.EmptyWasmOpts) + app = osmosis.NewOsmosisApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), appOpts, osmosis.GetWasmEnabledProposals(), osmosis.EmptyWasmOpts) } return app.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) diff --git a/tests/simulator/sim_test.go b/tests/simulator/sim_test.go index 8a57a743107..4986651cd28 100644 --- a/tests/simulator/sim_test.go +++ b/tests/simulator/sim_test.go @@ -83,7 +83,6 @@ func fullAppSimulation(tb testing.TB, is_testing bool) { map[int64]bool{}, app.DefaultNodeHome, osmosim.FlagPeriodValue, - app.MakeEncodingConfig(), osmosim.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, @@ -165,7 +164,6 @@ func TestAppStateDeterminism(t *testing.T) { map[int64]bool{}, app.DefaultNodeHome, osmosim.FlagPeriodValue, - app.MakeEncodingConfig(), osmosim.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts,