Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jul 26, 2022
1 parent 18b7524 commit dd98b4a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ type SimApp struct {
*runtime.App
legacyAmino *codec.LegacyAmino
appCodec codec.Codec
txConfig client.TxConfig
interfaceRegistry codectypes.InterfaceRegistry

// keys to access the substores
Expand Down Expand Up @@ -218,6 +219,7 @@ func NewSimApp(
&appBuilder,
&app.appCodec,
&app.legacyAmino,
&app.txConfig,
&app.interfaceRegistry,
&app.AccountKeeper,
&app.BankKeeper,
Expand Down Expand Up @@ -340,6 +342,11 @@ func (app *SimApp) InterfaceRegistry() codectypes.InterfaceRegistry {
return app.interfaceRegistry
}

// TxConfig returns SimApp's TxConfig
func (app *SimApp) TxConfig() client.TxConfig {
return app.txConfig
}

// GetKey returns the KVStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
Expand Down
3 changes: 1 addition & 2 deletions simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
Expand Down Expand Up @@ -74,7 +73,7 @@ func TestRunMigrations(t *testing.T) {
app := NewSimApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome))

// Create a new baseapp and configurator for the purpose of this test.
bApp := baseapp.NewBaseApp(app.Name(), logger, db, testutil.MakeTestEncodingConfig().TxConfig.TxDecoder())
bApp := baseapp.NewBaseApp(app.Name(), logger, db, app.TxConfig().TxDecoder())
bApp.SetCommitMultiStoreTracer(nil)
bApp.SetInterfaceRegistry(app.InterfaceRegistry())
app.BaseApp = bApp
Expand Down
11 changes: 8 additions & 3 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func ModuleAccountAddrs() map[string]bool {

// NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests
func NewTestNetworkFixture() network.TestFixture {
encodingCfg := testutil.MakeTestEncodingConfig()
app := NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.EmptyAppOptions{})

appCtr := func(val testutil.Validator) servertypes.Application {
return NewSimApp(
Expand All @@ -369,7 +369,12 @@ func NewTestNetworkFixture() network.TestFixture {

return network.TestFixture{
AppConstructor: appCtr,
GenesisState: ModuleBasics.DefaultGenesis(encodingCfg.Codec),
EncodingConfig: encodingCfg,
GenesisState: ModuleBasics.DefaultGenesis(app.AppCodec()),
EncodingConfig: testutil.TestEncodingConfig{
InterfaceRegistry: app.InterfaceRegistry(),
Codec: app.AppCodec(),
TxConfig: app.TxConfig(),
Amino: app.LegacyAmino(),
},
}
}

0 comments on commit dd98b4a

Please sign in to comment.