Skip to content

Commit

Permalink
fix storekeys
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Jun 18, 2023
1 parent 92fe5be commit 8f89c8d
Show file tree
Hide file tree
Showing 20 changed files with 788 additions and 116 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
Expand Down Expand Up @@ -139,7 +140,6 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
dec := simulation.NewDecodeStore(app.TransferKeeper)

trace := types.DenomTrace{
Expand Down
2 changes: 1 addition & 1 deletion modules/capability/capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type CapabilityTestSuite struct {

func (suite *CapabilityTestSuite) SetupTest() {
checkTx := false
app := simapp.Setup(checkTx)
app := simapp.Setup(suite.T(), checkTx)
cdc := app.AppCodec()

// create new keeper so we can define custom scoping before init and seal
Expand Down
2 changes: 1 addition & 1 deletion modules/capability/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
dec := simulation.NewDecodeStore(app.AppCodec())

capOwners := types.CapabilityOwners{
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (suite *KeeperTestSuite) SetupTest() {
suite.now = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)
suite.past = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)
now2 := suite.now.Add(time.Hour)
app := simapp.Setup(isCheckTx)
app := simapp.Setup(suite.T(), isCheckTx)

suite.cdc = app.AppCodec()
suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{Height: height, ChainID: testClientID, Time: now2})
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
clientID := "clientidone"

height := types.NewHeight(0, 10)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/03-connection/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
cdc := app.AppCodec()

connectionID := "connectionidone"
Expand Down
2 changes: 1 addition & 1 deletion modules/core/03-connection/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (suite *MsgTestSuite) SetupTest() {
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))

app := simapp.Setup(false)
app := simapp.Setup(suite.T(), false)
db := dbm.NewMemDB()
dblog := log.TestingLogger()
store := rootmulti.NewStore(db, dblog)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
cdc := app.AppCodec()

channelID := "channelidone"
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type TypesTestSuite struct {
}

func (suite *TypesTestSuite) SetupTest() {
app := simapp.Setup(false)
app := simapp.Setup(suite.T(), false)
db := dbm.NewMemDB()
dblog := log.TestingLogger()
store := rootmulti.NewStore(db, dblog)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/05-port/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type KeeperTestSuite struct {

func (suite *KeeperTestSuite) SetupTest() {
isCheckTx := false
app := simapp.Setup(isCheckTx)
app := simapp.Setup(suite.T(), isCheckTx)

suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
suite.keeper = &app.IBCKeeper.PortKeeper
Expand Down
2 changes: 1 addition & 1 deletion modules/core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (suite *IBCTestSuite) TestInitGenesis() {
}

for _, tc := range testCases {
app := simapp.Setup(false)
app := simapp.Setup(suite.T(), false)

suite.NotPanics(func() {
ibc.InitGenesis(app.BaseApp.NewContext(false, tmproto.Header{Height: 1}), *app.IBCKeeper, tc.genState)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestDecodeStore(t *testing.T) {
app := simapp.Setup(false)
app := simapp.Setup(t, false)
dec := simulation.NewDecodeStore(*app.IBCKeeper)

clientID := "clientidone"
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/07-tendermint/tendermint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (suite *TendermintTestSuite) SetupTest() {

// TODO: deprecate usage in favor of testing package
checkTx := false
app := simapp.Setup(checkTx)
app := simapp.Setup(suite.T(), checkTx)

suite.cdc = app.AppCodec()

Expand Down
30 changes: 15 additions & 15 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
_ "github.com/cosmos/cosmos-sdk/client/docs/statik" // this is used for serving docs
"github.com/cosmos/cosmos-sdk/client/flags"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand Down Expand Up @@ -324,17 +323,16 @@ func NewSimApp(
// SDK Keys
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, consensusparamtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,

// IBC Keys
ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey,
authzkeeper.StoreKey, ibcfeetypes.StoreKey,
ibcfeetypes.StoreKey, capabilitytypes.StoreKey,
)

tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)

memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey, "testingkey")

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil {
Expand Down Expand Up @@ -966,6 +964,17 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
return paramsKeeper
}

func makeEncodingConfig() simappparams.EncodingConfig {
encodingConfig := simappparams.MakeTestEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}

// IBC Upgrade functions

/*
// setupUpgradeHandlers sets all necessary upgrade handlers for testing purposes
func (app *SimApp) setupUpgradeHandlers() {
Expand Down Expand Up @@ -1029,15 +1038,6 @@ func (app *SimApp) setupUpgradeStoreLoaders() {
}
*/

func makeEncodingConfig() simappparams.EncodingConfig {
encodingConfig := simappparams.MakeTestEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}

// IBC TestingApp functions

// GetBaseApp implements the TestingApp interface.
Expand Down
2 changes: 1 addition & 1 deletion testing/simapp/sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

// Profile with:
// /usr/local/go/bin/go test -benchmem -run=^$ cosmossdk.io/simapp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/ibc-go/v7/testing/simapp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
func BenchmarkFullAppSimulation(b *testing.B) {
b.ReportAllocs()

Expand Down
3 changes: 2 additions & 1 deletion testing/simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

Expand Down Expand Up @@ -166,7 +167,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {

rootCmd.AddCommand(
genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
// NewTestnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
NewTestnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
pruning.PruningCmd(newApp),
Expand Down
Loading

0 comments on commit 8f89c8d

Please sign in to comment.