From 6ff52299dfe1a6d15095779690fb7f98a4029615 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 13:44:49 +0800 Subject: [PATCH 01/59] begin refactoring simapp in main branch --- testing/simapp/app.go | 356 +++++++++++++++++++++++++----------------- 1 file changed, 210 insertions(+), 146 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 63a7c522f18..d3beecf7e6d 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,9 +2,7 @@ package simapp import ( "encoding/json" - "fmt" "io" - "net/http" "os" "path/filepath" @@ -23,23 +21,27 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/store/streaming" storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" + testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - authz "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" @@ -73,6 +75,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/nft" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" @@ -88,8 +93,6 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" "github.com/spf13/cast" "github.com/cosmos/ibc-go/modules/capability" @@ -170,7 +173,9 @@ var ( ibcmock.AppModuleBasic{}, ica.AppModuleBasic{}, authzmodule.AppModuleBasic{}, + groupmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, + nftmodule.AppModuleBasic{}, ibcfee.AppModuleBasic{}, consensus.AppModuleBasic{}, ) @@ -183,6 +188,7 @@ var ( stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, + nft.ModuleName: nil, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, ibcfeetypes.ModuleName: nil, icatypes.ModuleName: nil, @@ -202,10 +208,8 @@ type SimApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino appCodec codec.Codec - interfaceRegistry types.InterfaceRegistry txConfig client.TxConfig - - invCheckPeriod uint + interfaceRegistry types.InterfaceRegistry // keys to access the substores keys map[string]*storetypes.KVStoreKey @@ -221,7 +225,6 @@ type SimApp struct { MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper - GroupKeeper groupkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper @@ -233,6 +236,8 @@ type SimApp struct { EvidenceKeeper evidencekeeper.Keeper TransferKeeper ibctransferkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper + GroupKeeper groupkeeper.Keeper + NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper // make scoped keepers public for test purposes @@ -250,12 +255,12 @@ type SimApp struct { FeeMockModule ibcmock.IBCModule // the module manager - mm *module.Manager + ModuleManager *module.Manager // simulation manager sm *module.SimulationManager - // the configurator + // module configurator configurator module.Configurator } @@ -270,39 +275,80 @@ func init() { // NewSimApp returns a reference to an initialized SimApp. func NewSimApp( - logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, - homePath string, invCheckPeriod uint, encodingConfig simappparams.EncodingConfig, - appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + loadLatest bool, + appOpts servertypes.AppOptions, + baseAppOptions ...func(*baseapp.BaseApp), ) *SimApp { - appCodec := encodingConfig.Marshaler + encodingConfig := makeEncodingConfig() + + appCodec := encodingConfig.Codec legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry + txConfig := encodingConfig.TxConfig + + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. + // + // Example: + // + // bApp := baseapp.NewBaseApp(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp) + // + // bApp.SetMempool(nonceMempool) + // bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to NewBaseApp. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) - bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) keys := sdk.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + govtypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, + authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, ) + tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + // NOTE: The testingkey is just mounted for testing purposes. Actual applications should + // not include this key. + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") + + // load state streaming if enabled + if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { + logger.Error("failed to load state streaming", "err", err) + os.Exit(1) + } app := &SimApp{ BaseApp: bApp, legacyAmino: legacyAmino, appCodec: appCodec, + txConfig: txConfig, interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, keys: keys, tkeys: tkeys, memKeys: memKeys, - txConfig: encodingConfig.TxConfig, } app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) @@ -313,6 +359,9 @@ func NewSimApp( // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) @@ -328,7 +377,6 @@ func NewSimApp( app.CapabilityKeeper.Seal() // SDK module keepers - app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.BankKeeper = bankkeeper.NewBaseKeeper( @@ -344,11 +392,7 @@ func NewSimApp( app.StakingKeeper = stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, keys[minttypes.StoreKey], app.StakingKeeper, - app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + app.MintKeeper = mintkeeper.NewKeeper(appCodec, keys[minttypes.StoreKey], app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.DistrKeeper = distrkeeper.NewKeeper(appCodec, keys[distrtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -356,19 +400,36 @@ func NewSimApp( appCodec, legacyAmino, keys[slashingtypes.StoreKey], app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, keys[crisistypes.StoreKey], invCheckPeriod, + app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) + // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.StakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, keys[crisistypes.StoreKey], invCheckPeriod, - app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + groupConfig := group.DefaultConfig() + /* + Example of setting group params: + groupConfig.MaxMetadataLen = 1000 + */ + app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) - app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper) + // get skipUpgradeHeights from the app options + skipUpgradeHeights := map[int64]bool{} + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + homePath := cast.ToString(appOpts.Get(flags.FlagHome)) + // set the governance module account as the authority for conducting upgrades + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) // IBC Keepers @@ -402,12 +463,9 @@ func NewSimApp( ), ) - groupConfig := group.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) + app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) + + // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( @@ -541,7 +599,7 @@ func NewSimApp( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. - app.mm = module.NewManager( + app.ModuleManager = module.NewManager( // SDK app modules genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, @@ -563,6 +621,7 @@ func NewSimApp( params.NewAppModule(app.ParamsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), // IBC modules @@ -593,22 +652,33 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. // NOTE: Capability module must occur first so that it can initialize any capabilities // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. - app.mm.SetOrderInitGenesis( + + genesisModuleOrder := []string{ capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, - ) + vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, nft.ModuleName, + } + app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) + app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) - app.mm.RegisterInvariants(app.CrisisKeeper) + // Uncomment if you want to set a custom migration order here. + // app.ModuleManager.SetOrderMigrations(custom order) + + app.ModuleManager.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) + app.ModuleManager.RegisterServices(app.configurator) + + // RegisterUpgradeHandlers is used for registering any on-chain upgrades. + // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. + // app.RegisterUpgradeHandlers() - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) reflectionSvc, err := runtimeservices.NewReflectionService() if err != nil { @@ -617,29 +687,16 @@ func NewSimApp( reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) // add test gRPC service for testing gRPC queries in isolation - testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) + testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations // // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions - app.sm = module.NewSimulationManager( - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), - params.NewAppModule(app.ParamsKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - ibc.NewAppModule(app.IBCKeeper), - transfer.NewAppModule(app.TransferKeeper), - ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), - ) + overrideModules := map[string]module.AppModuleSimulation{ + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + } + app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) app.sm.RegisterStoreDecoders() @@ -651,6 +708,8 @@ func NewSimApp( // initialize BaseApp app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) + app.SetEndBlocker(app.EndBlocker) + app.setAnteHandler(encodingConfig.TxConfig) anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ @@ -680,10 +739,7 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // note replicate if you do not need to test core IBC or light clients. @@ -694,17 +750,32 @@ func NewSimApp( return app } +func (app *SimApp) setPostHandler() { + postHandler, err := posthandler.NewPostHandler( + posthandler.HandlerOptions{}, + ) + if err != nil { + panic(err) + } + + app.SetPostHandler(postHandler) +} + // Name returns the name of the App func (app *SimApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block func (app *SimApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) + return app.ModuleManager.BeginBlock(ctx, req) } // EndBlocker application updates every end block func (app *SimApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) + return app.ModuleManager.EndBlock(ctx, req) +} + +func (a *SimApp) Configurator() module.Configurator { + return a.configurator } // InitChainer application update at chain initialization @@ -713,8 +784,8 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci. if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) } // LoadHeight loads a particular height @@ -722,28 +793,6 @@ func (app *SimApp) LoadHeight(height int64) error { return app.LoadVersion(height) } -// ModuleAccountAddrs returns all the app's module account addresses. -func (app *SimApp) ModuleAccountAddrs() map[string]bool { - modAccAddrs := make(map[string]bool) - for acc := range maccPerms { - // do not add the following modules to blocked addresses - // this is only used for testing - if acc == ibcmock.ModuleName { - continue - } - - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true - } - - return modAccAddrs -} - -// GetModuleManager returns the app module manager -// NOTE: used for testing purposes -func (app *SimApp) GetModuleManager() *module.Manager { - return app.mm -} - // LegacyAmino returns SimApp's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable @@ -765,6 +814,16 @@ func (app *SimApp) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } +// TxConfig returns SimApp's TxConfig +func (app *SimApp) TxConfig() client.TxConfig { + return app.txConfig +} + +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { + return ModuleBasics.DefaultGenesis(a.appCodec) +} + // GetKey returns the KVStoreKey for the provided store key. // // NOTE: This is solely to be used for testing purposes. @@ -794,33 +853,6 @@ func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } -// TestingApp functions - -// GetBaseApp implements the TestingApp interface. -func (app *SimApp) GetBaseApp() *baseapp.BaseApp { - return app.BaseApp -} - -// GetStakingKeeper implements the TestingApp interface. -func (app *SimApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { - return app.StakingKeeper -} - -// GetIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { - return app.IBCKeeper -} - -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - -// GetTxConfig implements the TestingApp interface. -func (app *SimApp) GetTxConfig() client.TxConfig { - return app.txConfig -} - // SimulationManager implements the SimulationApp interface func (app *SimApp) SimulationManager() *module.SimulationManager { return app.sm @@ -832,18 +864,19 @@ func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new tendermint queries routes from grpc-gateway. tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register legacy and grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register nodeservice grpc-gateway routes. + // Register node gRPC service for grpc-gateway. nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register grpc-gateway routes for all modules. + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // register swagger API from root so that other applications can override easily - if apiConfig.Swagger { - RegisterSwaggerAPI(clientCtx, apiSvr.Router) + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) } } @@ -866,43 +899,30 @@ func (app *SimApp) RegisterNodeService(clientCtx client.Context) { nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) } -// RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { - statikFS, err := fs.New() - if err != nil { - panic(err) - } - - staticServer := http.FileServer(statikFS) - rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) -} - // GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string) for k, v := range maccPerms { dupMaccPerms[k] = v } + return dupMaccPerms } -// ModuleAccountAddrsLegacy returns all the app's module account addresses. -func ModuleAccountAddrsLegacy() map[string]bool { +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range GetMaccPerms() { modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true } - return modAccAddrs -} - -func BlockedAddresses() map[string]bool { - modAccAddrs := ModuleAccountAddrsLegacy() - // allow the following addresses to receive funds delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) delete(modAccAddrs, authtypes.NewModuleAddress(ibcmock.ModuleName).String()) + return modAccAddrs } @@ -910,6 +930,14 @@ func BlockedAddresses() map[string]bool { func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName) // TODO: ibc module subspaces can be removed after migration of params // https://github.com/cosmos/ibc-go/issues/2010 paramsKeeper.Subspace(ibctransfertypes.ModuleName) @@ -979,3 +1007,39 @@ func (app *SimApp) setupUpgradeStoreLoaders() { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } + +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 +} + +// TestingApp functions + +// GetBaseApp implements the TestingApp interface. +func (app *SimApp) GetBaseApp() *baseapp.BaseApp { + return app.BaseApp +} + +// GetStakingKeeper implements the TestingApp interface. +func (app *SimApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { + return app.StakingKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper +} + +// GetScopedIBCKeeper implements the TestingApp interface. +func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +// GetTxConfig implements the TestingApp interface. +func (app *SimApp) GetTxConfig() client.TxConfig { + return app.txConfig +} From dd71e9d092dfcc75aff30b0fb62f02ad6a6dbefb Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 15:09:18 +0800 Subject: [PATCH 02/59] resolve method calls --- go.mod | 4 +- .../controller/types/msgs_test.go | 4 +- .../27-interchain-accounts/module_test.go | 8 +- .../types/codec_test.go | 10 +-- testing/app.go | 4 +- testing/simapp/app.go | 85 +++++++++++-------- testing/simapp/export.go | 2 +- testing/simapp/params/encoding.go | 2 +- testing/simapp/params/proto.go | 6 +- testing/simapp/sim_bench_test.go | 62 +++++++++----- testing/simapp/sim_test.go | 4 +- testing/simapp/test_helpers.go | 4 +- 12 files changed, 116 insertions(+), 79 deletions(-) diff --git a/go.mod b/go.mod index 3ea14e5f94a..3a637cbf22f 100644 --- a/go.mod +++ b/go.mod @@ -15,9 +15,7 @@ require ( github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 github.com/cosmos/ics23/go v0.10.0 github.com/golang/protobuf v1.5.3 - github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/rakyll/statik v0.1.7 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 @@ -90,6 +88,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect github.com/googleapis/gax-go/v2 v2.8.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect + github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -132,6 +131,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect + github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.1 // indirect diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index b843494d115..af37eb721f1 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -142,7 +142,7 @@ func TestMsgSendTxValidateBasic(t *testing.T) { Amount: ibctesting.TestCoins, } - data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{msgBankSend}) + data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{msgBankSend}) require.NoError(t, err) packetData := icatypes.InterchainAccountPacketData{ @@ -178,7 +178,7 @@ func TestMsgSendTxGetSigners(t *testing.T) { Amount: ibctesting.TestCoins, } - data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{msgBankSend}) + data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{msgBankSend}) require.NoError(t, err) packetData := icatypes.InterchainAccountPacketData{ diff --git a/modules/apps/27-interchain-accounts/module_test.go b/modules/apps/27-interchain-accounts/module_test.go index 461091b996d..fc10874f152 100644 --- a/modules/apps/27-interchain-accounts/module_test.go +++ b/modules/apps/27-interchain-accounts/module_test.go @@ -35,8 +35,8 @@ func (suite *InterchainAccountsTestSuite) SetupTest() { func (suite *InterchainAccountsTestSuite) TestInitModule() { // setup and basic testing chainID := "testchain" - app := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, simapp.MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, baseapp.SetChainID(chainID)) - appModule, ok := app.GetModuleManager().Modules[types.ModuleName].(ica.AppModule) + app := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.EmptyAppOptions{}, baseapp.SetChainID(chainID)) + appModule, ok := app.ModuleManager.Modules[types.ModuleName].(ica.AppModule) suite.Require().True(ok) header := tmproto.Header{ @@ -73,7 +73,7 @@ func (suite *InterchainAccountsTestSuite) TestInitModule() { { "both controller and host set", func() { var ok bool - appModule, ok = app.GetModuleManager().Modules[types.ModuleName].(ica.AppModule) + appModule, ok = app.ModuleManager.Modules[types.ModuleName].(ica.AppModule) suite.Require().True(ok) }, true, true, }, @@ -102,7 +102,7 @@ func (suite *InterchainAccountsTestSuite) TestInitModule() { // reset app state chainID := "testchain" - app = simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, simapp.MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, baseapp.SetChainID(chainID)) + app = simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.EmptyAppOptions{}, baseapp.SetChainID(chainID)) header := tmproto.Header{ ChainID: chainID, Height: 1, diff --git a/modules/apps/27-interchain-accounts/types/codec_test.go b/modules/apps/27-interchain-accounts/types/codec_test.go index 08db0f6d0e7..1ae4da8a186 100644 --- a/modules/apps/27-interchain-accounts/types/codec_test.go +++ b/modules/apps/27-interchain-accounts/types/codec_test.go @@ -108,10 +108,10 @@ func (suite *TypesTestSuite) TestSerializeAndDeserializeCosmosTx() { tc := tc suite.Run(tc.name, func() { - bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, tc.msgs) + bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, tc.msgs) suite.Require().NoError(err, tc.name) - msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, bz) + msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, bz) if tc.expPass { suite.Require().NoError(err, tc.name) } else { @@ -125,16 +125,16 @@ func (suite *TypesTestSuite) TestSerializeAndDeserializeCosmosTx() { } // test serializing non sdk.Msg type - bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{&banktypes.MsgSendResponse{}}) + bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{&banktypes.MsgSendResponse{}}) suite.Require().NoError(err) suite.Require().NotEmpty(bz) // test deserializing unknown bytes - _, err = types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, bz) + _, err = types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, bz) suite.Require().Error(err) // unregistered type // test deserializing unknown bytes - msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []byte("invalid")) + msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []byte("invalid")) suite.Require().Error(err) suite.Require().Empty(msgs) } diff --git a/testing/app.go b/testing/app.go index 2f188d2770a..03190ada379 100644 --- a/testing/app.go +++ b/testing/app.go @@ -53,8 +53,8 @@ type TestingApp interface { func SetupTestingApp() (TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := simapp.MakeTestEncodingConfig() - app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, encCdc, simtestutil.EmptyAppOptions{}) - return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) + app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) + return app, simapp.NewDefaultGenesisState(encCdc.Codec) } // SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts diff --git a/testing/simapp/app.go b/testing/simapp/app.go index d3beecf7e6d..7a449a82554 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,6 +2,7 @@ package simapp import ( "encoding/json" + "fmt" "io" "os" "path/filepath" @@ -15,6 +16,7 @@ import ( "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" "github.com/cosmos/cosmos-sdk/codec" @@ -326,7 +328,7 @@ func NewSimApp( minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, + authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -400,7 +402,6 @@ func NewSimApp( appCodec, legacyAmino, keys[slashingtypes.StoreKey], app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, keys[crisistypes.StoreKey], invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -465,8 +466,6 @@ func NewSimApp( app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) - - // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( appCodec, keys[ibcfeetypes.StoreKey], @@ -637,13 +636,13 @@ func NewSimApp( // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - app.mm.SetOrderBeginBlockers( + app.ModuleManager.SetOrderBeginBlockers( upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, ) - app.mm.SetOrderEndBlockers( + app.ModuleManager.SetOrderEndBlockers( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, @@ -656,7 +655,7 @@ func NewSimApp( // NOTE: Capability module must occur first so that it can initialize any capabilities // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. - + genesisModuleOrder := []string{ capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -710,12 +709,50 @@ func NewSimApp( app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) app.setAnteHandler(encodingConfig.TxConfig) + + // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like + // antehandlers, but are run _after_ the `runMsgs` execution. They are also + // defined as a chain, and have the same signature as antehandlers. + // + // In baseapp, postHandlers are run in the same store branch as `runMsgs`, + // meaning that both `runMsgs` and `postHandler` state will be committed if + // both are successful, and both will be reverted if any of the two fails. + // + // The SDK exposes a default postHandlers chain, which comprises of only + // one decorator: the Transaction Tips decorator. However, some chains do + // not need it by default, so feel free to comment the next line if you do + // not need tips. + // To read more about tips: + // https://docs.cosmos.network/main/core/tips.html + // + // Please note that changing any of the anteHandler or postHandler chain is + // likely to be a state-machine breaking change, which needs a coordinated + // upgrade. + app.setPostHandler() + + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + logger.Error("error on loading last version", "err", err) + os.Exit(1) + } + } + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // note replicate if you do not need to test core IBC or light clients. + app.ScopedIBCMockKeeper = scopedIBCMockKeeper + app.ScopedICAMockKeeper = scopedICAMockKeeper + app.ScopedFeeMockKeeper = scopedFeeMockKeeper + + return app +} + +func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SignModeHandler: txConfig.SignModeHandler(), FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, @@ -727,27 +764,6 @@ func NewSimApp( } app.SetAnteHandler(anteHandler) - - app.SetEndBlocker(app.EndBlocker) - - app.setupUpgradeHandlers() - app.setupUpgradeStoreLoaders() - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - } - - - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - - return app } func (app *SimApp) setPostHandler() { @@ -922,7 +938,6 @@ func BlockedAddresses() map[string]bool { delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) delete(modAccAddrs, authtypes.NewModuleAddress(ibcmock.ModuleName).String()) - return modAccAddrs } @@ -952,7 +967,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( upgrades.V5, - upgrades.CreateDefaultUpgradeHandler(app.mm, app.configurator), + upgrades.CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator), ) // NOTE: The moduleName arg of v6.CreateUpgradeHandler refers to the auth module ScopedKeeper name to which the channel capability should be migrated from. @@ -961,7 +976,7 @@ func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( upgrades.V6, upgrades.CreateV6UpgradeHandler( - app.mm, + app.ModuleManager, app.configurator, app.appCodec, app.keys[capabilitytypes.ModuleName], @@ -973,7 +988,7 @@ func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( upgrades.V7, upgrades.CreateV7UpgradeHandler( - app.mm, + app.ModuleManager, app.configurator, app.appCodec, app.IBCKeeper.ClientKeeper, @@ -984,7 +999,7 @@ func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( upgrades.V7_1, - upgrades.CreateV7LocalhostUpgradeHandler(app.mm, app.configurator, app.IBCKeeper.ClientKeeper), + upgrades.CreateV7LocalhostUpgradeHandler(app.ModuleManager, app.configurator, app.IBCKeeper.ClientKeeper), ) } @@ -1017,7 +1032,7 @@ func makeEncodingConfig() simappparams.EncodingConfig { return encodingConfig } -// TestingApp functions +// IBC TestingApp functions // GetBaseApp implements the TestingApp interface. func (app *SimApp) GetBaseApp() *baseapp.BaseApp { diff --git a/testing/simapp/export.go b/testing/simapp/export.go index 444c21c706e..36749d1a777 100644 --- a/testing/simapp/export.go +++ b/testing/simapp/export.go @@ -28,7 +28,7 @@ func (app *SimApp) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.mm.ExportGenesis(ctx, app.appCodec) + genState := app.ModuleManager.ExportGenesis(ctx, app.appCodec) appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err diff --git a/testing/simapp/params/encoding.go b/testing/simapp/params/encoding.go index 3d634abf16b..8ff9ea04b39 100644 --- a/testing/simapp/params/encoding.go +++ b/testing/simapp/params/encoding.go @@ -10,7 +10,7 @@ import ( // This is provided for compatibility between protobuf and amino implementations. type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Codec + Codec codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino } diff --git a/testing/simapp/params/proto.go b/testing/simapp/params/proto.go index a752d107907..2a38fff0400 100644 --- a/testing/simapp/params/proto.go +++ b/testing/simapp/params/proto.go @@ -16,12 +16,12 @@ import ( func MakeTestEncodingConfig() EncodingConfig { cdc := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) + codec := codec.NewProtoCodec(interfaceRegistry) return EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), + Codec: codec, + TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), Amino: cdc, } } diff --git a/testing/simapp/sim_bench_test.go b/testing/simapp/sim_bench_test.go index 4146da0a4b8..795cd05ff14 100644 --- a/testing/simapp/sim_bench_test.go +++ b/testing/simapp/sim_bench_test.go @@ -6,40 +6,53 @@ import ( "testing" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" ) // Profile with: -// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/ibc-go/v7/testing/simapp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out +// /usr/local/go/bin/go test -benchmem -run=^$ cosmossdk.io/simapp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { b.ReportAllocs() - config, db, dir, logger, _, err := SetupSimulation("goleveldb-app-sim", "Simulation") + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "goleveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if err != nil { b.Fatalf("simulation setup failed: %s", err.Error()) } + if skip { + b.Skip("skipping benchmark application simulation") + } + defer func() { - db.Close() - err = os.RemoveAll(dir) - if err != nil { - b.Fatal(err) - } + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + app := NewSimApp(logger, db, nil, true, appOptions, interBlockCacheOpt()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) @@ -60,32 +73,41 @@ func BenchmarkFullAppSimulation(b *testing.B) { func BenchmarkInvariants(b *testing.B) { b.ReportAllocs() - config, db, dir, logger, _, err := SetupSimulation("leveldb-app-invariant-bench", "Simulation") + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-invariant-bench", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if err != nil { b.Fatalf("simulation setup failed: %s", err.Error()) } + if skip { + b.Skip("skipping benchmark application simulation") + } + config.AllInvariants = false defer func() { - db.Close() - err = os.RemoveAll(dir) - if err != nil { - b.Fatal(err) - } + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + app := NewSimApp(logger, db, nil, true, appOptions, interBlockCacheOpt()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 5e4bcaa9d69..c47af00413c 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -73,7 +73,7 @@ func TestFullAppSimulation(t *testing.T) { require.NoError(t, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + app := NewSimApp(logger, db, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", app.Name()) // run randomized simulation @@ -111,7 +111,7 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + app := NewSimApp(logger, db, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", app.Name()) // Run randomized simulation diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 64226ae9d74..01a8c9b5465 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -50,9 +50,9 @@ var DefaultConsensusParams = &tmproto.ConsensusParams{ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { db := dbm.NewMemDB() encCdc := MakeTestEncodingConfig() - app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, simtestutil.EmptyAppOptions{}) + app := NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) if withGenesis { - return app, NewDefaultGenesisState(encCdc.Marshaler) + return app, NewDefaultGenesisState(encCdc.Codec) } return app, GenesisState{} } From 3d8e5e8af5e0eb4b8cb15b306930ce84b5419e9b Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 15:19:15 +0800 Subject: [PATCH 03/59] make the simapp folder resemble upstream's --- go.mod | 4 +- testing/simapp/sim_test.go | 2 +- testing/simapp/simd/cmd/cmd_test.go | 25 +++- testing/simapp/simd/cmd/root.go | 173 ++++++++++++---------------- testing/simapp/simd/main.go | 5 +- 5 files changed, 101 insertions(+), 108 deletions(-) diff --git a/go.mod b/go.mod index 3a637cbf22f..cd6a1b10aa7 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.1 + cosmossdk.io/tools/rosetta v0.2.1 github.com/armon/go-metrics v0.4.1 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 @@ -18,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/viper v1.16.0 github.com/stretchr/testify v1.8.4 google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 google.golang.org/grpc v1.56.0 @@ -34,7 +36,6 @@ require ( cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/log v1.1.0 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -139,7 +140,6 @@ require ( 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/spf13/viper v1.16.0 // 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 diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index c47af00413c..d346d00c254 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -151,7 +151,7 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", newApp.Name()) var genesisState GenesisState diff --git a/testing/simapp/simd/cmd/cmd_test.go b/testing/simapp/simd/cmd/cmd_test.go index 4ac8843035a..15cc433cab4 100644 --- a/testing/simapp/simd/cmd/cmd_test.go +++ b/testing/simapp/simd/cmd/cmd_test.go @@ -4,21 +4,40 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/testing/simapp" "github.com/cosmos/ibc-go/v7/testing/simapp/simd/cmd" ) func TestInitCmd(t *testing.T) { - rootCmd, _ := cmd.NewRootCmd() + rootCmd := cmd.NewRootCmd() rootCmd.SetArgs([]string{ "init", // Test the init cmd "simapp-test", // Moniker fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists }) - require.NoError(t, svrcmd.Execute(rootCmd, "simd", simapp.DefaultNodeHome)) + require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome)) +} + +func TestHomeFlagRegistration(t *testing.T) { + homeDir := "/tmp/foo" + + rootCmd := cmd.NewRootCmd() + rootCmd.SetArgs([]string{ + "query", + fmt.Sprintf("--%s", flags.FlagHome), + homeDir, + }) + + require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome)) + + result, err := rootCmd.Flags().GetString(flags.FlagHome) + require.NoError(t, err) + require.Equal(t, result, homeDir) } diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index ad020c353bc..74736086c2d 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -1,35 +1,32 @@ package cmd import ( + rosettaCmd "cosmossdk.io/tools/rosetta/cmd" "errors" + "github.com/spf13/viper" "io" "os" - "path/filepath" dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" 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" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/testing/simapp" @@ -38,10 +35,18 @@ import ( // NewRootCmd creates a new root command for simd. It is called once in the // main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := simapp.MakeTestEncodingConfig() +func NewRootCmd() *cobra.Command { + // we "pre"-instantiate the application for getting the injected/configured encoding configuration + tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(simapp.DefaultNodeHome)) + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: tempApp.InterfaceRegistry(), + Codec: tempApp.AppCodec(), + TxConfig: tempApp.TxConfig(), + Amino: tempApp.LegacyAmino(), + } + initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). + WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). @@ -81,7 +86,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { initRootCmd(rootCmd, encodingConfig) - return rootCmd, encodingConfig + return rootCmd } // initTendermintConfig helps to override default Tendermint Config values. @@ -132,6 +137,7 @@ func initAppConfig() (string, interface{}) { // // In simapp, we set the min gas prices to 0. srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default customAppConfig := CustomAppConfig{ Config: *srvCfg, @@ -158,34 +164,48 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome), - genesisCommand(encodingConfig), - tmcli.NewCompletionCmd(rootCmd, true), + // NewTestnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(), config.Cmd(), + pruning.PruningCmd(newApp), + snapshot.Cmd(newApp), ) - a := appCreator{encodingConfig} - server.AddCommands(rootCmd, simapp.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) + server.AddCommands(rootCmd, simapp.DefaultNodeHome, newApp, appExport, addModuleInitFlags) - // add keybase, auxiliary RPC, query, and tx child commands + // add keybase, auxiliary RPC, query, genesis, and tx child commands rootCmd.AddCommand( rpc.StatusCommand(), + genesisCommand(encodingConfig), queryCommand(), txCommand(), keys.Commands(simapp.DefaultNodeHome), ) + + // add rosetta + rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) } func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) } +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, simapp.ModuleBasics, simapp.DefaultNodeHome) + + for _, sub_cmd := range cmds { + cmd.AddCommand(sub_cmd) + } + return cmd +} + func queryCommand() *cobra.Command { cmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, Short: "Querying subcommands", - DisableFlagParsing: true, + DisableFlagParsing: false, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } @@ -199,7 +219,6 @@ func queryCommand() *cobra.Command { ) simapp.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } @@ -208,7 +227,7 @@ func txCommand() *cobra.Command { cmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", - DisableFlagParsing: true, + DisableFlagParsing: false, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } @@ -222,112 +241,68 @@ func txCommand() *cobra.Command { authcmd.GetBroadcastCommand(), authcmd.GetEncodeCommand(), authcmd.GetDecodeCommand(), + authcmd.GetAuxToFeeCommand(), ) simapp.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } -// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { - cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, simapp.ModuleBasics, simapp.DefaultNodeHome) - - for _, subCmd := range cmds { - cmd.AddCommand(subCmd) - } - return cmd -} +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { -type appCreator struct { - encCfg params.EncodingConfig -} - -// newApp is an appCreator -func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { - var cache sdk.MultiStorePersistentCache - - if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { - cache = store.NewCommitKVStoreCacheManager() - } - - skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - - pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) - if err != nil { - panic(err) - } - - homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) - chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) - if chainID == "" { - // fallback to genesis chain-id - appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) - if err != nil { - panic(err) - } - - chainID = appGenesis.ChainID - } - - snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := dbm.NewDB("metadata", server.GetAppDBBackend(appOpts), snapshotDir) - if err != nil { - panic(err) - } - snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) - if err != nil { - panic(err) - } - - snapshotOptions := snapshottypes.NewSnapshotOptions( - cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), - cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), - ) + baseappOptions := server.DefaultBaseappOptions(appOpts) return simapp.NewSimApp( - logger, db, traceStore, true, skipUpgradeHeights, - cast.ToString(appOpts.Get(flags.FlagHome)), - cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - a.encCfg, + logger, db, traceStore, true, appOpts, - baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), - baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), - baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), - baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), - baseapp.SetInterBlockCache(cache), - baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), - baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), - baseapp.SetSnapshot(snapshotStore, snapshotOptions), - baseapp.SetChainID(chainID), + baseappOptions..., ) } -// appExport creates a new simapp (optionally at a given height) -// and exports state. -func (a appCreator) appExport( - logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, - appOpts servertypes.AppOptions, modulesToExport []string, +// appExport creates a new simapp (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, ) (servertypes.ExportedApp, error) { var simApp *simapp.SimApp + + // this check is necessary as we use the flag in x/upgrade. + // we can exit more gracefully by checking the flag here. homePath, ok := appOpts.Get(flags.FlagHome).(string) if !ok || homePath == "" { return servertypes.ExportedApp{}, errors.New("application home not set") } + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + if height != -1 { - simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, homePath, uint(1), a.encCfg, appOpts) + simApp = simapp.NewSimApp(logger, db, traceStore, false, appOpts) if err := simApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, homePath, uint(1), a.encCfg, appOpts) + simApp = simapp.NewSimApp(logger, db, traceStore, true, appOpts) } return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) diff --git a/testing/simapp/simd/main.go b/testing/simapp/simd/main.go index 07b2ab96848..b431382a732 100644 --- a/testing/simapp/simd/main.go +++ b/testing/simapp/simd/main.go @@ -11,9 +11,8 @@ import ( ) func main() { - rootCmd, _ := cmd.NewRootCmd() - - if err := svrcmd.Execute(rootCmd, "simd", simapp.DefaultNodeHome); err != nil { + rootCmd := cmd.NewRootCmd() + if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) From 3fb55cd070256ffd21681515418ca0fcb25c77bd Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 15:42:58 +0800 Subject: [PATCH 04/59] now we are basically in line with upstream --- testing/simapp/app.go | 3 + testing/simapp/sim_test.go | 124 +++++++++++++++++++++++++------------ 2 files changed, 89 insertions(+), 38 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 7a449a82554..b9db61dafa0 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -641,12 +641,15 @@ func NewSimApp( evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, + nft.ModuleName, ) + app.ModuleManager.SetOrderEndBlockers( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, + nft.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index d346d00c254..21b1a670d30 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -3,8 +3,14 @@ package simapp import ( "encoding/json" "fmt" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" "math/rand" "os" + "runtime/debug" + "strings" "testing" dbm "github.com/cometbft/cometbft-db" @@ -13,7 +19,6 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -40,7 +45,7 @@ const SimAppChainID = "simulation-app" // Get flags every time the simulator is run func init() { - GetSimulatorFlags() + simcli.GetSimulatorFlags() } type StoreKeysPrefixes struct { @@ -73,7 +78,11 @@ func TestFullAppSimulation(t *testing.T) { require.NoError(t, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + app := NewSimApp(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", app.Name()) // run randomized simulation @@ -81,10 +90,10 @@ func TestFullAppSimulation(t *testing.T) { t, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) @@ -100,18 +109,25 @@ func TestFullAppSimulation(t *testing.T) { } func TestAppImportExport(t *testing.T) { - config, db, dir, logger, skip, err := SetupSimulation("leveldb-app-sim", "Simulation") + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if skip { t.Skip("skipping application import/export simulation") } require.NoError(t, err, "simulation setup failed") defer func() { - db.Close() + require.NoError(t, db.Close()) require.NoError(t, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + app := NewSimApp(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", app.Name()) // Run randomized simulation @@ -119,10 +135,10 @@ func TestAppImportExport(t *testing.T) { t, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) @@ -143,38 +159,49 @@ func TestAppImportExport(t *testing.T) { fmt.Printf("importing genesis...\n") - _, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2") + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) require.NoError(t, err, "simulation setup failed") defer func() { - newDB.Close() + require.NoError(t, newDB.Close()) require.NoError(t, os.RemoveAll(newDir)) }() - newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", newApp.Name()) var genesisState GenesisState err = json.Unmarshal(exported.AppState, &genesisState) require.NoError(t, err) + defer func() { + if r := recover(); r != nil { + err := fmt.Sprintf("%v", r) + if !strings.Contains(err, "validator set is empty after InitGenesis") { + panic(r) + } + logger.Info("Skipping simulation as all validators have been unbonded") + logger.Info("err", err, "stacktrace", string(debug.Stack())) + } + }() + ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - newApp.mm.InitGenesis(ctxB, app.AppCodec(), genesisState) + newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) fmt.Printf("comparing stores...\n") storeKeysPrefixes := []StoreKeysPrefixes{ - {app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}}, + {app.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, { - app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey], + app.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), [][]byte{ stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, }, }, // ordering may change but it doesn't matter - {app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}}, + {app.GetKey(slashingtypes.StoreKey), newApp.keys[slashingtypes.StoreKey], [][]byte{}}, {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}}, {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}}, {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, @@ -195,23 +222,30 @@ func TestAppImportExport(t *testing.T) { require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, len(failedKVAs), 0, simtestutil.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) } } func TestAppSimulationAfterImport(t *testing.T) { - config, db, dir, logger, skip, err := SetupSimulation("leveldb-app-sim", "Simulation") + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if skip { t.Skip("skipping application simulation after import") } require.NoError(t, err, "simulation setup failed") defer func() { - db.Close() + require.NoError(t, db.Close()) require.NoError(t, os.RemoveAll(dir)) }() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + app := NewSimApp(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", app.Name()) // Run randomized simulation @@ -219,10 +253,10 @@ func TestAppSimulationAfterImport(t *testing.T) { t, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) @@ -248,29 +282,30 @@ func TestAppSimulationAfterImport(t *testing.T) { fmt.Printf("importing genesis...\n") - _, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2") + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) require.NoError(t, err, "simulation setup failed") defer func() { - newDB.Close() + require.NoError(t, newDB.Close()) require.NoError(t, os.RemoveAll(newDir)) }() - newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "SimApp", newApp.Name()) newApp.InitChain(abci.RequestInitChain{ + ChainId: SimAppChainID, AppStateBytes: exported.AppState, }) _, _, err = simulation.SimulateFromSeed( t, os.Stdout, - newApp.GetBaseApp(), - AppStateFn(app.AppCodec(), app.SimulationManager()), + newApp.BaseApp, + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) @@ -280,34 +315,47 @@ func TestAppSimulationAfterImport(t *testing.T) { // TODO: Make another test for the fuzzer itself, which just has noOp txs // and doesn't depend on the application. func TestAppStateDeterminism(t *testing.T) { - if !FlagEnabledValue { + if !simcli.FlagEnabledValue { t.Skip("skipping application simulation") } - config := NewConfigFromFlags() + config := simcli.NewConfigFromFlags() config.InitialBlockHeight = 1 config.ExportParamsPath = "" config.OnOperation = false config.AllInvariants = false - config.ChainID = "simulation-app" + config.ChainID = SimAppChainID numSeeds := 3 numTimesToRunPerSeed := 5 + + // We will be overriding the random seed and just run a single simulation on the provided seed value + if config.Seed != simcli.DefaultSeedValue { + numSeeds = 1 + } + appHashList := make([]json.RawMessage, numTimesToRunPerSeed) + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue for i := 0; i < numSeeds; i++ { - config.Seed = rand.Int63() + if config.Seed == simcli.DefaultSeedValue { + config.Seed = rand.Int63() + } + + fmt.Println("config.Seed: ", config.Seed) for j := 0; j < numTimesToRunPerSeed; j++ { var logger log.Logger - if FlagVerboseValue { + if simcli.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() } db := dbm.NewMemDB() - app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, MakeTestEncodingConfig(), simtestutil.EmptyAppOptions{}, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) + app := NewSimApp(logger, db, nil, true, appOptions, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) fmt.Printf( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", @@ -318,10 +366,10 @@ func TestAppStateDeterminism(t *testing.T) { t, os.Stdout, app.BaseApp, - AppStateFn(app.AppCodec(), app.SimulationManager()), + simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + BlockedAddresses(), config, app.AppCodec(), ) From 1d052eca6618a7dc516e64a1f0a1e54d244d94e8 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 22:49:57 +0800 Subject: [PATCH 05/59] fix more tests --- testing/simapp/sim_test.go | 9 +++++---- testing/simapp/simd/cmd/root.go | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 21b1a670d30..601fc230af3 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -3,16 +3,17 @@ package simapp import ( "encoding/json" "fmt" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" "math/rand" "os" "runtime/debug" "strings" "testing" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 74736086c2d..b165d7d1ac1 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -1,12 +1,14 @@ package cmd import ( - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" "errors" - "github.com/spf13/viper" "io" "os" + rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + + "github.com/spf13/viper" + dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" @@ -256,7 +258,6 @@ func newApp( traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { - baseappOptions := server.DefaultBaseappOptions(appOpts) return simapp.NewSimApp( From c19cde75a248d850c2801bd272afda645eb7e112 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 23:11:17 +0800 Subject: [PATCH 06/59] use bumped interchaintest --- e2e/go.mod | 21 +++++++++++---------- e2e/go.sum | 42 ++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index 33eb66da61e..8f913df2723 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -10,7 +10,7 @@ require ( github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.1.0 github.com/cosmos/interchain-accounts v0.5.1 - github.com/docker/docker v20.10.19+incompatible + github.com/docker/docker v24.0.1+incompatible github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.24.0 @@ -33,7 +33,7 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/BurntSushi/toml v1.3.2 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect @@ -72,13 +72,13 @@ require ( github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/base58 v1.0.4 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -165,7 +165,7 @@ require ( github.com/pierrec/xxHash v0.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_golang v1.15.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect @@ -175,7 +175,6 @@ require ( github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cast v1.5.1 // indirect @@ -195,16 +194,16 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.9.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect + golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/term v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.8.0 // indirect + golang.org/x/tools v0.9.3 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.122.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -221,7 +220,7 @@ require ( modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.5.0 // indirect modernc.org/opt v0.1.3 // indirect - modernc.org/sqlite v1.22.1 // indirect + modernc.org/sqlite v1.23.1 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.1.0 // indirect nhooyr.io/websocket v1.8.7 // indirect @@ -236,6 +235,8 @@ replace ( github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7 ) +replace github.com/strangelove-ventures/interchaintest/v7 => github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49 + // uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. replace github.com/cosmos/ibc-go/v7 => ../ diff --git a/e2e/go.sum b/e2e/go.sum index 93fccbeb0ba..0e4b9cc140e 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -211,8 +211,8 @@ github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XB github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= @@ -386,8 +386,8 @@ github.com/decred/dcrd/chaincfg/chainhash v1.0.2 h1:rt5Vlq/jM3ZawwiacWjPa+smINyL github.com/decred/dcrd/chaincfg/chainhash v1.0.2/go.mod h1:BpbrGgrPTr3YJYRN3Bm+D9NuaFd+zGyNeIKgrhCXK60= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0 h1:3GIJYXQDAKpLEFriGFN8SbSffak10UXHGdIcFaMPykY= -github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0/go.mod h1:3s92l0paYkZoIHuj4X93Teg/HB7eGM9x/zokGw+u4mY= +github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 h1:18HurQ6DfHeNvwIjvOmrgr44bPdtVaQAe/WWwHg9goM= +github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1/go.mod h1:XmyzkaXBy7ZvHdrTAlXAjpog8qKSAWa3ze7yqzWmgmc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= @@ -401,10 +401,10 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.19+incompatible h1:lzEmjivyNHFHMNAFLXORMBXyGIhw/UP4DvJwvyKYq64= -github.com/docker/docker v20.10.19+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v24.0.1+incompatible h1:NxN81beIxDlUaVt46iUQrYHD9/W3u9EGl52r86O/IGw= +github.com/docker/docker v24.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -432,6 +432,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.11.2 h1:z/luyejbevDCAMUUiu0rc80dxJxOnpoG58k5o0tSawc= github.com/ethereum/go-ethereum v1.11.2/go.mod h1:DuefStAgaxoaYGLR0FueVcVbehmn5n9QUcVrMCuOvuc= +github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49 h1:rYGbq/p+TPhngq40Kn5Fe/iEXM8yJS9K6DtFg7LnLSs= +github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49/go.mod h1:G7QMBdY/MQLIYEGyqAWFnQG0+exGnJjoWnUtrZRkkcQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= @@ -893,8 +895,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -955,7 +957,6 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -983,8 +984,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= -github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 h1:+FRVLRfJwZNkkipuPuK+FyY/5ZEkAjAjtiWQg6qc550= -github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7/go.mod h1:/FpoaMKTF3OREchZZvg6eGfVYvk7lAwqP9q2TN+lOGs= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1069,8 +1068,8 @@ go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= @@ -1239,8 +1238,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1333,7 +1332,6 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1426,8 +1424,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1732,8 +1730,8 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.22.1 h1:P2+Dhp5FR1RlVRkQ3dDfCiv3Ok8XPxqpe70IjYVA9oE= -modernc.org/sqlite v1.22.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= +modernc.org/sqlite v1.23.1 h1:nrSBg4aRQQwq59JpvGEQ15tNxoO5pX/kUjcRNwSAGQM= +modernc.org/sqlite v1.23.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= From 437b004f18a2d85788a37f165c71873a1ba06855 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 17 Jun 2023 23:18:55 +0800 Subject: [PATCH 07/59] use self-referent interchaintest --- e2e/go.mod | 2 +- e2e/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index 8f913df2723..449e7667bc6 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -235,7 +235,7 @@ replace ( github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7 ) -replace github.com/strangelove-ventures/interchaintest/v7 => github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49 +replace github.com/strangelove-ventures/interchaintest/v7 => github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e // uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. replace github.com/cosmos/ibc-go/v7 => ../ diff --git a/e2e/go.sum b/e2e/go.sum index 0e4b9cc140e..026e6b2afc0 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -432,8 +432,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.11.2 h1:z/luyejbevDCAMUUiu0rc80dxJxOnpoG58k5o0tSawc= github.com/ethereum/go-ethereum v1.11.2/go.mod h1:DuefStAgaxoaYGLR0FueVcVbehmn5n9QUcVrMCuOvuc= -github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49 h1:rYGbq/p+TPhngq40Kn5Fe/iEXM8yJS9K6DtFg7LnLSs= -github.com/faddat/ibctest/v7 v7.0.0-20230617145548-378c5cfcee49/go.mod h1:G7QMBdY/MQLIYEGyqAWFnQG0+exGnJjoWnUtrZRkkcQ= +github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e h1:5/pvLDbpUmxQN31DZT/HfERX5u7h0vAogCUVL4wyDOM= +github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e/go.mod h1:e9Efky+L7EfeZID8/dneMUPRt/ZkNs1RaY3B4PoxrU0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= From ea39d8e2c1027fcd688fecd8f68160eec43115f1 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 12:39:48 +0800 Subject: [PATCH 08/59] continue to make this simapp mor resemble the sdk's --- testing/simapp/app.go | 13 +++++--- testing/simapp/sim_test.go | 40 +++++++++++++---------- testing/simapp/simd/cmd/cmd_test.go | 6 ++-- testing/simapp/simd/cmd/root.go | 6 ++-- testing/simapp/{upgrades => }/upgrades.go | 2 +- 5 files changed, 38 insertions(+), 29 deletions(-) rename testing/simapp/{upgrades => }/upgrades.go (99%) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index b9db61dafa0..eeef3e3e817 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,7 +2,6 @@ package simapp import ( "encoding/json" - "fmt" "io" "os" "path/filepath" @@ -12,7 +11,6 @@ import ( dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" "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 @@ -126,7 +124,6 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibcmock "github.com/cosmos/ibc-go/v7/testing/mock" simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params" - "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" ) @@ -324,11 +321,14 @@ func NewSimApp( bApp.SetTxEncoder(txConfig.TxEncoder()) keys := sdk.NewKVStoreKeys( + // 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, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, + evidencetypes.StoreKey, consensusparamtypes.StoreKey, + // IBC Keys + ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + authzkeeper.StoreKey, ibcfeetypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -966,6 +966,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino return paramsKeeper } +/* // setupUpgradeHandlers sets all necessary upgrade handlers for testing purposes func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( @@ -1006,6 +1007,7 @@ func (app *SimApp) setupUpgradeHandlers() { ) } + // setupUpgradeStoreLoaders sets all necessary store loaders required by upgrades. func (app *SimApp) setupUpgradeStoreLoaders() { upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() @@ -1025,6 +1027,7 @@ func (app *SimApp) setupUpgradeStoreLoaders() { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } +*/ func makeEncodingConfig() simappparams.EncodingConfig { encodingConfig := simappparams.MakeTestEncodingConfig() diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 601fc230af3..6d810bc6e7e 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -9,15 +9,18 @@ import ( "strings" "testing" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/store" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -34,9 +37,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/stretchr/testify/require" + // IBC + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) @@ -68,14 +71,17 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) { } func TestFullAppSimulation(t *testing.T) { - config, db, dir, logger, skip, err := SetupSimulation("leveldb-app-sim", "Simulation") + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if skip { t.Skip("skipping application simulation") } require.NoError(t, err, "simulation setup failed") defer func() { - db.Close() + require.NoError(t, db.Close()) require.NoError(t, os.RemoveAll(dir)) }() @@ -203,16 +209,16 @@ func TestAppImportExport(t *testing.T) { }, }, // ordering may change but it doesn't matter {app.GetKey(slashingtypes.StoreKey), newApp.keys[slashingtypes.StoreKey], [][]byte{}}, - {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}}, - {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}}, - {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, - {app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}}, - {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}}, - {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, - {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, - {app.keys[ibcexported.StoreKey], newApp.keys[ibcexported.StoreKey], [][]byte{}}, - {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, - {app.keys[authzkeeper.StoreKey], newApp.keys[authzkeeper.StoreKey], [][]byte{}}, + {app.GetKey(minttypes.StoreKey), newApp.keys[minttypes.StoreKey], [][]byte{}}, + {app.GetKey(distrtypes.StoreKey), newApp.keys[distrtypes.StoreKey], [][]byte{}}, + {app.GetKey(banktypes.StoreKey), newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, + {app.GetKey(paramtypes.StoreKey), newApp.keys[paramtypes.StoreKey], [][]byte{}}, + {app.GetKey(govtypes.StoreKey), newApp.keys[govtypes.StoreKey], [][]byte{}}, + {app.GetKey(evidencetypes.StoreKey), newApp.keys[evidencetypes.StoreKey], [][]byte{}}, + {app.GetKey(capabilitytypes.StoreKey), newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, + {app.GetKey(ibcexported.StoreKey), newApp.keys[ibcexported.StoreKey], [][]byte{}}, + {app.GetKey(ibctransfertypes.StoreKey), newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, + {app.GetKey(authzkeeper.StoreKey), newApp.keys[authzkeeper.StoreKey], [][]byte{}}, } for _, skp := range storeKeysPrefixes { diff --git a/testing/simapp/simd/cmd/cmd_test.go b/testing/simapp/simd/cmd/cmd_test.go index 15cc433cab4..2b00c69b0b1 100644 --- a/testing/simapp/simd/cmd/cmd_test.go +++ b/testing/simapp/simd/cmd/cmd_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/ibc-go/v7/testing/simapp" + "github.com/cosmos/ibc-go/v7/testing/simapp/simd/cmd" + "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - - "github.com/cosmos/ibc-go/v7/testing/simapp" - "github.com/cosmos/ibc-go/v7/testing/simapp/simd/cmd" ) func TestInitCmd(t *testing.T) { diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index b165d7d1ac1..2f6d88fa3dd 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -7,11 +7,12 @@ import ( rosettaCmd "cosmossdk.io/tools/rosetta/cmd" - "github.com/spf13/viper" - dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -29,7 +30,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/testing/simapp" "github.com/cosmos/ibc-go/v7/testing/simapp/params" diff --git a/testing/simapp/upgrades/upgrades.go b/testing/simapp/upgrades.go similarity index 99% rename from testing/simapp/upgrades/upgrades.go rename to testing/simapp/upgrades.go index fef17bce5a0..4afaa02b8fd 100644 --- a/testing/simapp/upgrades/upgrades.go +++ b/testing/simapp/upgrades.go @@ -1,4 +1,4 @@ -package upgrades +package simapp import ( "github.com/cosmos/cosmos-sdk/baseapp" From b9b793358a3bea56a99bd239ab7ae55b58fe5f87 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 12:48:43 +0800 Subject: [PATCH 09/59] buf mod update & fix a call in the capability module --- go.work.example | 3 ++- modules/capability/genesis_test.go | 3 +-- proto/buf.lock | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/go.work.example b/go.work.example index 5481cb3c915..e4e432f921c 100644 --- a/go.work.example +++ b/go.work.example @@ -1,6 +1,7 @@ -go 1.19 +go 1.20 use ( + ./modules/capability ./ ./e2e ) diff --git a/modules/capability/genesis_test.go b/modules/capability/genesis_test.go index 9007ee63ffa..51c52901d39 100644 --- a/modules/capability/genesis_test.go +++ b/modules/capability/genesis_test.go @@ -35,8 +35,7 @@ func (suite *CapabilityTestSuite) TestGenesis() { // create new app that does not share persistent or in-memory state // and initialize app from exported genesis state above. db := dbm.NewMemDB() - encCdc := simapp.MakeTestEncodingConfig() - newApp := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, encCdc, simtestutil.EmptyAppOptions{}) + newApp := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) newKeeper := keeper.NewKeeper(suite.cdc, newApp.GetKey(types.StoreKey), newApp.GetMemKey(types.MemStoreKey)) newSk1 := newKeeper.ScopeToModule(banktypes.ModuleName) diff --git a/proto/buf.lock b/proto/buf.lock index 373656974b8..7906031c41a 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -5,19 +5,24 @@ deps: owner: cosmos repository: cosmos-proto commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 - remote: buf.build owner: cosmos repository: cosmos-sdk commit: 954f7b05f38440fc8250134b15adec47 + digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54 - remote: buf.build owner: cosmos repository: gogo-proto commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 - remote: buf.build owner: cosmos repository: ics23 commit: 55085f7c710a45f58fa09947208eb70b + digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 - remote: buf.build owner: googleapis repository: googleapis commit: 8d7204855ec14631a499bd7393ce1970 + digest: shake256:40bf4112960cad01281930beed85829910768e32e80e986791596853eccd42c0cbd9d96690b918f658020d2d427e16f8b6514e2ac7f4a10306fd32e77be44329 From d444a162678f7c0fa21e52d1d68bb28ea31ad9aa Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 14:19:52 +0800 Subject: [PATCH 10/59] use IBC's NewMemoryStoreKeys --- testing/simapp/app.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index eeef3e3e817..63e8ff9485a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -324,17 +324,18 @@ 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, group.StoreKey, nftkeeper.StoreKey, paramstypes.StoreKey, + upgradetypes.StoreKey, feegrant.StoreKey, + evidencetypes.StoreKey, consensusparamtypes.StoreKey, authzkeeper.StoreKey, // IBC Keys ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, ibcfeetypes.StoreKey, + ibcfeetypes.StoreKey, ibcexported.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) // load state streaming if enabled if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { From f91d1f12f3855e01c53a13da9b7baf9fefb200c1 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 14:20:29 +0800 Subject: [PATCH 11/59] add "testingkey" --- testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 63e8ff9485a..70c07545c7d 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -335,7 +335,7 @@ func NewSimApp( tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. - 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 { From 7070fc04b098865397daff3d61142ad84e0bfe39 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 14:49:30 +0800 Subject: [PATCH 12/59] more closely follow sdk style --- .../apps/transfer/simulation/decoder_test.go | 2 +- modules/capability/capability_test.go | 2 +- modules/capability/simulation/decoder_test.go | 2 +- modules/core/02-client/keeper/keeper_test.go | 2 +- .../core/02-client/simulation/decoder_test.go | 2 +- .../03-connection/simulation/decoder_test.go | 2 +- modules/core/03-connection/types/msgs_test.go | 2 +- .../04-channel/simulation/decoder_test.go | 2 +- modules/core/04-channel/types/msgs_test.go | 2 +- modules/core/05-port/keeper/keeper_test.go | 2 +- modules/core/genesis_test.go | 2 +- modules/core/simulation/decoder_test.go | 2 +- .../07-tendermint/tendermint_test.go | 2 +- testing/simapp/test_helpers.go | 204 ++++++++++-------- 14 files changed, 133 insertions(+), 97 deletions(-) diff --git a/modules/apps/transfer/simulation/decoder_test.go b/modules/apps/transfer/simulation/decoder_test.go index 26d7dbf4b94..654aba6688a 100644 --- a/modules/apps/transfer/simulation/decoder_test.go +++ b/modules/apps/transfer/simulation/decoder_test.go @@ -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{ diff --git a/modules/capability/capability_test.go b/modules/capability/capability_test.go index 3ca68b237cd..54367c7373b 100644 --- a/modules/capability/capability_test.go +++ b/modules/capability/capability_test.go @@ -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 diff --git a/modules/capability/simulation/decoder_test.go b/modules/capability/simulation/decoder_test.go index 2184e71cf58..167d53dd4e4 100644 --- a/modules/capability/simulation/decoder_test.go +++ b/modules/capability/simulation/decoder_test.go @@ -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{ diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 50d6fedc23e..23b1b4d3c34 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -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}) diff --git a/modules/core/02-client/simulation/decoder_test.go b/modules/core/02-client/simulation/decoder_test.go index 0fbaef2693c..19e6b6f9de1 100644 --- a/modules/core/02-client/simulation/decoder_test.go +++ b/modules/core/02-client/simulation/decoder_test.go @@ -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) diff --git a/modules/core/03-connection/simulation/decoder_test.go b/modules/core/03-connection/simulation/decoder_test.go index d93c1f10742..698bfda539d 100644 --- a/modules/core/03-connection/simulation/decoder_test.go +++ b/modules/core/03-connection/simulation/decoder_test.go @@ -14,7 +14,7 @@ import ( ) func TestDecodeStore(t *testing.T) { - app := simapp.Setup(false) + app := simapp.Setup(t, false) cdc := app.AppCodec() connectionID := "connectionidone" diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 2f609c8bbc9..125676fbb35 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -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) diff --git a/modules/core/04-channel/simulation/decoder_test.go b/modules/core/04-channel/simulation/decoder_test.go index 64fd06d89f9..67883b4f6e4 100644 --- a/modules/core/04-channel/simulation/decoder_test.go +++ b/modules/core/04-channel/simulation/decoder_test.go @@ -15,7 +15,7 @@ import ( ) func TestDecodeStore(t *testing.T) { - app := simapp.Setup(false) + app := simapp.Setup(t, false) cdc := app.AppCodec() channelID := "channelidone" diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index 0d459dde865..1c59920ae3c 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -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) diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index b0459afa564..476b871b076 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -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 diff --git a/modules/core/genesis_test.go b/modules/core/genesis_test.go index 51ba25a9ea0..9d07dae91b4 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -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) diff --git a/modules/core/simulation/decoder_test.go b/modules/core/simulation/decoder_test.go index bf0388ccd69..4bd39e8395d 100644 --- a/modules/core/simulation/decoder_test.go +++ b/modules/core/simulation/decoder_test.go @@ -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" diff --git a/modules/light-clients/07-tendermint/tendermint_test.go b/modules/light-clients/07-tendermint/tendermint_test.go index 3879282ef35..6676e459b64 100644 --- a/modules/light-clients/07-tendermint/tendermint_test.go +++ b/modules/light-clients/07-tendermint/tendermint_test.go @@ -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() diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 01a8c9b5465..0ed6f3fd27d 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -2,11 +2,21 @@ package simapp import ( "encoding/json" + "fmt" "math/rand" + "os" "testing" "time" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" + "github.com/cosmos/cosmos-sdk/testutil/network" + "github.com/cosmos/cosmos-sdk/types/module/testutil" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" @@ -14,53 +24,44 @@ import ( tmtypes "github.com/cometbft/cometbft/types" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - "github.com/cosmos/ibc-go/v7/testing/mock" + "github.com/stretchr/testify/require" ) -// DefaultConsensusParams defines the default Tendermint consensus params used in -// SimApp testing. -var DefaultConsensusParams = &tmproto.ConsensusParams{ - Block: &tmproto.BlockParams{ - MaxBytes: 200000, - MaxGas: 2000000, - }, - Evidence: &tmproto.EvidenceParams{ - MaxAgeNumBlocks: 302400, - MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration - MaxBytes: 10000, - }, - Validator: &tmproto.ValidatorParams{ - PubKeyTypes: []string{ - tmtypes.ABCIPubKeyTypeEd25519, - }, - }, +// SetupOptions defines arguments that are passed into `Simapp` constructor. +type SetupOptions struct { + Logger log.Logger + DB *dbm.MemDB + AppOpts servertypes.AppOptions } func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { db := dbm.NewMemDB() - encCdc := MakeTestEncodingConfig() - app := NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = invCheckPeriod + + app := NewSimApp(log.NewNopLogger(), db, nil, true, appOptions) if withGenesis { - return app, NewDefaultGenesisState(encCdc.Codec) + return app, app.DefaultGenesis() } return app, GenesisState{} } // Setup initializes a new SimApp. A Nop logger is set in SimApp. -func Setup(isCheckTx bool) *SimApp { +func Setup(t *testing.T, isCheckTx bool) *SimApp { + t.Helper() + privVal := mock.NewPV() - pubKey, _ := privVal.GetPubKey() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) // create validator set with single validator validator := tmtypes.NewValidator(pubKey, 1) @@ -71,10 +72,10 @@ func Setup(isCheckTx bool) *SimApp { acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), } - app := SetupWithGenesisValSet(valSet, []authtypes.GenesisAccount{acc}, balance) + app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance) return app } @@ -83,17 +84,21 @@ func Setup(isCheckTx bool) *SimApp { // that also act as delegators. For simplicity, each validator is bonded with a delegation // of one consensus engine unit in the default token of the simapp from first genesis // account. A Nop logger is set in SimApp. -func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { +func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { + t.Helper() + app, genesisState := setup(true, 5) - genesisState = genesisStateWithValSet(app, genesisState, valSet, genAccs, balances...) + genesisState, err := simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, genAccs, balances...) + require.NoError(t, err) - stateBytes, _ := json.MarshalIndent(genesisState, "", " ") + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) // init chain will set the validator set and initialize the genesis accounts app.InitChain( abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, - ConsensusParams: DefaultConsensusParams, + ConsensusParams: simtestutil.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) @@ -110,65 +115,96 @@ func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.Ge return app } -func genesisStateWithValSet(app *SimApp, genesisState GenesisState, - valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, - balances ...banktypes.Balance, -) GenesisState { - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) +// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts +// that also act as delegators. +func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState { + t.Helper() - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.DefaultPowerReduction - - for _, val := range valSet.Validators { - pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey) - pkAny, _ := codectypes.NewAnyWithValue(pk) - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: sdkmath.LegacyOneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), - MinSelfDelegation: sdkmath.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) + + // create validator set with single validator + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + balances := []banktypes.Balance{ + { + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + }, } - // set validators and delegations - stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) - genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens to total supply - totalSupply = totalSupply.Add(b.Coins...) + genesisState := app.DefaultGenesis() + genesisState, err = simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) + require.NoError(t, err) + + return genesisState +} + +// AddTestAddrsIncremental constructs and returns accNum amount of accounts with an +// initial balance of accAmt in random order +func AddTestAddrsIncremental(app *SimApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress { + return addTestAddrs(app, ctx, accNum, accAmt, simtestutil.CreateIncrementalAccounts) +} + +func addTestAddrs(app *SimApp, ctx sdk.Context, accNum int, accAmt math.Int, strategy simtestutil.GenerateAccountStrategy) []sdk.AccAddress { + testAddrs := strategy(accNum) + + initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) + + for _, addr := range testAddrs { + initAccountWithCoins(app, ctx, addr, initCoins) } - for range delegations { - // add delegated tokens to total supply - totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)) + return testAddrs +} + +func initAccountWithCoins(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + if err != nil { + panic(err) } - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, - }) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) + if err != nil { + panic(err) + } +} - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) +// NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests +func NewTestNetworkFixture() network.TestFixture { + dir, err := os.MkdirTemp("", "simapp") + if err != nil { + panic(fmt.Sprintf("failed creating temporary directory: %v", err)) + } + defer os.RemoveAll(dir) + + app := NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(dir)) + + appCtr := func(val network.ValidatorI) servertypes.Application { + return NewSimApp( + val.GetCtx().Logger, dbm.NewMemDB(), nil, true, + simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir), + bam.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), + bam.SetMinGasPrices(val.GetAppConfig().MinGasPrices), + bam.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)), + ) + } - return genesisState + return network.TestFixture{ + AppConstructor: appCtr, + GenesisState: app.DefaultGenesis(), + EncodingConfig: testutil.TestEncodingConfig{ + InterfaceRegistry: app.InterfaceRegistry(), + Codec: app.AppCodec(), + TxConfig: app.TxConfig(), + Amino: app.LegacyAmino(), + }, + } } // SetupWithGenesisAccounts initializes a new SimApp with the provided genesis @@ -194,7 +230,7 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba app.InitChain( abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, - ConsensusParams: DefaultConsensusParams, + ConsensusParams: simtestutil.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) From a7b34be544284c77d61ecb136cf7b3b26296830c Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 18 Jun 2023 22:12:36 +0700 Subject: [PATCH 13/59] fix nil scoped ibc keeper --- testing/simapp/app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 70c07545c7d..91f6b3bff1a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,6 +2,7 @@ package simapp import ( "encoding/json" + "fmt" "io" "os" "path/filepath" @@ -379,6 +380,8 @@ func NewSimApp( // seal capability keeper after scoping modules app.CapabilityKeeper.Seal() + fmt.Println(app.CapabilityKeeper) + fmt.Println(app.GetScopedIBCKeeper()) // SDK module keepers app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -435,6 +438,7 @@ func NewSimApp( // IBC Keepers + app.ScopedIBCKeeper = scopedIBCKeeper app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) From ce2a5cb6776258592fc31a29f3d9c243c8dcd2d6 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 18 Jun 2023 23:56:14 +0800 Subject: [PATCH 14/59] restore the scoped keepers at the end of app.go --- testing/simapp/app.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 91f6b3bff1a..b3b1ec209ca 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,7 +2,6 @@ package simapp import ( "encoding/json" - "fmt" "io" "os" "path/filepath" @@ -380,8 +379,6 @@ func NewSimApp( // seal capability keeper after scoping modules app.CapabilityKeeper.Seal() - fmt.Println(app.CapabilityKeeper) - fmt.Println(app.GetScopedIBCKeeper()) // SDK module keepers app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -438,7 +435,6 @@ func NewSimApp( // IBC Keepers - app.ScopedIBCKeeper = scopedIBCKeeper app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -745,6 +741,11 @@ func NewSimApp( } } + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // note replicate if you do not need to test core IBC or light clients. app.ScopedIBCMockKeeper = scopedIBCMockKeeper From 4a23663fa6ec9b417a4db381b3f19f849cc5b7e6 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 19 Jun 2023 00:06:49 +0800 Subject: [PATCH 15/59] changelog --- CHANGELOG.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ce39e1786..3ba5fdb65c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,13 +44,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (simapp) [\#3874](https://github.com/cosmos/ibc-go/pull/3874) Refactor simapp to more closely resemble the style used in cosmos-sdk * (tests) [\#3138](https://github.com/cosmos/ibc-go/pull/3138) Support benchmarks and fuzz tests through `testing.TB`. ### Features ### Bug Fixes -## [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0) - 2023-06-09 +## [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0) - 2023-06-09 ### Dependencies @@ -71,10 +72,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/04-channel) [\#3346](https://github.com/cosmos/ibc-go/pull/3346) Properly handle ordered channels in `UnreceivedPackets` query. * (core/04-channel) [\#3593](https://github.com/cosmos/ibc-go/pull/3593) `SendPacket` now correctly returns `ErrClientNotFound` in favour of `ErrConsensusStateNotFound`. -## [v7.0.1](https://github.com/cosmos/ibc-go/releases/tag/v7.0.1) - 2023-05-25 +## [v7.0.1](https://github.com/cosmos/ibc-go/releases/tag/v7.0.1) - 2023-05-25 ### Bug Fixes - + * [\#3346](https://github.com/cosmos/ibc-go/pull/3346) Properly handle ordered channels in `UnreceivedPackets` query. ## [v7.0.0](https://github.com/cosmos/ibc-go/releases/tag/v7.0.0) - 2023-03-17 @@ -107,7 +108,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps) [\#3149](https://github.com/cosmos/ibc-go/pull/3149) Remove legacy interface function `RandomizedParams`, which is no longer used. * (light-clients/06-solomachine) [\#2941](https://github.com/cosmos/ibc-go/pull/2941) Remove solomachine header sequence. * (core) [\#2982](https://github.com/cosmos/ibc-go/pull/2982) Moved the ibc module name into the exported package. - + ### State Machine Breaking * (06-solomachine) [\#2744](https://github.com/cosmos/ibc-go/pull/2744) `Misbehaviour.ValidateBasic()` now only enforces that signature data does not match when the signature paths are different. @@ -137,16 +138,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (modules/core/02-client) [\#1741](https://github.com/cosmos/ibc-go/pull/1741) Emitting a new `upgrade_chain` event upon setting upgrade consensus state. * (client) [\#724](https://github.com/cosmos/ibc-go/pull/724) `IsRevisionFormat` and `IsClientIDFormat` have been updated to disallow newlines before the dash used to separate the chainID and revision number, and the client type and client sequence. * (02-client/cli) [\#897](https://github.com/cosmos/ibc-go/pull/897) Remove `GetClientID()` from `Misbehaviour` interface. Submit client misbehaviour cli command requires an explicit client id now. -* (06-solomachine) [\#1972](https://github.com/cosmos/ibc-go/pull/1972) Solo machine implementation of `ZeroCustomFields` fn now panics as the fn is only used for upgrades which solo machine does not support. +* (06-solomachine) [\#1972](https://github.com/cosmos/ibc-go/pull/1972) Solo machine implementation of `ZeroCustomFields` fn now panics as the fn is only used for upgrades which solo machine does not support. * (light-clients/06-solomachine) Moving `verifyMisbehaviour` function from update.go to misbehaviour_handle.go. * [\#2434](https://github.com/cosmos/ibc-go/pull/2478) Removed all `TypeMsg` constants -* (modules/core/exported) [\#2539] (https://github.com/cosmos/ibc-go/pull/2539) Removing `GetVersions` from `ConnectionI` interface. +* (modules/core/exported) [\#2539] () Removing `GetVersions` from `ConnectionI` interface. * (core/02-connection) [\#2419](https://github.com/cosmos/ibc-go/pull/2419) Add optional proof data to proto definitions of `MsgConnectionOpenTry` and `MsgConnectionOpenAck` for host state machines that are unable to introspect their own consensus state. * (light-clients/07-tendermint) [\#3046](https://github.com/cosmos/ibc-go/pull/3046) Moved non-verification misbehaviour checks to `CheckForMisbehaviour`. * (apps/29-fee) [\#2975](https://github.com/cosmos/ibc-go/pull/2975) Adding distribute fee events to ics29. * (light-clients/07-tendermint) [\#2965](https://github.com/cosmos/ibc-go/pull/2965) Prune expired `07-tendermint` consensus states on duplicate header updates. * (light-clients) [\#2736](https://github.com/cosmos/ibc-go/pull/2736) Updating `VerifyMembership` and `VerifyNonMembership` methods to use `Path` interface. -* (light-clients) [\#3113](https://github.com/cosmos/ibc-go/pull/3113) Align light client module names. +* (light-clients) [\#3113](https://github.com/cosmos/ibc-go/pull/3113) Align light client module names. ### Features @@ -154,10 +155,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/02-client) [\#2824](https://github.com/cosmos/ibc-go/pull/2824) Add genesis migrations for v6 to v7. The migration migrates the solo machine client state definition, removes all solo machine consensus states and removes the localhost client. * (core/24-host) [\#2856](https://github.com/cosmos/ibc-go/pull/2856) Add `PrefixedClientStorePath` and `PrefixedClientStoreKey` functions to 24-host * (core/02-client) [\#2819](https://github.com/cosmos/ibc-go/pull/2819) Add automatic in-place store migrations to remove the localhost client and migrate existing solo machine definitions. -* (light-clients/06-solomachine) [\#2826](https://github.com/cosmos/ibc-go/pull/2826) Add `AppModuleBasic` for the 06-solomachine client and remove solo machine type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. -* (light-clients/07-tendermint) [\#2825](https://github.com/cosmos/ibc-go/pull/2825) Add `AppModuleBasic` for the 07-tendermint client and remove tendermint type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. +* (light-clients/06-solomachine) [\#2826](https://github.com/cosmos/ibc-go/pull/2826) Add `AppModuleBasic` for the 06-solomachine client and remove solo machine type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. +* (light-clients/07-tendermint) [\#2825](https://github.com/cosmos/ibc-go/pull/2825) Add `AppModuleBasic` for the 07-tendermint client and remove tendermint type registration from core IBC. Chains must register the `AppModuleBasic` of light clients. * (light-clients/07-tendermint) [\#2800](https://github.com/cosmos/ibc-go/pull/2800) Add optional in-place store migration function to prune all expired tendermint consensus states. -* (core/24-host) [\#2820](https://github.com/cosmos/ibc-go/pull/2820) Add `MustParseClientStatePath` which parses the clientID from a client state key path. +* (core/24-host) [\#2820](https://github.com/cosmos/ibc-go/pull/2820) Add `MustParseClientStatePath` which parses the clientID from a client state key path. * (testing/simapp) [\#2842](https://github.com/cosmos/ibc-go/pull/2842) Adding the new upgrade handler for v6 -> v7 to simapp which prunes expired Tendermint consensus states. * (testing) [\#2829](https://github.com/cosmos/ibc-go/pull/2829) Add `AssertEvents` which asserts events against expected event map. @@ -293,7 +294,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Dependencies -* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. +* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. * [\#2944](https://github.com/cosmos/ibc-go/pull/2944) Bump Cosmos SDK to v0.46.7 and Tendermint to v0.34.24. ### State Machine Breaking @@ -370,7 +371,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* [\#3662](https://github.com/cosmos/ibc-go/pull/3662) Retract v4.1.2 and v4.2.1. +* [\#3662](https://github.com/cosmos/ibc-go/pull/3662) Retract v4.1.2 and v4.2.1. ## [v4.4.1](https://github.com/cosmos/ibc-go/releases/tag/v4.4.1) - 2023-05-25 @@ -427,7 +428,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Dependencies -* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. +* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. ### Improvements @@ -467,7 +468,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Dependencies -* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. +* [\#2868](https://github.com/cosmos/ibc-go/pull/2868) Bump ICS 23 to v0.9.0. ### Improvements From 1099de8195722d6b6efe7037ba734dd9e842b10f Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 19 Jun 2023 00:22:37 +0800 Subject: [PATCH 16/59] organize functions as described in PR --- testing/simapp/app.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index b3b1ec209ca..d72c6b12787 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -972,6 +972,16 @@ 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 examples /* // setupUpgradeHandlers sets all necessary upgrade handlers for testing purposes func (app *SimApp) setupUpgradeHandlers() { @@ -1035,15 +1045,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. From 62966ce511134e567bb0137b03ae8ac6dffe1e73 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 21 Jun 2023 15:39:39 +0800 Subject: [PATCH 17/59] apply gci --- .golangci.yml | 22 ++++++++++++++----- internal/collections/collections_test.go | 3 ++- .../controller/client/cli/query.go | 3 ++- .../controller/client/cli/tx.go | 3 ++- .../controller/ibc_middleware.go | 1 + .../controller/ibc_middleware_test.go | 5 +++-- .../controller/keeper/account.go | 1 + .../controller/keeper/grpc_query.go | 3 ++- .../controller/keeper/handshake.go | 3 ++- .../controller/keeper/handshake_test.go | 1 - .../controller/keeper/keeper.go | 4 +++- .../controller/keeper/migrations.go | 1 + .../controller/keeper/msg_server.go | 1 + .../controller/keeper/msg_server_test.go | 4 +++- .../controller/keeper/relay.go | 3 ++- .../controller/keeper/relay_test.go | 5 +++-- .../controller/migrations/v6/migrations.go | 2 +- .../migrations/v6/migrations_test.go | 5 +++-- .../controller/types/msgs.go | 1 + .../controller/types/msgs_test.go | 5 +++-- .../host/client/cli/cli.go | 3 ++- .../host/client/cli/query.go | 6 +++-- .../host/client/cli/tx.go | 5 +++-- .../host/client/cli/tx_test.go | 3 ++- .../27-interchain-accounts/host/ibc_module.go | 3 ++- .../host/ibc_module_test.go | 8 ++++--- .../host/keeper/account.go | 1 + .../host/keeper/handshake.go | 3 ++- .../host/keeper/handshake_test.go | 3 ++- .../host/keeper/keeper.go | 5 +++-- .../host/keeper/migrations.go | 1 + .../host/keeper/msg_server.go | 1 + .../host/keeper/relay.go | 4 +++- .../host/keeper/relay_test.go | 4 +++- .../27-interchain-accounts/host/types/msgs.go | 1 + .../host/types/msgs_test.go | 3 ++- modules/apps/27-interchain-accounts/module.go | 8 ++++--- .../27-interchain-accounts/module_test.go | 8 ++++--- .../simulation/decoder_test.go | 3 ++- .../simulation/genesis_test.go | 4 +++- .../27-interchain-accounts/types/account.go | 4 +++- .../types/account_test.go | 3 ++- .../27-interchain-accounts/types/codec.go | 4 +++- .../types/codec_test.go | 4 +++- .../types/expected_keepers.go | 2 +- .../27-interchain-accounts/types/metadata.go | 1 + .../27-interchain-accounts/types/packet.go | 1 + modules/apps/29-fee/client/cli/query.go | 3 ++- modules/apps/29-fee/client/cli/tx.go | 3 ++- modules/apps/29-fee/ibc_middleware.go | 3 ++- modules/apps/29-fee/ibc_middleware_test.go | 3 ++- modules/apps/29-fee/ica_test.go | 4 +++- modules/apps/29-fee/keeper/escrow.go | 1 + modules/apps/29-fee/keeper/escrow_test.go | 4 +++- modules/apps/29-fee/keeper/events_test.go | 4 +++- modules/apps/29-fee/keeper/grpc_query.go | 6 +++-- modules/apps/29-fee/keeper/grpc_query_test.go | 4 +++- modules/apps/29-fee/keeper/keeper.go | 5 +++-- modules/apps/29-fee/keeper/keeper_test.go | 4 +++- modules/apps/29-fee/keeper/msg_server.go | 1 + modules/apps/29-fee/keeper/msg_server_test.go | 2 +- modules/apps/29-fee/keeper/relay.go | 3 ++- modules/apps/29-fee/module.go | 8 ++++--- modules/apps/29-fee/types/expected_keepers.go | 2 +- modules/apps/29-fee/types/fee.go | 1 + modules/apps/29-fee/types/fee_test.go | 7 ++++-- modules/apps/29-fee/types/genesis.go | 1 + modules/apps/29-fee/types/genesis_test.go | 6 +++-- modules/apps/29-fee/types/msgs.go | 1 + modules/apps/29-fee/types/msgs_test.go | 6 +++-- modules/apps/transfer/client/cli/cli.go | 3 ++- modules/apps/transfer/client/cli/query.go | 3 ++- modules/apps/transfer/client/cli/tx.go | 3 ++- modules/apps/transfer/ibc_module.go | 3 ++- modules/apps/transfer/ibc_module_test.go | 1 - modules/apps/transfer/keeper/genesis_test.go | 1 + modules/apps/transfer/keeper/grpc_query.go | 6 +++-- .../apps/transfer/keeper/grpc_query_test.go | 1 + .../apps/transfer/keeper/invariants_test.go | 1 + modules/apps/transfer/keeper/keeper.go | 8 ++++--- modules/apps/transfer/keeper/keeper_test.go | 4 +++- .../apps/transfer/keeper/mbt_relay_test.go | 4 +++- .../apps/transfer/keeper/migrations_test.go | 1 + modules/apps/transfer/keeper/msg_server.go | 1 + .../apps/transfer/keeper/msg_server_test.go | 3 ++- modules/apps/transfer/keeper/relay.go | 4 +++- modules/apps/transfer/keeper/relay_test.go | 1 + modules/apps/transfer/module.go | 8 ++++--- .../apps/transfer/simulation/decoder_test.go | 3 ++- .../apps/transfer/simulation/genesis_test.go | 4 +++- modules/apps/transfer/transfer_test.go | 4 +++- modules/apps/transfer/types/codec.go | 2 +- modules/apps/transfer/types/coin.go | 1 + .../apps/transfer/types/expected_keepers.go | 2 +- modules/apps/transfer/types/msgs.go | 1 + modules/apps/transfer/types/msgs_test.go | 4 +++- modules/apps/transfer/types/packet.go | 1 + modules/apps/transfer/types/trace.go | 4 +++- .../transfer/types/transfer_authorization.go | 1 + .../types/transfer_authorization_test.go | 2 ++ modules/core/02-client/abci_test.go | 8 ++++--- modules/core/02-client/client/cli/cli.go | 3 ++- modules/core/02-client/client/cli/query.go | 3 ++- modules/core/02-client/client/cli/tx.go | 3 ++- modules/core/02-client/client/utils/utils.go | 4 +++- modules/core/02-client/keeper/client.go | 4 +++- modules/core/02-client/keeper/grpc_query.go | 6 +++-- modules/core/02-client/keeper/keeper.go | 6 +++-- modules/core/02-client/keeper/keeper_test.go | 12 ++++++---- modules/core/02-client/keeper/proposal.go | 4 +++- .../core/02-client/migrations/v7/genesis.go | 1 + modules/core/02-client/migrations/v7/store.go | 1 + .../02-client/migrations/v7/store_test.go | 3 ++- modules/core/02-client/proposal_handler.go | 1 + .../core/02-client/proposal_handler_test.go | 1 + .../core/02-client/simulation/decoder_test.go | 3 ++- modules/core/02-client/types/client.go | 4 +++- modules/core/02-client/types/codec.go | 4 +++- modules/core/02-client/types/height.go | 1 + modules/core/02-client/types/msgs.go | 1 + modules/core/02-client/types/msgs_test.go | 3 ++- modules/core/02-client/types/proposal.go | 1 + .../core/03-connection/client/cli/query.go | 3 ++- .../core/03-connection/client/utils/utils.go | 1 + .../core/03-connection/keeper/grpc_query.go | 6 +++-- .../core/03-connection/keeper/handshake.go | 1 + modules/core/03-connection/keeper/keeper.go | 4 +++- modules/core/03-connection/keeper/verify.go | 1 + .../03-connection/simulation/decoder_test.go | 3 ++- modules/core/03-connection/types/msgs.go | 1 + modules/core/03-connection/types/msgs_test.go | 12 +++++----- modules/core/04-channel/client/cli/cli.go | 3 ++- modules/core/04-channel/client/cli/query.go | 3 ++- modules/core/04-channel/client/utils/utils.go | 1 + modules/core/04-channel/keeper/grpc_query.go | 6 +++-- modules/core/04-channel/keeper/handshake.go | 3 ++- .../core/04-channel/keeper/handshake_test.go | 1 - modules/core/04-channel/keeper/keeper.go | 7 +++--- modules/core/04-channel/keeper/packet.go | 3 ++- modules/core/04-channel/keeper/packet_test.go | 2 +- modules/core/04-channel/keeper/timeout.go | 3 ++- .../core/04-channel/keeper/timeout_test.go | 2 +- .../04-channel/simulation/decoder_test.go | 3 ++- .../core/04-channel/types/acknowledgement.go | 1 + .../04-channel/types/acknowledgement_test.go | 4 +++- .../core/04-channel/types/expected_keepers.go | 2 +- modules/core/04-channel/types/msgs.go | 1 + modules/core/04-channel/types/msgs_test.go | 10 +++++---- modules/core/04-channel/types/packet.go | 1 + modules/core/04-channel/types/packet_test.go | 3 ++- modules/core/05-port/keeper/keeper.go | 5 +++-- modules/core/05-port/keeper/keeper_test.go | 6 +++-- modules/core/05-port/types/module.go | 2 +- .../23-commitment/types/commitment_test.go | 8 ++++--- modules/core/23-commitment/types/merkle.go | 6 +++-- .../core/23-commitment/types/merkle_test.go | 3 ++- modules/core/23-commitment/types/utils.go | 4 +++- .../core/23-commitment/types/utils_test.go | 3 ++- modules/core/ante/ante_test.go | 3 ++- modules/core/client/cli/cli.go | 3 ++- modules/core/client/query.go | 3 ++- modules/core/exported/client.go | 3 ++- modules/core/exported/expected_keepers.go | 1 + modules/core/genesis_test.go | 6 +++-- modules/core/keeper/keeper.go | 2 +- modules/core/keeper/keeper_test.go | 5 +++-- modules/core/keeper/msg_server.go | 4 +++- modules/core/migrations/v7/genesis_test.go | 3 ++- modules/core/module.go | 8 ++++--- modules/core/simulation/decoder_test.go | 3 ++- modules/core/simulation/genesis_test.go | 4 +++- .../06-solomachine/client_state.go | 1 + modules/light-clients/06-solomachine/codec.go | 1 + .../06-solomachine/consensus_state.go | 1 + .../light-clients/06-solomachine/header.go | 1 + .../06-solomachine/misbehaviour_handle.go | 4 ++-- .../light-clients/06-solomachine/module.go | 5 +++-- modules/light-clients/06-solomachine/proof.go | 1 + .../06-solomachine/proposal_handle.go | 1 + .../06-solomachine/solomachine_test.go | 5 +++-- .../light-clients/06-solomachine/update.go | 1 + .../07-tendermint/client_state.go | 9 +++++--- .../07-tendermint/client_state_test.go | 3 ++- .../07-tendermint/consensus_state.go | 1 + modules/light-clients/07-tendermint/header.go | 1 + .../migrations/expected_keepers.go | 3 ++- .../07-tendermint/migrations/migrations.go | 1 + .../07-tendermint/misbehaviour.go | 1 + .../07-tendermint/misbehaviour_handle.go | 4 +++- modules/light-clients/07-tendermint/module.go | 5 +++-- .../07-tendermint/proposal_handle.go | 1 + .../07-tendermint/tendermint_test.go | 8 ++++--- modules/light-clients/07-tendermint/update.go | 6 +++-- .../07-tendermint/update_test.go | 3 ++- .../light-clients/07-tendermint/upgrade.go | 1 + .../09-localhost/client_state.go | 1 + testing/app.go | 17 ++++++++------ testing/chain.go | 19 +++++++++------- testing/chain_test.go | 4 +++- testing/coordinator.go | 3 ++- testing/endpoint.go | 3 ++- testing/events.go | 3 ++- testing/mock/ibc_app.go | 2 +- testing/mock/ibc_module.go | 2 +- testing/mock/mock.go | 10 +++++---- testing/mock/privval.go | 7 +++--- testing/mock/privval_test.go | 3 ++- testing/simapp/ante_handler.go | 1 + testing/simapp/app.go | 15 ++++++++----- testing/simapp/export.go | 3 ++- testing/simapp/genesis_account_test.go | 6 +++-- testing/simapp/sim_bench_test.go | 3 ++- testing/simapp/sim_test.go | 17 +++++++------- testing/simapp/simd/cmd/cmd_test.go | 6 ++--- testing/simapp/simd/cmd/root.go | 11 +++++----- testing/simapp/state.go | 6 +++-- testing/simapp/test_helpers.go | 21 ++++++++++-------- testing/simapp/upgrades.go | 2 +- testing/simapp/utils.go | 3 ++- testing/simapp/utils_test.go | 3 ++- testing/solomachine.go | 4 +++- testing/utils.go | 3 ++- testing/values.go | 1 + 223 files changed, 563 insertions(+), 276 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4a0022ce9df..71e76f042a9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,6 +9,7 @@ linters: - dogsled - exportloopref - errcheck + - gci - goconst - gocritic - gofumpt @@ -29,27 +30,38 @@ linters: issues: exclude-rules: - - text: "unused-parameter" + - text: 'unused-parameter' linters: - revive - - text: "SA1019:" + - text: 'SA1019:' linters: - staticcheck - - text: "Use of weak random number generator" + - text: 'Use of weak random number generator' linters: - gosec - - text: "ST1003:" + - text: 'ST1003:' linters: - stylecheck # FIXME: Disabled until golangci-lint updates stylecheck with this fix: # https://github.com/dominikh/go-tools/issues/389 - - text: "ST1016:" + - text: 'ST1016:' linters: - stylecheck max-issues-per-linter: 10000 max-same-issues: 10000 linters-settings: + gci: + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - blank # blank imports + - dot # dot imports + - prefix(cosmossdk.io) + - prefix(github.com/cosmos/cosmos-sdk) + - prefix(github.com/cometbft/cometbft) + - prefix(github.com/cosmos/ibc-go) + custom-order: true dogsled: max-blank-identifiers: 3 maligned: diff --git a/internal/collections/collections_test.go b/internal/collections/collections_test.go index faf16fa6bc3..9fb3664c372 100644 --- a/internal/collections/collections_test.go +++ b/internal/collections/collections_test.go @@ -3,8 +3,9 @@ package collections_test import ( "testing" - "github.com/cosmos/ibc-go/v7/internal/collections" "github.com/stretchr/testify/require" + + "github.com/cosmos/ibc-go/v7/internal/collections" ) func TestContainsString(t *testing.T) { diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/query.go b/modules/apps/27-interchain-accounts/controller/client/cli/query.go index ca71a96652a..4a18fcd05fa 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/query.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/query.go @@ -3,10 +3,11 @@ package cli import ( "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" ) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 44094f7b152..232d22b07c9 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -5,11 +5,12 @@ import ( "os" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go index 3e767a24614..1338b3f252f 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go @@ -2,6 +2,7 @@ package controller import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 663a72b6dcc..cf049e3ae50 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -4,10 +4,11 @@ import ( "fmt" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" controllerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index 189f5c6e903..9ce0f5211a6 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/grpc_query.go b/modules/apps/27-interchain-accounts/controller/keeper/grpc_query.go index 78e0f37446e..2b983546c61 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/grpc_query.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/grpc_query.go @@ -3,10 +3,11 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 04b8b97b6df..1bc75623f71 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -5,9 +5,10 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index 9e29dc0a93c..1f3929154f7 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -2,7 +2,6 @@ package keeper_test import ( capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 8b2d6aad48e..9aa172a6f15 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -6,12 +6,14 @@ import ( "strings" errorsmod "cosmossdk.io/errors" - "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cometbft/cometbft/libs/log" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations.go index 1c1323a6d07..896bd3575cb 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations.go @@ -4,6 +4,7 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go index d1bbc7205ff..df22e40b34b 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index f929a74a55a..ef55faef863 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -3,10 +3,12 @@ package keeper_test import ( "time" + "github.com/cosmos/gogoproto/proto" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gogoproto/proto" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay.go b/modules/apps/27-interchain-accounts/controller/keeper/relay.go index 9ebe2ed85f8..412d2cb2f0c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay.go @@ -2,9 +2,10 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go index d5deeb41d19..c363643a484 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go @@ -1,11 +1,12 @@ package keeper_test import ( + "github.com/cosmos/gogoproto/proto" + sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gogoproto/proto" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go index 96a5d76fa91..0208c97eb49 100644 --- a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go +++ b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations.go @@ -5,9 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go index 872d1a24039..c079459c0aa 100644 --- a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go @@ -3,10 +3,11 @@ package v6_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" v6 "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/migrations/v6" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index 39f55c96078..545bec0a15a 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index af37eb721f1..48b383e0026 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -3,11 +3,12 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" diff --git a/modules/apps/27-interchain-accounts/host/client/cli/cli.go b/modules/apps/27-interchain-accounts/host/client/cli/cli.go index 23d2dc2e83a..1eceb6159a4 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/cli.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/cli.go @@ -1,8 +1,9 @@ package cli import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" ) // GetQueryCmd returns the query commands for the ICA host submodule diff --git a/modules/apps/27-interchain-accounts/host/client/cli/query.go b/modules/apps/27-interchain-accounts/host/client/cli/query.go index 327f51538fc..36e928fe795 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/query.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/query.go @@ -4,13 +4,15 @@ import ( "fmt" "strconv" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 8d74f1ce66c..159dff22449 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -4,12 +4,13 @@ import ( "encoding/json" "fmt" + "github.com/cosmos/gogoproto/proto" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/gogoproto/proto" - "github.com/spf13/cobra" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go index c5d8d56e1dd..a1ca3e0f547 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go @@ -4,12 +4,13 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module.go b/modules/apps/27-interchain-accounts/host/ibc_module.go index 5ec6b5f78b2..012130c2efc 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module.go @@ -4,9 +4,10 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 4428d453f59..373bdbc7226 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gogoproto/proto" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/stretchr/testify/suite" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/account.go b/modules/apps/27-interchain-accounts/host/keeper/account.go index 3b02d3c7cae..e7fd35fb236 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/account.go +++ b/modules/apps/27-interchain-accounts/host/keeper/account.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index c82a826efa5..8d43071ac2a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -4,9 +4,10 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 7f31c3bcb31..034550a7d50 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -2,10 +2,11 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" hosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index c8f806486d6..1dd233aa76b 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -4,13 +4,14 @@ import ( "fmt" "strings" - "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + "github.com/cometbft/cometbft/libs/log" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" genesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations.go b/modules/apps/27-interchain-accounts/host/keeper/migrations.go index 558af284c49..d1d5a129e3d 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" ) diff --git a/modules/apps/27-interchain-accounts/host/keeper/msg_server.go b/modules/apps/27-interchain-accounts/host/keeper/msg_server.go index 388f78c744a..e9bebdf7193 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/host/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay.go b/modules/apps/27-interchain-accounts/host/keeper/relay.go index aa61d7004b7..2f0037558ea 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay.go @@ -1,10 +1,12 @@ package keeper import ( + "github.com/cosmos/gogoproto/proto" + errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/gogoproto/proto" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index 7f0f298c452..034263f1039 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -1,7 +1,10 @@ package keeper_test import ( + "github.com/cosmos/gogoproto/proto" + sdkmath "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -9,7 +12,6 @@ import ( govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gogoproto/proto" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/27-interchain-accounts/host/types/msgs.go b/modules/apps/27-interchain-accounts/host/types/msgs.go index 67dc6566c19..e9c40aa498d 100644 --- a/modules/apps/27-interchain-accounts/host/types/msgs.go +++ b/modules/apps/27-interchain-accounts/host/types/msgs.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" diff --git a/modules/apps/27-interchain-accounts/host/types/msgs_test.go b/modules/apps/27-interchain-accounts/host/types/msgs_test.go index 1156c364083..8bddccd9b9f 100644 --- a/modules/apps/27-interchain-accounts/host/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/host/types/msgs_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" ) diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index d5fc60b3da8..31e58cfbcb8 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -5,15 +5,17 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/client/cli" controllerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" diff --git a/modules/apps/27-interchain-accounts/module_test.go b/modules/apps/27-interchain-accounts/module_test.go index fc10874f152..2ee638f081a 100644 --- a/modules/apps/27-interchain-accounts/module_test.go +++ b/modules/apps/27-interchain-accounts/module_test.go @@ -3,12 +3,14 @@ package ica_test import ( "testing" + "github.com/stretchr/testify/suite" + + "github.com/cosmos/cosmos-sdk/baseapp" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/baseapp" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - "github.com/stretchr/testify/suite" ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" diff --git a/modules/apps/27-interchain-accounts/simulation/decoder_test.go b/modules/apps/27-interchain-accounts/simulation/decoder_test.go index 81e899b620e..ae54a74c00c 100644 --- a/modules/apps/27-interchain-accounts/simulation/decoder_test.go +++ b/modules/apps/27-interchain-accounts/simulation/decoder_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/cosmos/cosmos-sdk/types/kv" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/simulation" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/27-interchain-accounts/simulation/genesis_test.go b/modules/apps/27-interchain-accounts/simulation/genesis_test.go index ac38cc936c4..5072865e22c 100644 --- a/modules/apps/27-interchain-accounts/simulation/genesis_test.go +++ b/modules/apps/27-interchain-accounts/simulation/genesis_test.go @@ -5,13 +5,15 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/stretchr/testify/require" genesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/simulation" diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index 472b509818c..5fc1466e52d 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -5,12 +5,14 @@ import ( "regexp" "strings" + yaml "gopkg.in/yaml.v2" + errorsmod "cosmossdk.io/errors" + crypto "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkaddress "github.com/cosmos/cosmos-sdk/types/address" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - yaml "gopkg.in/yaml.v2" ) var ( diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go index 8acef7e33a9..50eadc8aad3 100644 --- a/modules/apps/27-interchain-accounts/types/account_test.go +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/27-interchain-accounts/types/codec.go b/modules/apps/27-interchain-accounts/types/codec.go index b0ba7b8902b..4456173c79a 100644 --- a/modules/apps/27-interchain-accounts/types/codec.go +++ b/modules/apps/27-interchain-accounts/types/codec.go @@ -1,12 +1,14 @@ package types import ( + "github.com/cosmos/gogoproto/proto" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/gogoproto/proto" ) // ModuleCdc references the global interchain accounts module codec. Note, the codec diff --git a/modules/apps/27-interchain-accounts/types/codec_test.go b/modules/apps/27-interchain-accounts/types/codec_test.go index 1ae4da8a186..f47219862cb 100644 --- a/modules/apps/27-interchain-accounts/types/codec_test.go +++ b/modules/apps/27-interchain-accounts/types/codec_test.go @@ -1,12 +1,14 @@ package types_test import ( + "github.com/cosmos/gogoproto/proto" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/gogoproto/proto" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" "github.com/cosmos/ibc-go/v7/testing/simapp" diff --git a/modules/apps/27-interchain-accounts/types/expected_keepers.go b/modules/apps/27-interchain-accounts/types/expected_keepers.go index 08547816778..d923d61c603 100644 --- a/modules/apps/27-interchain-accounts/types/expected_keepers.go +++ b/modules/apps/27-interchain-accounts/types/expected_keepers.go @@ -3,8 +3,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/apps/27-interchain-accounts/types/metadata.go b/modules/apps/27-interchain-accounts/types/metadata.go index ee986a006f9..6cf6a27688f 100644 --- a/modules/apps/27-interchain-accounts/types/metadata.go +++ b/modules/apps/27-interchain-accounts/types/metadata.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/apps/27-interchain-accounts/types/packet.go b/modules/apps/27-interchain-accounts/types/packet.go index f7d1c6648be..213497f6ac6 100644 --- a/modules/apps/27-interchain-accounts/types/packet.go +++ b/modules/apps/27-interchain-accounts/types/packet.go @@ -4,6 +4,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/modules/apps/29-fee/client/cli/query.go b/modules/apps/29-fee/client/cli/query.go index 5c57386668d..e836ac113fe 100644 --- a/modules/apps/29-fee/client/cli/query.go +++ b/modules/apps/29-fee/client/cli/query.go @@ -4,11 +4,12 @@ import ( "fmt" "strconv" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/client/cli/tx.go b/modules/apps/29-fee/client/cli/tx.go index 40d0f5e5c1c..21ffae00f9a 100644 --- a/modules/apps/29-fee/client/cli/tx.go +++ b/modules/apps/29-fee/client/cli/tx.go @@ -5,12 +5,13 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/ibc_middleware.go b/modules/apps/29-fee/ibc_middleware.go index 1938fd6381a..5b260ad7be9 100644 --- a/modules/apps/29-fee/ibc_middleware.go +++ b/modules/apps/29-fee/ibc_middleware.go @@ -4,9 +4,10 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 11302063364..ee1d0ed228a 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -4,9 +4,10 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" fee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" diff --git a/modules/apps/29-fee/ica_test.go b/modules/apps/29-fee/ica_test.go index 396e25cb00a..451c54b8b73 100644 --- a/modules/apps/29-fee/ica_test.go +++ b/modules/apps/29-fee/ica_test.go @@ -1,11 +1,13 @@ package fee_test import ( + "github.com/cosmos/gogoproto/proto" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gogoproto/proto" icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 8f3f8bd417f..9f9310272cd 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -5,6 +5,7 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index 71a1f9e5a44..fee65c5af9c 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -2,9 +2,11 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/keeper/events_test.go b/modules/apps/29-fee/keeper/events_test.go index 7c8b917f49e..2cd5b265b6d 100644 --- a/modules/apps/29-fee/keeper/events_test.go +++ b/modules/apps/29-fee/keeper/events_test.go @@ -2,9 +2,11 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" - abcitypes "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + abcitypes "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/29-fee/keeper/grpc_query.go b/modules/apps/29-fee/keeper/grpc_query.go index 1f007bbfb8c..6c7122e28c3 100644 --- a/modules/apps/29-fee/keeper/grpc_query.go +++ b/modules/apps/29-fee/keeper/grpc_query.go @@ -3,12 +3,14 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" ) diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index 707980d9bb2..65f880fddb8 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -4,10 +4,12 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 99801bd6999..cfa353530b0 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -1,12 +1,13 @@ package keeper import ( - "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + "github.com/cometbft/cometbft/libs/log" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index d82f09eea5e..f2265afe695 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -4,9 +4,11 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index 511c0e5aed7..12dd50506cf 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index 40a24c5225d..fc7420144be 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -2,8 +2,8 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index 625901450a4..a5328703d7c 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -4,9 +4,10 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/module.go b/modules/apps/29-fee/module.go index 988276073e9..e2981cd97f6 100644 --- a/modules/apps/29-fee/module.go +++ b/modules/apps/29-fee/module.go @@ -5,15 +5,17 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/client/cli" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" diff --git a/modules/apps/29-fee/types/expected_keepers.go b/modules/apps/29-fee/types/expected_keepers.go index c9a82e62608..68ea270b72a 100644 --- a/modules/apps/29-fee/types/expected_keepers.go +++ b/modules/apps/29-fee/types/expected_keepers.go @@ -3,8 +3,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) diff --git a/modules/apps/29-fee/types/fee.go b/modules/apps/29-fee/types/fee.go index 7081540ccb4..103a8a47046 100644 --- a/modules/apps/29-fee/types/fee.go +++ b/modules/apps/29-fee/types/fee.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/types/fee_test.go b/modules/apps/29-fee/types/fee_test.go index 0ff42efb41a..a17b42693b5 100644 --- a/modules/apps/29-fee/types/fee_test.go +++ b/modules/apps/29-fee/types/fee_test.go @@ -3,10 +3,13 @@ package types_test import ( "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" ) diff --git a/modules/apps/29-fee/types/genesis.go b/modules/apps/29-fee/types/genesis.go index 69dc5e38178..b6d2143e28a 100644 --- a/modules/apps/29-fee/types/genesis.go +++ b/modules/apps/29-fee/types/genesis.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/apps/29-fee/types/genesis_test.go b/modules/apps/29-fee/types/genesis_test.go index 6ecde68c3a6..082efe4dd3e 100644 --- a/modules/apps/29-fee/types/genesis_test.go +++ b/modules/apps/29-fee/types/genesis_test.go @@ -3,10 +3,12 @@ package types_test import ( "testing" - "github.com/cometbft/cometbft/crypto/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index c66c6ba7aa6..cf39b7fdd73 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index e20984e228b..fee8c236522 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -3,10 +3,12 @@ package types_test import ( "testing" - "github.com/cometbft/cometbft/crypto/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/transfer/client/cli/cli.go b/modules/apps/transfer/client/cli/cli.go index 8412c331fc8..a0fe3564b60 100644 --- a/modules/apps/transfer/client/cli/cli.go +++ b/modules/apps/transfer/client/cli/cli.go @@ -1,8 +1,9 @@ package cli import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" ) // GetQueryCmd returns the query commands for IBC connections diff --git a/modules/apps/transfer/client/cli/query.go b/modules/apps/transfer/client/cli/query.go index 8ebab138c66..c81e6ee921d 100644 --- a/modules/apps/transfer/client/cli/query.go +++ b/modules/apps/transfer/client/cli/query.go @@ -3,10 +3,11 @@ package cli import ( "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ) diff --git a/modules/apps/transfer/client/cli/tx.go b/modules/apps/transfer/client/cli/tx.go index c9024f03886..acd80760f88 100644 --- a/modules/apps/transfer/client/cli/tx.go +++ b/modules/apps/transfer/client/cli/tx.go @@ -6,12 +6,13 @@ import ( "strings" "time" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clientutils "github.com/cosmos/ibc-go/v7/modules/core/02-client/client/utils" diff --git a/modules/apps/transfer/ibc_module.go b/modules/apps/transfer/ibc_module.go index 1d5afed8935..41fdd604926 100644 --- a/modules/apps/transfer/ibc_module.go +++ b/modules/apps/transfer/ibc_module.go @@ -6,9 +6,10 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/transfer/ibc_module_test.go b/modules/apps/transfer/ibc_module_test.go index e62f7b421b7..4988d52b0af 100644 --- a/modules/apps/transfer/ibc_module_test.go +++ b/modules/apps/transfer/ibc_module_test.go @@ -4,7 +4,6 @@ import ( "math" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/cosmos/ibc-go/v7/modules/apps/transfer" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/transfer/keeper/genesis_test.go b/modules/apps/transfer/keeper/genesis_test.go index 8b8aac62c67..b2e42d367ba 100644 --- a/modules/apps/transfer/keeper/genesis_test.go +++ b/modules/apps/transfer/keeper/genesis_test.go @@ -4,6 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" diff --git a/modules/apps/transfer/keeper/grpc_query.go b/modules/apps/transfer/keeper/grpc_query.go index 87648d2f9dc..f33db868d35 100644 --- a/modules/apps/transfer/keeper/grpc_query.go +++ b/modules/apps/transfer/keeper/grpc_query.go @@ -5,12 +5,14 @@ import ( "fmt" "strings" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ) diff --git a/modules/apps/transfer/keeper/grpc_query_test.go b/modules/apps/transfer/keeper/grpc_query_test.go index ae741a9b714..8df7babc69c 100644 --- a/modules/apps/transfer/keeper/grpc_query_test.go +++ b/modules/apps/transfer/keeper/grpc_query_test.go @@ -4,6 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/modules/apps/transfer/keeper/invariants_test.go b/modules/apps/transfer/keeper/invariants_test.go index 28c2f9f0e2d..dd459db6de2 100644 --- a/modules/apps/transfer/keeper/invariants_test.go +++ b/modules/apps/transfer/keeper/invariants_test.go @@ -2,6 +2,7 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 4e5760cbf5b..be5ccd148ed 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -5,15 +5,17 @@ import ( "strings" sdkmath "cosmossdk.io/math" - tmbytes "github.com/cometbft/cometbft/libs/bytes" - "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + tmbytes "github.com/cometbft/cometbft/libs/bytes" + "github.com/cometbft/cometbft/libs/log" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index fc469b06c75..ead002a72c2 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -4,12 +4,14 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" diff --git a/modules/apps/transfer/keeper/mbt_relay_test.go b/modules/apps/transfer/keeper/mbt_relay_test.go index 80a99eada08..aad7366dcca 100644 --- a/modules/apps/transfer/keeper/mbt_relay_test.go +++ b/modules/apps/transfer/keeper/mbt_relay_test.go @@ -13,9 +13,11 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cometbft/cometbft/crypto" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/apps/transfer/keeper/migrations_test.go b/modules/apps/transfer/keeper/migrations_test.go index 577fe8d2ba6..9548052c437 100644 --- a/modules/apps/transfer/keeper/migrations_test.go +++ b/modules/apps/transfer/keeper/migrations_test.go @@ -4,6 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" diff --git a/modules/apps/transfer/keeper/msg_server.go b/modules/apps/transfer/keeper/msg_server.go index f930c929b42..41961e57261 100644 --- a/modules/apps/transfer/keeper/msg_server.go +++ b/modules/apps/transfer/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" diff --git a/modules/apps/transfer/keeper/msg_server_test.go b/modules/apps/transfer/keeper/msg_server_test.go index 73c94bc0ca3..552d43be0d4 100644 --- a/modules/apps/transfer/keeper/msg_server_test.go +++ b/modules/apps/transfer/keeper/msg_server_test.go @@ -2,11 +2,12 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibctesting "github.com/cosmos/ibc-go/v7/testing" ) // TestMsgTransfer tests Transfer rpc handler diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index 0bef4fa81f9..f6abdd61bd2 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -4,9 +4,11 @@ import ( "fmt" "strings" + metrics "github.com/armon/go-metrics" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - metrics "github.com/armon/go-metrics" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/apps/transfer/keeper/relay_test.go b/modules/apps/transfer/keeper/relay_test.go index 57f594d4711..6d723cd107c 100644 --- a/modules/apps/transfer/keeper/relay_test.go +++ b/modules/apps/transfer/keeper/relay_test.go @@ -4,6 +4,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index 43359bf9681..8d84ff0311b 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -5,15 +5,17 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/client/cli" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" diff --git a/modules/apps/transfer/simulation/decoder_test.go b/modules/apps/transfer/simulation/decoder_test.go index 654aba6688a..941d25c2f77 100644 --- a/modules/apps/transfer/simulation/decoder_test.go +++ b/modules/apps/transfer/simulation/decoder_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/cosmos/cosmos-sdk/types/kv" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/simulation" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" "github.com/cosmos/ibc-go/v7/testing/simapp" diff --git a/modules/apps/transfer/simulation/genesis_test.go b/modules/apps/transfer/simulation/genesis_test.go index 6b56251e97f..11c61aca767 100644 --- a/modules/apps/transfer/simulation/genesis_test.go +++ b/modules/apps/transfer/simulation/genesis_test.go @@ -5,13 +5,15 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/simulation" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" diff --git a/modules/apps/transfer/transfer_test.go b/modules/apps/transfer/transfer_test.go index eec87eb60cd..74315f35fd6 100644 --- a/modules/apps/transfer/transfer_test.go +++ b/modules/apps/transfer/transfer_test.go @@ -3,9 +3,11 @@ package transfer_test import ( "testing" + "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/transfer/types/codec.go b/modules/apps/transfer/types/codec.go index 2d66ca534a7..e04fb6fab0c 100644 --- a/modules/apps/transfer/types/codec.go +++ b/modules/apps/transfer/types/codec.go @@ -3,7 +3,6 @@ package types import ( "bytes" - "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" @@ -11,6 +10,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/x/authz" ) // RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types diff --git a/modules/apps/transfer/types/coin.go b/modules/apps/transfer/types/coin.go index 6799b763013..fad6532af81 100644 --- a/modules/apps/transfer/types/coin.go +++ b/modules/apps/transfer/types/coin.go @@ -5,6 +5,7 @@ import ( "strings" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/modules/apps/transfer/types/expected_keepers.go b/modules/apps/transfer/types/expected_keepers.go index 389d423a18f..e4997fd879f 100644 --- a/modules/apps/transfer/types/expected_keepers.go +++ b/modules/apps/transfer/types/expected_keepers.go @@ -3,8 +3,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/apps/transfer/types/msgs.go b/modules/apps/transfer/types/msgs.go index a9d9c1d7adf..7bc92bf3363 100644 --- a/modules/apps/transfer/types/msgs.go +++ b/modules/apps/transfer/types/msgs.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/transfer/types/msgs_test.go b/modules/apps/transfer/types/msgs_test.go index 22423d403f9..b967e699fa8 100644 --- a/modules/apps/transfer/types/msgs_test.go +++ b/modules/apps/transfer/types/msgs_test.go @@ -4,10 +4,12 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/apps/transfer/types/packet.go b/modules/apps/transfer/types/packet.go index 92e60a646ea..66f3e5730e1 100644 --- a/modules/apps/transfer/types/packet.go +++ b/modules/apps/transfer/types/packet.go @@ -6,6 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" diff --git a/modules/apps/transfer/types/trace.go b/modules/apps/transfer/types/trace.go index 2c9581d9078..f539ba65cf4 100644 --- a/modules/apps/transfer/types/trace.go +++ b/modules/apps/transfer/types/trace.go @@ -8,9 +8,11 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + tmbytes "github.com/cometbft/cometbft/libs/bytes" tmtypes "github.com/cometbft/cometbft/types" - sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/apps/transfer/types/transfer_authorization.go b/modules/apps/transfer/types/transfer_authorization.go index 119b148e8cb..c276064e422 100644 --- a/modules/apps/transfer/types/transfer_authorization.go +++ b/modules/apps/transfer/types/transfer_authorization.go @@ -5,6 +5,7 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" diff --git a/modules/apps/transfer/types/transfer_authorization_test.go b/modules/apps/transfer/types/transfer_authorization_test.go index eb50f2e5f8a..da2764cba39 100644 --- a/modules/apps/transfer/types/transfer_authorization_test.go +++ b/modules/apps/transfer/types/transfer_authorization_test.go @@ -2,8 +2,10 @@ package types_test import ( sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/cosmos/ibc-go/v7/testing/mock" diff --git a/modules/core/02-client/abci_test.go b/modules/core/02-client/abci_test.go index 170f5a63524..b825acee6ba 100644 --- a/modules/core/02-client/abci_test.go +++ b/modules/core/02-client/abci_test.go @@ -4,11 +4,13 @@ import ( "strings" "testing" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/stretchr/testify/suite" + + abci "github.com/cometbft/cometbft/abci/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" client "github.com/cosmos/ibc-go/v7/modules/core/02-client" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/core/02-client/client/cli/cli.go b/modules/core/02-client/client/cli/cli.go index f1017e2df0f..fd5b4b95338 100644 --- a/modules/core/02-client/client/cli/cli.go +++ b/modules/core/02-client/client/cli/cli.go @@ -1,9 +1,10 @@ package cli import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ) diff --git a/modules/core/02-client/client/cli/query.go b/modules/core/02-client/client/cli/query.go index 337b142419c..692e5517522 100644 --- a/modules/core/02-client/client/cli/query.go +++ b/modules/core/02-client/client/cli/query.go @@ -4,10 +4,11 @@ import ( "errors" "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/core/02-client/client/utils" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 14401a659fc..7966daf7dac 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -5,6 +5,8 @@ import ( "os" "strconv" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -14,7 +16,6 @@ import ( govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/02-client/client/utils/utils.go b/modules/core/02-client/client/utils/utils.go index f776bb00ae2..5caf7679712 100644 --- a/modules/core/02-client/client/utils/utils.go +++ b/modules/core/02-client/client/utils/utils.go @@ -4,10 +4,12 @@ import ( "context" errorsmod "cosmossdk.io/errors" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index 1be50fdb820..34b8ff8c528 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -1,8 +1,10 @@ package keeper import ( - errorsmod "cosmossdk.io/errors" metrics "github.com/armon/go-metrics" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index 009439381bd..3b0b671c18c 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -7,12 +7,14 @@ import ( "sort" "strings" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 9a79011cd1a..b26aa5eaf0d 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -6,8 +6,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" - "github.com/cometbft/cometbft/libs/log" - "github.com/cometbft/cometbft/light" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -15,6 +14,9 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cometbft/cometbft/libs/log" + "github.com/cometbft/cometbft/light" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 23b1b4d3c34..7ba5ab4013b 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -5,14 +5,19 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" - tmbytes "github.com/cometbft/cometbft/libs/bytes" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + tmbytes "github.com/cometbft/cometbft/libs/bytes" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" @@ -23,7 +28,6 @@ import ( ibctesting "github.com/cosmos/ibc-go/v7/testing" ibctestingmock "github.com/cosmos/ibc-go/v7/testing/mock" "github.com/cosmos/ibc-go/v7/testing/simapp" - "github.com/stretchr/testify/suite" ) const ( diff --git a/modules/core/02-client/keeper/proposal.go b/modules/core/02-client/keeper/proposal.go index 2cb0787be47..f35f00d616d 100644 --- a/modules/core/02-client/keeper/proposal.go +++ b/modules/core/02-client/keeper/proposal.go @@ -1,8 +1,10 @@ package keeper import ( - errorsmod "cosmossdk.io/errors" metrics "github.com/armon/go-metrics" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/02-client/migrations/v7/genesis.go b/modules/core/02-client/migrations/v7/genesis.go index e2f803dd35d..13eec1df18f 100644 --- a/modules/core/02-client/migrations/v7/genesis.go +++ b/modules/core/02-client/migrations/v7/genesis.go @@ -2,6 +2,7 @@ package v7 import ( errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/core/02-client/migrations/v7/store.go b/modules/core/02-client/migrations/v7/store.go index 280431dc5e7..e8794dd9c17 100644 --- a/modules/core/02-client/migrations/v7/store.go +++ b/modules/core/02-client/migrations/v7/store.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" diff --git a/modules/core/02-client/migrations/v7/store_test.go b/modules/core/02-client/migrations/v7/store_test.go index cb8be6e0f6d..524e439a4f6 100644 --- a/modules/core/02-client/migrations/v7/store_test.go +++ b/modules/core/02-client/migrations/v7/store_test.go @@ -4,9 +4,10 @@ import ( "strconv" "testing" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/codec" + v7 "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/02-client/proposal_handler.go b/modules/core/02-client/proposal_handler.go index e777d4fe71d..af6393c7f96 100644 --- a/modules/core/02-client/proposal_handler.go +++ b/modules/core/02-client/proposal_handler.go @@ -2,6 +2,7 @@ package client import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" diff --git a/modules/core/02-client/proposal_handler_test.go b/modules/core/02-client/proposal_handler_test.go index a4914f282cf..b96ee2a05fb 100644 --- a/modules/core/02-client/proposal_handler_test.go +++ b/modules/core/02-client/proposal_handler_test.go @@ -2,6 +2,7 @@ package client_test import ( sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" diff --git a/modules/core/02-client/simulation/decoder_test.go b/modules/core/02-client/simulation/decoder_test.go index 19e6b6f9de1..bcad1a54da3 100644 --- a/modules/core/02-client/simulation/decoder_test.go +++ b/modules/core/02-client/simulation/decoder_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/types/kv" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/simulation" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/02-client/types/client.go b/modules/core/02-client/types/client.go index f572adf526a..8fc6b63ee98 100644 --- a/modules/core/02-client/types/client.go +++ b/modules/core/02-client/types/client.go @@ -6,9 +6,11 @@ import ( "sort" "strings" + proto "github.com/cosmos/gogoproto/proto" + errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" - proto "github.com/cosmos/gogoproto/proto" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index aba50a3b3a5..c71caaede98 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -1,12 +1,14 @@ package types import ( + proto "github.com/cosmos/gogoproto/proto" + errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - proto "github.com/cosmos/gogoproto/proto" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/02-client/types/height.go b/modules/core/02-client/types/height.go index 75a840e5e13..94e9f4acd6f 100644 --- a/modules/core/02-client/types/height.go +++ b/modules/core/02-client/types/height.go @@ -8,6 +8,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index be1c0a83090..764154afcb5 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 2cb871c87e5..2d265dcbc6c 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -4,11 +4,12 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" diff --git a/modules/core/02-client/types/proposal.go b/modules/core/02-client/types/proposal.go index 0b22200242f..c51f4cf1900 100644 --- a/modules/core/02-client/types/proposal.go +++ b/modules/core/02-client/types/proposal.go @@ -5,6 +5,7 @@ import ( "reflect" errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" diff --git a/modules/core/03-connection/client/cli/query.go b/modules/core/03-connection/client/cli/query.go index e0d6d917d5b..9fe3250208f 100644 --- a/modules/core/03-connection/client/cli/query.go +++ b/modules/core/03-connection/client/cli/query.go @@ -3,10 +3,11 @@ package cli import ( "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/client/utils" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/core/03-connection/client/utils/utils.go b/modules/core/03-connection/client/utils/utils.go index a7cab07d6bf..729ad18783d 100644 --- a/modules/core/03-connection/client/utils/utils.go +++ b/modules/core/03-connection/client/utils/utils.go @@ -7,6 +7,7 @@ import ( "os" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/modules/core/03-connection/keeper/grpc_query.go b/modules/core/03-connection/keeper/grpc_query.go index d095e2537f3..9cd1830d1e5 100644 --- a/modules/core/03-connection/keeper/grpc_query.go +++ b/modules/core/03-connection/keeper/grpc_query.go @@ -3,12 +3,14 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/core/03-connection/keeper/handshake.go b/modules/core/03-connection/keeper/handshake.go index bea6d74ce15..61e50b7a55d 100644 --- a/modules/core/03-connection/keeper/handshake.go +++ b/modules/core/03-connection/keeper/handshake.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/03-connection/keeper/keeper.go b/modules/core/03-connection/keeper/keeper.go index ee37f913ef0..075ae4e4465 100644 --- a/modules/core/03-connection/keeper/keeper.go +++ b/modules/core/03-connection/keeper/keeper.go @@ -2,12 +2,14 @@ package keeper import ( errorsmod "cosmossdk.io/errors" - "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cometbft/cometbft/libs/log" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" diff --git a/modules/core/03-connection/keeper/verify.go b/modules/core/03-connection/keeper/verify.go index c1316fb9ea2..b02f8b82d0f 100644 --- a/modules/core/03-connection/keeper/verify.go +++ b/modules/core/03-connection/keeper/verify.go @@ -4,6 +4,7 @@ import ( "math" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/core/03-connection/simulation/decoder_test.go b/modules/core/03-connection/simulation/decoder_test.go index 698bfda539d..8cb2ae5f3ef 100644 --- a/modules/core/03-connection/simulation/decoder_test.go +++ b/modules/core/03-connection/simulation/decoder_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/cosmos/cosmos-sdk/types/kv" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/ibc-go/v7/modules/core/03-connection/simulation" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/03-connection/types/msgs.go b/modules/core/03-connection/types/msgs.go index 0d9c808cf27..67837a2133f 100644 --- a/modules/core/03-connection/types/msgs.go +++ b/modules/core/03-connection/types/msgs.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 125676fbb35..588875dd693 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -5,15 +5,17 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - log "github.com/cometbft/cometbft/libs/log" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + log "github.com/cometbft/cometbft/libs/log" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/core/04-channel/client/cli/cli.go b/modules/core/04-channel/client/cli/cli.go index f8c8afd4d39..b4d777d4b18 100644 --- a/modules/core/04-channel/client/cli/cli.go +++ b/modules/core/04-channel/client/cli/cli.go @@ -1,9 +1,10 @@ package cli import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) diff --git a/modules/core/04-channel/client/cli/query.go b/modules/core/04-channel/client/cli/query.go index bac6660ed4e..1d51ef59a41 100644 --- a/modules/core/04-channel/client/cli/query.go +++ b/modules/core/04-channel/client/cli/query.go @@ -4,10 +4,11 @@ import ( "fmt" "strconv" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/client/utils" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/client/utils/utils.go b/modules/core/04-channel/client/utils/utils.go index 7110ee2879b..980a261640e 100644 --- a/modules/core/04-channel/client/utils/utils.go +++ b/modules/core/04-channel/client/utils/utils.go @@ -5,6 +5,7 @@ import ( "encoding/binary" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/modules/core/04-channel/keeper/grpc_query.go b/modules/core/04-channel/keeper/grpc_query.go index bf867810411..d0415e1bb63 100644 --- a/modules/core/04-channel/keeper/grpc_query.go +++ b/modules/core/04-channel/keeper/grpc_query.go @@ -5,12 +5,14 @@ import ( "strconv" "strings" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/core/04-channel/keeper/handshake.go b/modules/core/04-channel/keeper/handshake.go index 69213a0884c..3bc06ba83a4 100644 --- a/modules/core/04-channel/keeper/handshake.go +++ b/modules/core/04-channel/keeper/handshake.go @@ -4,10 +4,11 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/keeper/handshake_test.go b/modules/core/04-channel/keeper/handshake_test.go index ad349834e16..3b0c8057edc 100644 --- a/modules/core/04-channel/keeper/handshake_test.go +++ b/modules/core/04-channel/keeper/handshake_test.go @@ -4,7 +4,6 @@ import ( "fmt" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index d628abbed83..5a02b9e0fb3 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -4,14 +4,15 @@ import ( "strconv" "strings" - db "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" errorsmod "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + db "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index 1ec5e94521c..d448d45b822 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -6,9 +6,10 @@ import ( "time" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 82cb113ae6a..6077127d432 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -5,8 +5,8 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index a0783131d9e..c0248917306 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -5,9 +5,10 @@ import ( "strconv" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index 337949b0288..3f834f4674b 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -5,8 +5,8 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/simulation/decoder_test.go b/modules/core/04-channel/simulation/decoder_test.go index 67883b4f6e4..19ee81f6ce1 100644 --- a/modules/core/04-channel/simulation/decoder_test.go +++ b/modules/core/04-channel/simulation/decoder_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/simulation" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/types/acknowledgement.go b/modules/core/04-channel/types/acknowledgement.go index 3e4d02a1180..27617d391f5 100644 --- a/modules/core/04-channel/types/acknowledgement.go +++ b/modules/core/04-channel/types/acknowledgement.go @@ -6,6 +6,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/modules/core/04-channel/types/acknowledgement_test.go b/modules/core/04-channel/types/acknowledgement_test.go index 3d7c6222d08..b5ff0af3141 100644 --- a/modules/core/04-channel/types/acknowledgement_test.go +++ b/modules/core/04-channel/types/acknowledgement_test.go @@ -4,10 +4,12 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + abcitypes "github.com/cometbft/cometbft/abci/types" tmprotostate "github.com/cometbft/cometbft/proto/tendermint/state" tmstate "github.com/cometbft/cometbft/state" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index 3230929bd98..342164e9393 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -2,8 +2,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/core/04-channel/types/msgs.go b/modules/core/04-channel/types/msgs.go index 893b82156d0..6a7ff1752cc 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -4,6 +4,7 @@ import ( "encoding/base64" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index 1c59920ae3c..ae437a476b6 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - log "github.com/cometbft/cometbft/libs/log" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" + + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + log "github.com/cometbft/cometbft/libs/log" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/04-channel/types/packet.go b/modules/core/04-channel/types/packet.go index c007f3af9b0..26006f1fd20 100644 --- a/modules/core/04-channel/types/packet.go +++ b/modules/core/04-channel/types/packet.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/04-channel/types/packet_test.go b/modules/core/04-channel/types/packet_test.go index 780844dbb54..a33c6fb75bd 100644 --- a/modules/core/04-channel/types/packet_test.go +++ b/modules/core/04-channel/types/packet_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/stretchr/testify/require" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index 802b818c8cc..f83c42af64b 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -3,10 +3,11 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + "github.com/cometbft/cometbft/libs/log" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index 476b871b076..da61c501428 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -3,11 +3,13 @@ package keeper_test import ( "testing" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/ibc-go/v7/modules/core/05-port/keeper" "github.com/cosmos/ibc-go/v7/testing/simapp" ) diff --git a/modules/core/05-port/types/module.go b/modules/core/05-port/types/module.go index e6fef6420af..33465bf6f98 100644 --- a/modules/core/05-port/types/module.go +++ b/modules/core/05-port/types/module.go @@ -2,8 +2,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/23-commitment/types/commitment_test.go b/modules/core/23-commitment/types/commitment_test.go index 093e7df674c..9d204e108bf 100644 --- a/modules/core/23-commitment/types/commitment_test.go +++ b/modules/core/23-commitment/types/commitment_test.go @@ -3,12 +3,14 @@ package types_test import ( "testing" - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/stretchr/testify/suite" + + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" ) type MerkleTestSuite struct { diff --git a/modules/core/23-commitment/types/merkle.go b/modules/core/23-commitment/types/merkle.go index 07c91deabc2..79a2c113fc6 100644 --- a/modules/core/23-commitment/types/merkle.go +++ b/modules/core/23-commitment/types/merkle.go @@ -5,11 +5,13 @@ import ( "fmt" "net/url" - errorsmod "cosmossdk.io/errors" - tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/cosmos/gogoproto/proto" ics23 "github.com/cosmos/ics23/go" + errorsmod "cosmossdk.io/errors" + + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index 90fee1a8761..5b80c7ce266 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - abci "github.com/cometbft/cometbft/abci/types" "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" ) diff --git a/modules/core/23-commitment/types/utils.go b/modules/core/23-commitment/types/utils.go index 83844d35960..79530fc51fd 100644 --- a/modules/core/23-commitment/types/utils.go +++ b/modules/core/23-commitment/types/utils.go @@ -1,9 +1,11 @@ package types import ( + ics23 "github.com/cosmos/ics23/go" + errorsmod "cosmossdk.io/errors" + crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - ics23 "github.com/cosmos/ics23/go" ) // ConvertProofs converts crypto.ProofOps into MerkleProof diff --git a/modules/core/23-commitment/types/utils_test.go b/modules/core/23-commitment/types/utils_test.go index 4f5b4f89f5c..f82dce0ad82 100644 --- a/modules/core/23-commitment/types/utils_test.go +++ b/modules/core/23-commitment/types/utils_test.go @@ -3,9 +3,10 @@ package types_test import ( "fmt" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" ) diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 20ed350a053..1ec224abe58 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -3,10 +3,11 @@ package ante_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/core/client/cli/cli.go b/modules/core/client/cli/cli.go index 6d5da971264..08871519579 100644 --- a/modules/core/client/cli/cli.go +++ b/modules/core/client/cli/cli.go @@ -1,9 +1,10 @@ package cli import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" + ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" connection "github.com/cosmos/ibc-go/v7/modules/core/03-connection" channel "github.com/cosmos/ibc-go/v7/modules/core/04-channel" diff --git a/modules/core/client/query.go b/modules/core/client/query.go index 19b490a1c25..57e06d56c3c 100644 --- a/modules/core/client/query.go +++ b/modules/core/client/query.go @@ -3,10 +3,11 @@ package client import ( "fmt" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + abci "github.com/cometbft/cometbft/abci/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index 731d7e5edf7..1655df03141 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -1,9 +1,10 @@ package exported import ( + proto "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - proto "github.com/cosmos/gogoproto/proto" ) // Status represents the status of a client diff --git a/modules/core/exported/expected_keepers.go b/modules/core/exported/expected_keepers.go index afd4bce4e56..f1496c7f2b2 100644 --- a/modules/core/exported/expected_keepers.go +++ b/modules/core/exported/expected_keepers.go @@ -2,6 +2,7 @@ package exported import ( sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ) diff --git a/modules/core/genesis_test.go b/modules/core/genesis_test.go index 9d07dae91b4..fb1472cc507 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -4,10 +4,12 @@ import ( "fmt" "testing" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/codec" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + ibc "github.com/cosmos/ibc-go/v7/modules/core" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/modules/core/keeper/keeper.go b/modules/core/keeper/keeper.go index fb2583a72c4..3c3d30a9ddf 100644 --- a/modules/core/keeper/keeper.go +++ b/modules/core/keeper/keeper.go @@ -7,8 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectionkeeper "github.com/cosmos/ibc-go/v7/modules/core/03-connection/keeper" diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index 8f927fb1815..19fb8132a07 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -4,13 +4,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/stretchr/testify/suite" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index c75f11b8d87..dc2690e4e97 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -3,8 +3,10 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" metrics "github.com/armon/go-metrics" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/migrations/v7/genesis_test.go b/modules/core/migrations/v7/genesis_test.go index 943a9d9593f..bdbacb066b8 100644 --- a/modules/core/migrations/v7/genesis_test.go +++ b/modules/core/migrations/v7/genesis_test.go @@ -3,10 +3,11 @@ package v7_test import ( "testing" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/stretchr/testify/suite" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" clientv7 "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7" diff --git a/modules/core/module.go b/modules/core/module.go index 08bec4991fb..501e5459f5b 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -5,15 +5,17 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" diff --git a/modules/core/simulation/decoder_test.go b/modules/core/simulation/decoder_test.go index 4bd39e8395d..899eaaed271 100644 --- a/modules/core/simulation/decoder_test.go +++ b/modules/core/simulation/decoder_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - "github.com/cosmos/cosmos-sdk/types/kv" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types/kv" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/core/simulation/genesis_test.go b/modules/core/simulation/genesis_test.go index f3bbf9ecc1c..bc589d016eb 100644 --- a/modules/core/simulation/genesis_test.go +++ b/modules/core/simulation/genesis_test.go @@ -5,13 +5,15 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/stretchr/testify/require" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" "github.com/cosmos/ibc-go/v7/modules/core/simulation" diff --git a/modules/light-clients/06-solomachine/client_state.go b/modules/light-clients/06-solomachine/client_state.go index fbd84e62534..282c421807a 100644 --- a/modules/light-clients/06-solomachine/client_state.go +++ b/modules/light-clients/06-solomachine/client_state.go @@ -4,6 +4,7 @@ import ( "reflect" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/light-clients/06-solomachine/codec.go b/modules/light-clients/06-solomachine/codec.go index e18cd8b563c..2050df17d31 100644 --- a/modules/light-clients/06-solomachine/codec.go +++ b/modules/light-clients/06-solomachine/codec.go @@ -2,6 +2,7 @@ package solomachine import ( errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" diff --git a/modules/light-clients/06-solomachine/consensus_state.go b/modules/light-clients/06-solomachine/consensus_state.go index 8925ec3a5c2..3394311ab96 100644 --- a/modules/light-clients/06-solomachine/consensus_state.go +++ b/modules/light-clients/06-solomachine/consensus_state.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/light-clients/06-solomachine/header.go b/modules/light-clients/06-solomachine/header.go index 87d90dee48b..38c59ba7054 100644 --- a/modules/light-clients/06-solomachine/header.go +++ b/modules/light-clients/06-solomachine/header.go @@ -4,6 +4,7 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/light-clients/06-solomachine/misbehaviour_handle.go b/modules/light-clients/06-solomachine/misbehaviour_handle.go index f65f3c95350..0d1d2a3a618 100644 --- a/modules/light-clients/06-solomachine/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/misbehaviour_handle.go @@ -1,9 +1,9 @@ package solomachine import ( - "github.com/cosmos/cosmos-sdk/codec" - errorsmod "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" diff --git a/modules/light-clients/06-solomachine/module.go b/modules/light-clients/06-solomachine/module.go index 69c04e46f04..fea0450e1fd 100644 --- a/modules/light-clients/06-solomachine/module.go +++ b/modules/light-clients/06-solomachine/module.go @@ -3,12 +3,13 @@ package solomachine import ( "encoding/json" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" ) var _ module.AppModuleBasic = (*AppModuleBasic)(nil) diff --git a/modules/light-clients/06-solomachine/proof.go b/modules/light-clients/06-solomachine/proof.go index aab15c17d3c..f156e353408 100644 --- a/modules/light-clients/06-solomachine/proof.go +++ b/modules/light-clients/06-solomachine/proof.go @@ -2,6 +2,7 @@ package solomachine import ( errorsmod "cosmossdk.io/errors" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/crypto/types/multisig" "github.com/cosmos/cosmos-sdk/types/tx/signing" diff --git a/modules/light-clients/06-solomachine/proposal_handle.go b/modules/light-clients/06-solomachine/proposal_handle.go index 2e6fdfd7ed8..4ad6071cba0 100644 --- a/modules/light-clients/06-solomachine/proposal_handle.go +++ b/modules/light-clients/06-solomachine/proposal_handle.go @@ -4,6 +4,7 @@ import ( "reflect" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/light-clients/06-solomachine/solomachine_test.go b/modules/light-clients/06-solomachine/solomachine_test.go index 824872df26e..b4b37b54857 100644 --- a/modules/light-clients/06-solomachine/solomachine_test.go +++ b/modules/light-clients/06-solomachine/solomachine_test.go @@ -4,13 +4,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/light-clients/06-solomachine/update.go b/modules/light-clients/06-solomachine/update.go index 8d044e0a2e9..c08a3de3fb3 100644 --- a/modules/light-clients/06-solomachine/update.go +++ b/modules/light-clients/06-solomachine/update.go @@ -4,6 +4,7 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/light-clients/07-tendermint/client_state.go b/modules/light-clients/07-tendermint/client_state.go index 50284b84f48..722e2676415 100644 --- a/modules/light-clients/07-tendermint/client_state.go +++ b/modules/light-clients/07-tendermint/client_state.go @@ -4,12 +4,15 @@ import ( "strings" "time" + ics23 "github.com/cosmos/ics23/go" + errorsmod "cosmossdk.io/errors" - "github.com/cometbft/cometbft/light" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - ics23 "github.com/cosmos/ics23/go" + + "github.com/cometbft/cometbft/light" + tmtypes "github.com/cometbft/cometbft/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" diff --git a/modules/light-clients/07-tendermint/client_state_test.go b/modules/light-clients/07-tendermint/client_state_test.go index 9df8c6047ba..0eee6512d0c 100644 --- a/modules/light-clients/07-tendermint/client_state_test.go +++ b/modules/light-clients/07-tendermint/client_state_test.go @@ -3,9 +3,10 @@ package tendermint_test import ( "time" - sdk "github.com/cosmos/cosmos-sdk/types" ics23 "github.com/cosmos/ics23/go" + sdk "github.com/cosmos/cosmos-sdk/types" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/modules/light-clients/07-tendermint/consensus_state.go b/modules/light-clients/07-tendermint/consensus_state.go index 86eb9a9fc58..b52fec596f9 100644 --- a/modules/light-clients/07-tendermint/consensus_state.go +++ b/modules/light-clients/07-tendermint/consensus_state.go @@ -4,6 +4,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + tmbytes "github.com/cometbft/cometbft/libs/bytes" tmtypes "github.com/cometbft/cometbft/types" diff --git a/modules/light-clients/07-tendermint/header.go b/modules/light-clients/07-tendermint/header.go index 8b0528a1f6c..1014c8a75ee 100644 --- a/modules/light-clients/07-tendermint/header.go +++ b/modules/light-clients/07-tendermint/header.go @@ -5,6 +5,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + tmtypes "github.com/cometbft/cometbft/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/modules/light-clients/07-tendermint/migrations/expected_keepers.go b/modules/light-clients/07-tendermint/migrations/expected_keepers.go index e68bdbc97da..b655b187a27 100644 --- a/modules/light-clients/07-tendermint/migrations/expected_keepers.go +++ b/modules/light-clients/07-tendermint/migrations/expected_keepers.go @@ -1,9 +1,10 @@ package migrations import ( - "github.com/cometbft/cometbft/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/light-clients/07-tendermint/migrations/migrations.go b/modules/light-clients/07-tendermint/migrations/migrations.go index f5d28fe468f..bcb1deebeb1 100644 --- a/modules/light-clients/07-tendermint/migrations/migrations.go +++ b/modules/light-clients/07-tendermint/migrations/migrations.go @@ -2,6 +2,7 @@ package migrations import ( errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/light-clients/07-tendermint/misbehaviour.go b/modules/light-clients/07-tendermint/misbehaviour.go index f81f5a01385..bce812e4537 100644 --- a/modules/light-clients/07-tendermint/misbehaviour.go +++ b/modules/light-clients/07-tendermint/misbehaviour.go @@ -4,6 +4,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" diff --git a/modules/light-clients/07-tendermint/misbehaviour_handle.go b/modules/light-clients/07-tendermint/misbehaviour_handle.go index 46b962fcabc..edc000dd0d5 100644 --- a/modules/light-clients/07-tendermint/misbehaviour_handle.go +++ b/modules/light-clients/07-tendermint/misbehaviour_handle.go @@ -6,10 +6,12 @@ import ( "time" errorsmod "cosmossdk.io/errors" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + tmtypes "github.com/cometbft/cometbft/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/modules/light-clients/07-tendermint/module.go b/modules/light-clients/07-tendermint/module.go index e2201fc2876..516d7368afe 100644 --- a/modules/light-clients/07-tendermint/module.go +++ b/modules/light-clients/07-tendermint/module.go @@ -3,12 +3,13 @@ package tendermint import ( "encoding/json" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" ) var _ module.AppModuleBasic = (*AppModuleBasic)(nil) diff --git a/modules/light-clients/07-tendermint/proposal_handle.go b/modules/light-clients/07-tendermint/proposal_handle.go index 98b37ebf019..8205ef07893 100644 --- a/modules/light-clients/07-tendermint/proposal_handle.go +++ b/modules/light-clients/07-tendermint/proposal_handle.go @@ -5,6 +5,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/light-clients/07-tendermint/tendermint_test.go b/modules/light-clients/07-tendermint/tendermint_test.go index 6676e459b64..025c57deeb1 100644 --- a/modules/light-clients/07-tendermint/tendermint_test.go +++ b/modules/light-clients/07-tendermint/tendermint_test.go @@ -4,12 +4,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + tmbytes "github.com/cometbft/cometbft/libs/bytes" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" diff --git a/modules/light-clients/07-tendermint/update.go b/modules/light-clients/07-tendermint/update.go index c3cd8144ff2..a82ea3acfcf 100644 --- a/modules/light-clients/07-tendermint/update.go +++ b/modules/light-clients/07-tendermint/update.go @@ -5,11 +5,13 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - "github.com/cometbft/cometbft/light" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cometbft/cometbft/light" + tmtypes "github.com/cometbft/cometbft/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/light-clients/07-tendermint/update_test.go b/modules/light-clients/07-tendermint/update_test.go index b4e072ecbef..dc7e68629c1 100644 --- a/modules/light-clients/07-tendermint/update_test.go +++ b/modules/light-clients/07-tendermint/update_test.go @@ -3,9 +3,10 @@ package tendermint_test import ( "time" - tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" + tmtypes "github.com/cometbft/cometbft/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/modules/light-clients/07-tendermint/upgrade.go b/modules/light-clients/07-tendermint/upgrade.go index 912a11d80a5..a8f18c5df9a 100644 --- a/modules/light-clients/07-tendermint/upgrade.go +++ b/modules/light-clients/07-tendermint/upgrade.go @@ -4,6 +4,7 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" diff --git a/modules/light-clients/09-localhost/client_state.go b/modules/light-clients/09-localhost/client_state.go index 902180a9292..a28ff2a942f 100644 --- a/modules/light-clients/09-localhost/client_state.go +++ b/modules/light-clients/09-localhost/client_state.go @@ -4,6 +4,7 @@ import ( "bytes" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/testing/app.go b/testing/app.go index 03190ada379..a67f46e2870 100644 --- a/testing/app.go +++ b/testing/app.go @@ -5,12 +5,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -22,9 +20,14 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" + + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" "github.com/cosmos/ibc-go/v7/modules/core/keeper" "github.com/cosmos/ibc-go/v7/testing/simapp" ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" diff --git a/testing/chain.go b/testing/chain.go index 13ce21a8ec4..17513334525 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -5,14 +5,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/tmhash" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmprotoversion "github.com/cometbft/cometbft/proto/tendermint/version" - tmtypes "github.com/cometbft/cometbft/types" - tmversion "github.com/cometbft/cometbft/version" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -22,10 +19,16 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking/testutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/crypto/tmhash" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmprotoversion "github.com/cometbft/cometbft/proto/tendermint/version" + tmtypes "github.com/cometbft/cometbft/types" + tmversion "github.com/cometbft/cometbft/version" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/stretchr/testify/require" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/testing/chain_test.go b/testing/chain_test.go index e0a97795e38..8eb6315716c 100644 --- a/testing/chain_test.go +++ b/testing/chain_test.go @@ -3,9 +3,11 @@ package ibctesting_test import ( "testing" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" ibctesting "github.com/cosmos/ibc-go/v7/testing" ) diff --git a/testing/coordinator.go b/testing/coordinator.go index 0ad4b05a40e..1f3418a983c 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -6,8 +6,9 @@ import ( "testing" "time" - abci "github.com/cometbft/cometbft/abci/types" "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" ) var ( diff --git a/testing/endpoint.go b/testing/endpoint.go index 98c8d22f6f6..c938f99d5e6 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -4,9 +4,10 @@ import ( "fmt" "strings" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" diff --git a/testing/events.go b/testing/events.go index ac1fdd71954..69fef9d1f8c 100644 --- a/testing/events.go +++ b/testing/events.go @@ -4,9 +4,10 @@ import ( "fmt" "strconv" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/testing/mock/ibc_app.go b/testing/mock/ibc_app.go index 530bfaae4b5..ada64edfb40 100644 --- a/testing/mock/ibc_app.go +++ b/testing/mock/ibc_app.go @@ -2,9 +2,9 @@ package mock import ( sdk "github.com/cosmos/cosmos-sdk/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" ) diff --git a/testing/mock/ibc_module.go b/testing/mock/ibc_module.go index 698fad5f623..ec03110e164 100644 --- a/testing/mock/ibc_module.go +++ b/testing/mock/ibc_module.go @@ -7,8 +7,8 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 871996a9293..ca6e9c49eee 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -4,16 +4,18 @@ import ( "encoding/json" "fmt" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" + abci "github.com/cometbft/cometbft/abci/types" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" diff --git a/testing/mock/privval.go b/testing/mock/privval.go index a92cc1fc5fa..660fb481416 100644 --- a/testing/mock/privval.go +++ b/testing/mock/privval.go @@ -1,12 +1,13 @@ package mock import ( - "github.com/cometbft/cometbft/crypto" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + + "github.com/cometbft/cometbft/crypto" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" ) var _ tmtypes.PrivValidator = PV{} diff --git a/testing/mock/privval_test.go b/testing/mock/privval_test.go index d8ef0e4409b..0814c265b03 100644 --- a/testing/mock/privval_test.go +++ b/testing/mock/privval_test.go @@ -3,9 +3,10 @@ package mock_test import ( "testing" + "github.com/stretchr/testify/require" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v7/testing/mock" ) diff --git a/testing/simapp/ante_handler.go b/testing/simapp/ante_handler.go index 1a0e2106045..1214324e66b 100644 --- a/testing/simapp/ante_handler.go +++ b/testing/simapp/ante_handler.go @@ -2,6 +2,7 @@ package simapp import ( errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" diff --git a/testing/simapp/app.go b/testing/simapp/app.go index d72c6b12787..863128ca5ea 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -6,14 +6,15 @@ import ( "os" "path/filepath" + "github.com/spf13/cast" + + _ "github.com/cosmos/cosmos-sdk/client/docs/statik" // this is used for serving docs + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "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" @@ -93,12 +94,14 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/spf13/cast" + + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" diff --git a/testing/simapp/export.go b/testing/simapp/export.go index 36749d1a777..2caa609bc82 100644 --- a/testing/simapp/export.go +++ b/testing/simapp/export.go @@ -4,12 +4,13 @@ import ( "encoding/json" "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis diff --git a/testing/simapp/genesis_account_test.go b/testing/simapp/genesis_account_test.go index be767553606..c4488bb2826 100644 --- a/testing/simapp/genesis_account_test.go +++ b/testing/simapp/genesis_account_test.go @@ -4,11 +4,13 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/crypto" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto" "github.com/cosmos/ibc-go/v7/testing/simapp" ) diff --git a/testing/simapp/sim_bench_test.go b/testing/simapp/sim_bench_test.go index 795cd05ff14..05e019a4ecc 100644 --- a/testing/simapp/sim_bench_test.go +++ b/testing/simapp/sim_bench_test.go @@ -5,7 +5,6 @@ import ( "os" "testing" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client/flags" @@ -14,6 +13,8 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" ) // Profile with: diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 6d810bc6e7e..573579573fc 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -9,20 +9,13 @@ import ( "strings" "testing" - simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -35,9 +28,15 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + // IBC capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" diff --git a/testing/simapp/simd/cmd/cmd_test.go b/testing/simapp/simd/cmd/cmd_test.go index 2b00c69b0b1..15cc433cab4 100644 --- a/testing/simapp/simd/cmd/cmd_test.go +++ b/testing/simapp/simd/cmd/cmd_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/ibc-go/v7/testing/simapp" - "github.com/cosmos/ibc-go/v7/testing/simapp/simd/cmd" - "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + + "github.com/cosmos/ibc-go/v7/testing/simapp" + "github.com/cosmos/ibc-go/v7/testing/simapp/simd/cmd" ) func TestInitCmd(t *testing.T) { diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 2f6d88fa3dd..c6070fbd471 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -5,14 +5,11 @@ import ( "io" "os" - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" - - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - "github.com/cometbft/cometbft/libs/log" "github.com/spf13/cobra" "github.com/spf13/viper" + rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -31,6 +28,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + dbm "github.com/cometbft/cometbft-db" + tmcfg "github.com/cometbft/cometbft/config" + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/ibc-go/v7/testing/simapp" "github.com/cosmos/ibc-go/v7/testing/simapp/params" ) diff --git a/testing/simapp/state.go b/testing/simapp/state.go index fb69deb7512..d7e5853d162 100644 --- a/testing/simapp/state.go +++ b/testing/simapp/state.go @@ -9,8 +9,7 @@ import ( "time" sdkmath "cosmossdk.io/math" - tmjson "github.com/cometbft/cometbft/libs/json" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,6 +19,9 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + tmjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" + simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params" ) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 0ed6f3fd27d..fd305ba9a0a 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -8,13 +8,24 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "cosmossdk.io/math" + + bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "github.com/cosmos/cosmos-sdk/testutil/network" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" dbm "github.com/cometbft/cometbft-db" @@ -22,16 +33,8 @@ import ( "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" - bam "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/v7/testing/mock" - "github.com/stretchr/testify/require" ) // SetupOptions defines arguments that are passed into `Simapp` constructor. diff --git a/testing/simapp/upgrades.go b/testing/simapp/upgrades.go index 4afaa02b8fd..2019f07d1d4 100644 --- a/testing/simapp/upgrades.go +++ b/testing/simapp/upgrades.go @@ -10,8 +10,8 @@ import ( paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" v6 "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/migrations/v6" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" "github.com/cosmos/ibc-go/v7/modules/core/exported" diff --git a/testing/simapp/utils.go b/testing/simapp/utils.go index faa7bbcf820..31f4b1aa05a 100644 --- a/testing/simapp/utils.go +++ b/testing/simapp/utils.go @@ -3,9 +3,10 @@ package simapp import ( "os" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) // SetupSimulation creates the config, db (levelDB), temporary directory and logger for diff --git a/testing/simapp/utils_test.go b/testing/simapp/utils_test.go index 4b828a2e4d7..b9f07a0b9bb 100644 --- a/testing/simapp/utils_test.go +++ b/testing/simapp/utils_test.go @@ -4,6 +4,8 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -11,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" ) func makeCodec(bm module.BasicManager) *codec.LegacyAmino { diff --git a/testing/solomachine.go b/testing/solomachine.go index 313e93de696..df683d3ea0c 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -4,7 +4,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -13,7 +16,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/types/multisig" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/stretchr/testify/require" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/testing/utils.go b/testing/utils.go index 08d483a218d..302d0e70822 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -3,9 +3,10 @@ package ibctesting import ( "testing" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) // ApplyValSetChanges takes in tmtypes.ValidatorSet and []abci.ValidatorUpdate and will return a new tmtypes.ValidatorSet which has the diff --git a/testing/values.go b/testing/values.go index 0251e40bc81..3e933053c23 100644 --- a/testing/values.go +++ b/testing/values.go @@ -8,6 +8,7 @@ import ( "time" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" From 6dce0917a0c27d383ef0b2d7f6be711d88fdefbd Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 21 Jun 2023 17:27:54 +0800 Subject: [PATCH 18/59] revert changes to go.work example --- go.work.example | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.work.example b/go.work.example index e4e432f921c..5481cb3c915 100644 --- a/go.work.example +++ b/go.work.example @@ -1,7 +1,6 @@ -go 1.20 +go 1.19 use ( - ./modules/capability ./ ./e2e ) From 7ea500caed04d743675fe874fd6318c44880e483 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Thu, 22 Jun 2023 22:00:48 +0800 Subject: [PATCH 19/59] lint docs same as docs-lint pr --- CODE_OF_CONDUCT.md | 2 +- SECURITY.md | 4 +- docs/apps/transfer/client.md | 2 +- .../adr-008-app-caller-cbs.md | 26 +- .../transfer-callback-scaffold.md | 244 +++++++++--------- .../adr-010-light-clients-as-sdk-modules.md | 100 +++---- ...r-011-transfer-total-escrow-state-entry.md | 4 +- docs/dev/go-style-guide.md | 2 +- docs/ibc/events.md | 2 +- .../light-clients/localhost/integration.md | 2 +- .../localhost/state-verification.md | 2 +- docs/ibc/troubleshooting.md | 2 +- docs/migrations/v6-to-v7.md | 4 +- docs/migrations/v7-to-v7_1.md | 4 +- docs/migrations/v7-to-v8.md | 70 ++--- docs/requirements/ics27-v2-requirements.md | 7 +- docs/requirements/localhost-requirements.md | 12 +- e2e/README.md | 2 +- modules/apps/transfer/keeper/MBT_README.md | 2 +- modules/capability/README.md | 14 +- 20 files changed, 254 insertions(+), 253 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c9f9cc2405e..7040f1d71a3 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@interchain.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/SECURITY.md b/SECURITY.md index b003cd6c80b..9f342ef1022 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,8 +15,8 @@ contributors to help continually secure our operations. | All [actively supported releases branches](./RELEASES.md#stable-release-policy) | | main branch | -All actively supported release branches (see table in [section Stable Release Policy in RELEASES.md](./RELEASES.md#stable-release-policy)) -of this repository are supported for security updates as well as the **main** +All actively supported release branches (see table in [section Stable Release Policy in RELEASES.md](./RELEASES.md#stable-release-policy)) +of this repository are supported for security updates as well as the **main** branch. Security vulnerabilities should be reported if the vulnerability can be reproduced on either one of those. diff --git a/docs/apps/transfer/client.md b/docs/apps/transfer/client.md index 515fad57d5c..28034f54c73 100644 --- a/docs/apps/transfer/client.md +++ b/docs/apps/transfer/client.md @@ -63,4 +63,4 @@ Example output: { "amount": "100" } -``` \ No newline at end of file +``` diff --git a/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md b/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md index b67275ccf49..674d1902db7 100644 --- a/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md +++ b/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md @@ -18,14 +18,14 @@ This setup worked well for off-chain users interacting with IBC applications. We are now seeing the desire for secondary applications (e.g. smart contracts, modules) to call into IBC apps as part of their state machine logic and then do some actions on the basis of the packet result. Or to receive a packet from IBC and do some logic upon receipt. Example Usecases: -- Send an ICS-20 packet, and if it is successful, then send an ICA-packet to swap tokens on LP and return funds to sender -- Execute some logic upon receipt of token transfer to a smart contract address +* Send an ICS-20 packet, and if it is successful, then send an ICA-packet to swap tokens on LP and return funds to sender +* Execute some logic upon receipt of token transfer to a smart contract address This requires a second layer of callbacks. The IBC application already gets the result of the packet from core IBC, but currently there is no standardized way to pass this information on to an actor module/smart contract. ## Definitions -- Actor: an actor is an on-chain module (this may be a hardcoded module in the chain binary or a smart contract) that wishes to execute custom logic whenever IBC receives a packet flow that it has either sent or received. It **must** be addressable by a string value. +* Actor: an actor is an on-chain module (this may be a hardcoded module in the chain binary or a smart contract) that wishes to execute custom logic whenever IBC receives a packet flow that it has either sent or received. It **must** be addressable by a string value. ## Decision @@ -113,7 +113,7 @@ IBC Apps or middleware can then call the IBCActor callbacks like so in their own ### Handshake Callbacks The `OnChanOpenInit` handshake callback will need to include an additional field so that the initiating actor can be tracked and called upon during handshake completion. -The actor provided in the `OnChanOpenInit` callback will be the signer of the `MsgChanOpenInit` message. +The actor provided in the `OnChanOpenInit` callback will be the signer of the `MsgChanOpenInit` message. ```go func OnChanOpenInit( @@ -188,7 +188,7 @@ func OnChanCloseConfirm( } ``` -NOTE: The handshake calls `OnChanOpenTry` and `OnChanOpenConfirm` are explicitly left out as it is still to be determined how the actor of the `OnChanOpenTry` step should be provided. Initially only the initiating side of the channel handshake may support setting a channel actor, future improvements should allow both sides of the channel handshake to set channel actors. +NOTE: The handshake calls `OnChanOpenTry` and `OnChanOpenConfirm` are explicitly left out as it is still to be determined how the actor of the `OnChanOpenTry` step should be provided. Initially only the initiating side of the channel handshake may support setting a channel actor, future improvements should allow both sides of the channel handshake to set channel actors. ### PacketCallbacks @@ -402,20 +402,20 @@ Chains are expected to specify a `chainDefinedActorCallbackLimit` to ensure that ### Positive -- IBC Actors can now programatically execute logic that involves sending a packet and then performing some additional logic once the packet lifecycle is complete -- Middleware implementing ADR-8 can be generally used for any application -- Leverages the same callback architecture used between core IBC and IBC applications +* IBC Actors can now programatically execute logic that involves sending a packet and then performing some additional logic once the packet lifecycle is complete +* Middleware implementing ADR-8 can be generally used for any application +* Leverages the same callback architecture used between core IBC and IBC applications ### Negative -- Callbacks may now have unbounded gas consumption since the actor may execute arbitrary logic. Chains implementing this feature should take care to place limitations on how much gas an actor callback can consume. +* Callbacks may now have unbounded gas consumption since the actor may execute arbitrary logic. Chains implementing this feature should take care to place limitations on how much gas an actor callback can consume. ### Neutral -- Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec +* Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec ## References -- [Original issue](https://github.com/cosmos/ibc-go/issues/1660) -- [CallbackPacketData interface implementation](https://github.com/cosmos/ibc-go/pull/3287) -- [ICS 20, ICS 27 implementations of the CallbackPacketData interface](https://github.com/cosmos/ibc-go/pull/3287) +* [Original issue](https://github.com/cosmos/ibc-go/issues/1660) +* [CallbackPacketData interface implementation](https://github.com/cosmos/ibc-go/pull/3287) +* [ICS 20, ICS 27 implementations of the CallbackPacketData interface](https://github.com/cosmos/ibc-go/pull/3287) diff --git a/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md b/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md index 904a6c52423..dd2e9db013f 100644 --- a/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md +++ b/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md @@ -6,20 +6,20 @@ The exact nature of the callbacks to the smart contract will depend on the envir Implementers may wish to support callbacks to more IBC applications by adding a switch statement to unmarshal the specific packet data types they wish to support and passing them into the smart contract callback functions. -### Scaffold Middleware +## Scaffold Middleware ```go package callbacks import ( - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - - transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" - "github.com/cosmos/ibc-go/v6/modules/core/exported" + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + + transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v6/modules/core/exported" ) var _ porttypes.Middleware = &IBCMiddleware{} @@ -27,197 +27,197 @@ var _ porttypes.Middleware = &IBCMiddleware{} // IBCMiddleware implements the ICS26 callbacks for the fee middleware given the // fee keeper and the underlying application. type IBCMiddleware struct { - app porttypes.IBCModule - chanWrapper porttypes.ICS4Wrapper + app porttypes.IBCModule + chanWrapper porttypes.ICS4Wrapper } // NewIBCMiddleware creates a new IBCMiddlware given the keeper and underlying application func NewIBCMiddleware(app porttypes.IBCModule, chanWrapper porttypes.ICS4Wrapper) IBCMiddleware { - return IBCMiddleware{ - app: app, - chanWrapper: chanWrapper, - } + return IBCMiddleware{ + app: app, + chanWrapper: chanWrapper, + } } // OnChanOpenInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID string, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - version string, + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, ) (string, error) { - // call underlying app's OnChanOpenInit callback - return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, - chanCap, counterparty, version) + // call underlying app's OnChanOpenInit callback + return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, + chanCap, counterparty, version) } // OnChanOpenTry implements the IBCMiddleware interface // If the channel is not fee enabled the underlying application version will be returned // If the channel is fee enabled we merge the underlying application version with the ics29 version func (im IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - counterpartyVersion string, + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, ) (string, error) { - // call underlying app's OnChanOpenTry callback - return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) + // call underlying app's OnChanOpenTry callback + return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) } // OnChanOpenAck implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, - portID, - channelID string, - counterpartyChannelID string, - counterpartyVersion string, + ctx sdk.Context, + portID, + channelID string, + counterpartyChannelID string, + counterpartyVersion string, ) error { - // call underlying app's OnChanOpenAck callback - return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) + // call underlying app's OnChanOpenAck callback + return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) } // OnChanOpenConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenConfirm( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanOpenConfirm callback. - return im.app.OnChanOpenConfirm(ctx, portID, channelID) + // call underlying app's OnChanOpenConfirm callback. + return im.app.OnChanOpenConfirm(ctx, portID, channelID) } // OnChanCloseInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseInit( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanCloseInit callback. - return im.app.OnChanCloseInit(ctx, portID, channelID) + // call underlying app's OnChanCloseInit callback. + return im.app.OnChanCloseInit(ctx, portID, channelID) } // OnChanCloseConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseConfirm( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanCloseConfirm callback. - return im.app.OnChanCloseConfirm(ctx, portID, channelID) + // call underlying app's OnChanCloseConfirm callback. + return im.app.OnChanCloseConfirm(ctx, portID, channelID) } // OnRecvPacket implements the IBCMiddleware interface. // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnRecvPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, ) exported.Acknowledgement { - // first do the underlying ibc app callback - ack := im.app.OnRecvPacket(ctx, packet, relayer) - - // postprocess the ibc application by executing a callback to the receiver smart contract - // if the receiver of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Receiver is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error acknowledgement + // first do the underlying ibc app callback + ack := im.app.OnRecvPacket(ctx, packet, relayer) + + // postprocess the ibc application by executing a callback to the receiver smart contract + // if the receiver of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Receiver is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error acknowledgement if isSmartContract(data.Receiver) { err := data.Receiver.recvPacketCallback(data) if err != nil { return channeltypes.NewErrorAcknowledgement(err) } } - } - return ack + } + return ack } // OnAcknowledgementPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, ) error { - // call underlying callback - err := im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) - - // postprocess the ibc application by executing a callback to the sender smart contract - // if the sender of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Sender is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error + // call underlying callback + err := im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) + + // postprocess the ibc application by executing a callback to the sender smart contract + // if the sender of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Sender is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error if isSmartContract(data.Sender) { data.Sender.ackPacketCallback(data) } - } - return err + } + return err } // OnTimeoutPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnTimeoutPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, ) error { - // call underlying callback - err := im.app.OnTimeoutPacket(ctx, packet, relayer) - - // postprocess the ibc application by executing a callback to the sender smart contract - // if the sender of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Sender is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error + // call underlying callback + err := im.app.OnTimeoutPacket(ctx, packet, relayer) + + // postprocess the ibc application by executing a callback to the sender smart contract + // if the sender of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Sender is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error if isSmartContract(data.Sender) { data.Sender.timeoutPacketCallback(data) } - } - return err + } + return err } // SendPacket implements the ICS4 Wrapper interface func (im IBCMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, ) (uint64, error) { - return im.chanWrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) + return im.chanWrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) } // WriteAcknowledgement implements the ICS4 Wrapper interface func (im IBCMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - packet exported.PacketI, - ack exported.Acknowledgement, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + packet exported.PacketI, + ack exported.Acknowledgement, ) error { - return im.chanWrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) + return im.chanWrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) } // GetAppVersion returns the application version of the underlying application func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { - return im.chanWrapper.GetAppVersion(ctx, portID, channelID) + return im.chanWrapper.GetAppVersion(ctx, portID, channelID) } -``` \ No newline at end of file +``` diff --git a/docs/architecture/adr-010-light-clients-as-sdk-modules.md b/docs/architecture/adr-010-light-clients-as-sdk-modules.md index 0c8f2bb8e6e..3ebfb2903ed 100644 --- a/docs/architecture/adr-010-light-clients-as-sdk-modules.md +++ b/docs/architecture/adr-010-light-clients-as-sdk-modules.md @@ -1,6 +1,7 @@ # ADR 010: IBC light clients as SDK modules ## Changelog + * 12/12/2022: initial draft ## Status @@ -10,54 +11,55 @@ Proposed ## Context ibc-go has 3 main consumers: -- IBC light clients -- IBC applications -- relayers +* IBC light clients +* IBC applications +* relayers -Relayers listen and respond to events emitted by ibc-go while IBC light clients and applications are invoked by core IBC. +Relayers listen and respond to events emitted by ibc-go while IBC light clients and applications are invoked by core IBC. Currently there exists two different approaches to callbacks being invoked by core IBC. IBC light clients currently are invoked by a `ClientState` and `ConsensusState` interface as defined by [core IBC](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L36). -The 02-client submodule will retrieve the `ClientState` or `ConsensusState` from the IBC store in order to perform callbacks to the light client. -This design requires all required information for the light client to function to be stored in the `ClientState` or `ConsensusState` or potentially under metadata keys for a specific client instance. -Additional information may be provided by core IBC via the defined interface arguments if that information is generic enough to be useful to all IBC light clients. -This constraint has proved problematic as pass through clients (such as wasm) cannot maintain easy access to a VM instance. -In addition, without increasing the size of the defined `ClientState` interface, light clients are unable to take advantage of basic built-in SDK functionality such as genesis import/export and migrations. - -The other approach used to perform callback logic is via registered SDK modules. -This approach is used by core IBC to interact with IBC applications. -IBC applications will register their callbacks on the IBC router at compile time. -When a packet comes in, core IBC will use the IBC router to lookup the registered callback functions for the provided packet. -The benefit of registered callbacks opposed to interface functions is that additional information may be accessed via external keepers. -Because the IBC applications are also SDK modules, they additionally get access to a host of functionality provided by the SDK. -This includes: genesis import/export, migrations, query/transaction CLI commands, type registration, gRPC query registration, and message server registration. - -As described in [ADR 006](./adr-006-02-client-refactor.md), generalizing light client behaviour is difficult. -IBC light clients will obtain greater flexibility and control via the registered SDK module approach. +The 02-client submodule will retrieve the `ClientState` or `ConsensusState` from the IBC store in order to perform callbacks to the light client. +This design requires all required information for the light client to function to be stored in the `ClientState` or `ConsensusState` or potentially under metadata keys for a specific client instance. +Additional information may be provided by core IBC via the defined interface arguments if that information is generic enough to be useful to all IBC light clients. +This constraint has proved problematic as pass through clients (such as wasm) cannot maintain easy access to a VM instance. +In addition, without increasing the size of the defined `ClientState` interface, light clients are unable to take advantage of basic built-in SDK functionality such as genesis import/export and migrations. + +The other approach used to perform callback logic is via registered SDK modules. +This approach is used by core IBC to interact with IBC applications. +IBC applications will register their callbacks on the IBC router at compile time. +When a packet comes in, core IBC will use the IBC router to lookup the registered callback functions for the provided packet. +The benefit of registered callbacks opposed to interface functions is that additional information may be accessed via external keepers. +Because the IBC applications are also SDK modules, they additionally get access to a host of functionality provided by the SDK. +This includes: genesis import/export, migrations, query/transaction CLI commands, type registration, gRPC query registration, and message server registration. + +As described in [ADR 006](./adr-006-02-client-refactor.md), generalizing light client behaviour is difficult. +IBC light clients will obtain greater flexibility and control via the registered SDK module approach. ## Decision Instead of using two different approaches to invoking callbacks, IBC light clients should be invoked as SDK modules. -Over time and as necessary, core IBC should adjust its interactions with light clients such that they are SDK modules as opposed to interfaces. - -One immediate decision that has already been applied is to formalize light client type registration via the inclusion of an `AppModuleBasic` within the `ModuleManager` for a chain. -The [tendermint](https://github.com/cosmos/ibc-go/pull/2825) and [solo machine](https://github.com/cosmos/ibc-go/pull/2826) clients were refactored to include this `AppModuleBasic` implementation and core IBC will no longer include either type as registered by default. - -Longer term solutions include using internal module communication as described in [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-033-protobuf-inter-module-comm.md) on the SDK. -The following functions should become callbacks invoked via intermodule communication: -- `Status` -- `GetTimestampAtHeight` -- `VerifyMembership` -- `VerifyNonMembership` -- `Initialize` -- `VerifyClientMessage` -- `CheckForMisbehaviour` -- `UpdateStateOnMisbehaviour` -- `UpdateState` -- `CheckSubstituteAndUpdateState` -- `VerifyUpgradeAndUpdateState` +Over time and as necessary, core IBC should adjust its interactions with light clients such that they are SDK modules as opposed to interfaces. + +One immediate decision that has already been applied is to formalize light client type registration via the inclusion of an `AppModuleBasic` within the `ModuleManager` for a chain. +The [tendermint](https://github.com/cosmos/ibc-go/pull/2825) and [solo machine](https://github.com/cosmos/ibc-go/pull/2826) clients were refactored to include this `AppModuleBasic` implementation and core IBC will no longer include either type as registered by default. + +Longer term solutions include using internal module communication as described in [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-033-protobuf-inter-module-comm.md) on the SDK. +The following functions should become callbacks invoked via intermodule communication: +* `Status` +* `GetTimestampAtHeight` +* `VerifyMembership` +* `VerifyNonMembership` +* `Initialize` +* `VerifyClientMessage` +* `CheckForMisbehaviour` +* `UpdateStateOnMisbehaviour` +* `UpdateState` +* `CheckSubstituteAndUpdateState` +* `VerifyUpgradeAndUpdateState` The ClientState interface should eventually be trimmed down to something along the lines of: + ```go type ClientState interface { proto.Message @@ -75,26 +77,26 @@ type ClientState interface { For the most part, any functions which require access to the client store should likely not be an interface function of the `ClientState`. -`ExportMetadata` should eventually be replaced by a light client's ability to import/export it's own genesis information. +`ExportMetadata` should eventually be replaced by a light client's ability to import/export it's own genesis information. ### Intermodule communication -To keep the transition from interface callbacks to SDK module callbacks as simple as possible, intermodule communication (when available) should be used to route to light client modules. -Without intermodule communication, a routing system would need to be developed/maintained to register callbacks. -This functionality of routing to another SDK module should and will be provided by the SDK. -Once it is possible to route to SDK modules, a `ClientState` type could expose the function `Route` which returns the callback route used to call the light client module. +To keep the transition from interface callbacks to SDK module callbacks as simple as possible, intermodule communication (when available) should be used to route to light client modules. +Without intermodule communication, a routing system would need to be developed/maintained to register callbacks. +This functionality of routing to another SDK module should and will be provided by the SDK. +Once it is possible to route to SDK modules, a `ClientState` type could expose the function `Route` which returns the callback route used to call the light client module. ## Consequences ### Positive -- use a single approach for interacting with callbacks -- greater flexibilty and control for IBC light clients -- does not require developing another routing system +* use a single approach for interacting with callbacks +* greater flexibilty and control for IBC light clients +* does not require developing another routing system ### Negative -- requires breaking changes -- requires waiting for intermodule communication +* requires breaking changes +* requires waiting for intermodule communication ### Neutral -N/A +N/A diff --git a/docs/architecture/adr-011-transfer-total-escrow-state-entry.md b/docs/architecture/adr-011-transfer-total-escrow-state-entry.md index 18241965386..48dc163aece 100644 --- a/docs/architecture/adr-011-transfer-total-escrow-state-entry.md +++ b/docs/architecture/adr-011-transfer-total-escrow-state-entry.md @@ -45,7 +45,7 @@ if coin.Amount.IsZero() { ### Bundle escrow/unescrow with setting state entry -Two new functions are implemented that bundle together the operations of escrowing/unescrowing and setting the total escrow amount in state, since these operations need to be executed together. +Two new functions are implemented that bundle together the operations of escrowing/unescrowing and setting the total escrow amount in state, since these operations need to be executed together. For escrowing tokens: @@ -142,4 +142,4 @@ Issues: PRs: * [#3019](https://github.com/cosmos/ibc-go/pull/3019) -* [#3558](https://github.com/cosmos/ibc-go/pull/3558) \ No newline at end of file +* [#3558](https://github.com/cosmos/ibc-go/pull/3558) diff --git a/docs/dev/go-style-guide.md b/docs/dev/go-style-guide.md index 7301e49edfa..d8aa8544eb2 100644 --- a/docs/dev/go-style-guide.md +++ b/docs/dev/go-style-guide.md @@ -88,7 +88,7 @@ import ( ) ``` -Run `make lint-fix` to get the imports ordered and grouped automatically. +Run `make lint-fix` to get the imports ordered and grouped automatically. ## Dependencies diff --git a/docs/ibc/events.md b/docs/ibc/events.md index ea077454c72..42e329f05e4 100644 --- a/docs/ibc/events.md +++ b/docs/ibc/events.md @@ -245,7 +245,7 @@ callbacks to IBC applications. | Type | Attribute Key | Attribute Value | Status | |--------------------|--------------------------|-------------------------------|------------| | acknowledge_packet | packet_timeout_height | {timeoutHeight} | | -| acknowledge_packet | packet_timeout_timestamp | {timeoutTimestamp} | | +| acknowledge_packet | packet_timeout_timestamp | {timeoutTimestamp} | | | acknowledge_packet | packet_sequence | {sequence} | | | acknowledge_packet | packet_src_port | {sourcePort} | | | acknowledge_packet | packet_src_channel | {sourceChannel} | | diff --git a/docs/ibc/light-clients/localhost/integration.md b/docs/ibc/light-clients/localhost/integration.md index 15a236e2efe..73e03c4eacb 100644 --- a/docs/ibc/light-clients/localhost/integration.md +++ b/docs/ibc/light-clients/localhost/integration.md @@ -13,4 +13,4 @@ var ( // DefaultAllowedClients are the default clients for the AllowedClients parameter. DefaultAllowedClients = []string{exported.Solomachine, exported.Tendermint, exported.Localhost} ) -``` \ No newline at end of file +``` diff --git a/docs/ibc/light-clients/localhost/state-verification.md b/docs/ibc/light-clients/localhost/state-verification.md index 5d1c16d4447..51f34f4dd56 100644 --- a/docs/ibc/light-clients/localhost/state-verification.md +++ b/docs/ibc/light-clients/localhost/state-verification.md @@ -10,7 +10,7 @@ When verifying channel state in handshakes or processing packets the `09-localho For existence proofs via `VerifyMembership` the 09-localhost client will retrieve the value stored under the provided key path and compare it against the value provided by the caller. In contrast, non-existence proofs via `VerifyNonMembership` assert the absence of a value at the provided key path. -Relayers are expected to provide a sentinel proof when sending IBC messages. Submission of nil or empty proofs is disallowed in core IBC messaging. +Relayers are expected to provide a sentinel proof when sending IBC messages. Submission of nil or empty proofs is disallowed in core IBC messaging. The 09-localhost light client module defines a `SentinelProof` as a single byte. Localhost client state verification will fail if the sentinel proof value is not provided. ```go diff --git a/docs/ibc/troubleshooting.md b/docs/ibc/troubleshooting.md index 95576752e73..f5a16f562d0 100644 --- a/docs/ibc/troubleshooting.md +++ b/docs/ibc/troubleshooting.md @@ -1,6 +1,6 @@ # Troubleshooting -### Unauthorized client states +## Unauthorized client states If it is being reported that a client state is unauthorized, this is due to the client type not being present in the [`AllowedClients`](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/core/02-client/types/client.pb.go#L345) array. diff --git a/docs/migrations/v6-to-v7.md b/docs/migrations/v6-to-v7.md index ba9a053a267..7f31557c72f 100644 --- a/docs/migrations/v6-to-v7.md +++ b/docs/migrations/v6-to-v7.md @@ -296,13 +296,13 @@ import ( The following should be considered as complementary to [Cosmos SDK v0.47 UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc2/UPGRADING.md). -### Protobuf +### Protobuf Protobuf code generation, linting and formatting have been updated to leverage the `ghcr.io/cosmos/proto-builder:0.11.5` docker container. IBC protobuf definitions are now packaged and published to [buf.build/cosmos/ibc](https://buf.build/cosmos/ibc) via CI workflows. The `third_party/proto` directory has been removed in favour of dependency management using [buf.build](https://docs.buf.build/introduction). ### App modules -Legacy APIs of the `AppModule` interface have been removed from ibc-go modules. For example, for +Legacy APIs of the `AppModule` interface have been removed from ibc-go modules. For example, for ```diff - // Route implements the AppModule interface diff --git a/docs/migrations/v7-to-v7_1.md b/docs/migrations/v7-to-v7_1.md index 18cf64df01f..d4d17b0224c 100644 --- a/docs/migrations/v7-to-v7_1.md +++ b/docs/migrations/v7-to-v7_1.md @@ -22,7 +22,7 @@ In the previous release of ibc-go, the localhost `v1` light client module was de An [automatic migration handler](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/module.go#L127-L145) is configured in the core IBC module to set the localhost `ClientState` and sentinel `ConnectionEnd` in state. In order to use the 09-localhost client chains must update the `AllowedClients` parameter in the 02-client submodule of core IBC. This can be configured directly in the application upgrade handler or alternatively updated via the legacy governance parameter change proposal. -We __strongly__ recommend chains to perform this action so that intra-ledger communication can be carried out using the familiar IBC interfaces. +We **strongly** recommend chains to perform this action so that intra-ledger communication can be carried out using the familiar IBC interfaces. See the upgrade handler code sample provided below or [follow this link](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/testing/simapp/upgrades/upgrades.go#L85) for the upgrade handler used by the ibc-go simapp. @@ -53,7 +53,7 @@ An automatic migration handler (TODO: add link after backport to v7.1.x is merge ## Relayers -The event attribute `packet_connection` (`connectiontypes.AttributeKeyConnection`) has been deprecated. +The event attribute `packet_connection` (`connectiontypes.AttributeKeyConnection`) has been deprecated. Please use the `connection_id` attribute (`connectiontypes.AttributeKeyConnectionID`) which is emitted by all channel events. Only send packet, receive packet, write acknowledgement, and acknowledge packet events used `packet_connection` previously. diff --git a/docs/migrations/v7-to-v8.md b/docs/migrations/v7-to-v8.md index d49bd178e6e..c04577f1fff 100644 --- a/docs/migrations/v7-to-v8.md +++ b/docs/migrations/v7-to-v8.md @@ -5,30 +5,30 @@ This guide provides instructions for migrating to version `v8.0.0` of ibc-go. There are four sections based on the four potential user groups of this document: - [Migrating from v7 to v8](#migrating-from-v7-to-v8) - - [Chains](#chains) - - [IBC Apps](#ibc-apps) - - [Relayers](#relayers) - - [IBC Light Clients](#ibc-light-clients) + - [Chains](#chains) + - [IBC Apps](#ibc-apps) + - [Relayers](#relayers) + - [IBC Light Clients](#ibc-light-clients) **Note:** ibc-go supports golang semantic versioning and therefore all imports must be updated on major version releases. ## Chains -TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to transfer's `GenesisState`) +TODO: (extra parameter added to transfer's `GenesisState`) - You must pass the `authority` to the icahost keeper. ([#3520](https://github.com/cosmos/ibc-go/pull/3520)) See [diff](https://github.com/cosmos/ibc-go/pull/3520/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). ```diff // app.go - // ICA Host keeper - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // ICA Host keeper + app.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You must pass the `authority` to the icacontroller keeper. ([#3590](https://github.com/cosmos/ibc-go/pull/3590)) See [diff](https://github.com/cosmos/ibc-go/pull/3590/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -36,14 +36,14 @@ TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to trans ```diff // app.go - // ICA Controller keeper - app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // ICA Controller keeper + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, app.MsgServiceRouter(), ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You must pass the `authority` to the ibctransfer keeper. ([#3553](https://github.com/cosmos/ibc-go/pull/3553)) See [diff](https://github.com/cosmos/ibc-go/pull/3553/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -51,15 +51,15 @@ TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to trans ```diff // app.go - // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper - // since fee middleware will wrap the IBCKeeper for underlying application. - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper + // since fee middleware will wrap the IBCKeeper for underlying application. + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You should pass the `authority` to the IBC keeper. ([#3640](https://github.com/cosmos/ibc-go/pull/3640) and [#3650](https://github.com/cosmos/ibc-go/pull/3650)) See [diff](https://github.com/cosmos/ibc-go/pull/3640/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -67,16 +67,16 @@ TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to trans ```diff // app.go - // IBC Keepers - app.IBCKeeper = ibckeeper.NewKeeper( + // IBC Keepers + app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, -+ appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) ++ appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` ## IBC Apps -TODO: https://github.com/cosmos/ibc-go/pull/3303 +TODO: ## Relayers diff --git a/docs/requirements/ics27-v2-requirements.md b/docs/requirements/ics27-v2-requirements.md index c2cdae349f8..4eb1c3769dc 100644 --- a/docs/requirements/ics27-v2-requirements.md +++ b/docs/requirements/ics27-v2-requirements.md @@ -30,11 +30,11 @@ We believe that the lack of controller chains so far have been because: ### Custom authentication module needs to access IBC packet callbacks -Application developers of custom authentication modules that wish to consume IBC packet callbacks and react upon packet acknowledgements or timeouts must continue using the controller submodule's legacy APIs. +Application developers of custom authentication modules that wish to consume IBC packet callbacks and react upon packet acknowledgements or timeouts must continue using the controller submodule's legacy APIs. ### Custom authentication module does not need access to IBC packet callbacks -The authentication module should interact with the controller submodule via the message server for registering interchain accounts and sending messages to it. +The authentication module should interact with the controller submodule via the message server for registering interchain accounts and sending messages to it. ### No need for custom authentication module @@ -68,13 +68,12 @@ See section [Definitions](https://github.com/cosmos/ibc/blob/main/spec/app/ics-0 | --- | ----------- | ------------ | ------ | ------- | | 2.01 | An application shall have the ability to use an RPC endpoint to submit transactions to be executed on the host chain on the behalf of the interchain account. | [Acceptance test](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go#L31) | `Verified` | v6.0.0 | - # Non-functional requirements ## 3 - Migration | ID | Description | Verification | Status | Release | -| -- | ----------- | ------------ | ------ | ------- | +| -- | ----------- | ------------ | ------ | ------- | | 3.01 | Chains shall be able to run a migration to assign ownership of the channel capability of a custom authentication module to the ICS 27 controller submodule. | [Acceptance test](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go#L89) | `Verified` | v6.0.0 | # External interface requirements diff --git a/docs/requirements/localhost-requirements.md b/docs/requirements/localhost-requirements.md index 2508d87fece..a44aa2b169d 100644 --- a/docs/requirements/localhost-requirements.md +++ b/docs/requirements/localhost-requirements.md @@ -10,7 +10,7 @@ Currently applications, or smart contracts, on a single chain cannot communicate ## Objectives -To provide a single interface in line with IBC application layer semantics, that enables a user to interact with multiple different applications or smart contracts remotely on a given blockchain. +To provide a single interface in line with IBC application layer semantics, that enables a user to interact with multiple different applications or smart contracts remotely on a given blockchain. ## Scope @@ -25,13 +25,13 @@ To provide a single interface in line with IBC application layer semantics, that ### Interacting with Smart Contracts -Many IBC connected blockchains utilise smart contracts, these could be written in rust, solidity or javascript depending on the smart contract platform being used. Through the localhost client, a user can interact with and call into smart contracts by sending ibc messages from the localhost client to the smart contract. +Many IBC connected blockchains utilise smart contracts, these could be written in rust, solidity or javascript depending on the smart contract platform being used. Through the localhost client, a user can interact with and call into smart contracts by sending ibc messages from the localhost client to the smart contract. On Agoric, a planned use case is for managing delegations and staking with smart contracts on a given chain. MsgDelegate, MsgUndelegate, MsgBeginRedelegate messages would be sent using the localhost client to the staking module. The same interface could be used to manage staking cross chain, sending the same messages through IBC to an interchain account. ### Interoperability Infrastructure -Polymer plans to leverage the localhost client with multiple connections as part of their architecture to connect chains not using Tendermint or the Cosmos SDK to IBC enabled chains. Polymer will act as a hub connecting multiple blockchains together. +Polymer plans to leverage the localhost client with multiple connections as part of their architecture to connect chains not using Tendermint or the Cosmos SDK to IBC enabled chains. Polymer will act as a hub connecting multiple blockchains together. # Functional requirements @@ -47,7 +47,7 @@ Polymer plans to leverage the localhost client with multiple connections as part | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | | 1.01 | The localhost client shall have a client ID of the string `09-localhost`. | [Localhost client is created with client ID `09-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/02-client/keeper/keeper.go#L60). | `Implemented` | | -| 1.02 | The localhost client shall have a sentinel connection ID of the string `connection-localhost`. | [Creation of sentinel connection with ID `connection-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/keeper/keeper.go#L200). | `Implemented` | | +| 1.02 | The localhost client shall have a sentinel connection ID of the string `connection-localhost`. | [Creation of sentinel connection with ID `connection-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/keeper/keeper.go#L200). | `Implemented` | | | 1.03 | Only 1 localhost connection is required | Localhost connection handshakes are forbidden in [Init](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/types/msgs.go#L47) and [Try](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/types/msgs.go#L110). | `Implemented` | | | 1.04 | When the localhost client is initialised the consensus state must be `nil`. | [Error is returned if consensus state is not `nil`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/light-clients/09-localhost/client_state.go#L57). | `Implemented` | | | 1.05 | The localhost client can be added to a chain through an upgrade. | [Automatic migration handler configured in core IBC module to set the localhost `ClientState` and sentinel `ConnectionEnd` in state.](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/module.go#L132-L145). | `Implemented` | | @@ -58,11 +58,11 @@ Polymer plans to leverage the localhost client with multiple connections as part | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | | 2.01 | A user of the localhost client can send IBC messages to an application on the same chain. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented`| | -| 2.02 | A user can use the localhost client through the existing IBC application module interfaces. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented` | | +| 2.02 | A user can use the localhost client through the existing IBC application module interfaces. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented` | | # External interface requirements -### 3 - CLI +## 3 - CLI | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | diff --git a/e2e/README.md b/e2e/README.md index 1c016a24402..e1d46b0187d 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -370,7 +370,7 @@ json matrix files under .github/compatibility-test-matrices and is equivalent to ### Accessing Logs -- When a test fails in GitHub. The logs of the test will be uploaded (viewable in the summary page of the workflow). Note: There +- When a test fails in GitHub. The logs of the test will be uploaded (viewable in the summary page of the workflow). Note: There may be some discrepancy in the logs collected and the output of interchain test. The containers may run for a some time after the logs are collected, resulting in the displayed logs to differ slightly. diff --git a/modules/apps/transfer/keeper/MBT_README.md b/modules/apps/transfer/keeper/MBT_README.md index 564d87bc6af..4ea9a3801cc 100644 --- a/modules/apps/transfer/keeper/MBT_README.md +++ b/modules/apps/transfer/keeper/MBT_README.md @@ -46,4 +46,4 @@ To wrap Apalache docker image into an executable you might create the following docker run --rm -v $(pwd):/var/apalache apalache/mc $@ ``` -In case of any questions please don't hesitate to contact Andrey Kuprianov (andrey@informal.systems). +In case of any questions please don't hesitate to contact Andrey Kuprianov (). diff --git a/modules/capability/README.md b/modules/capability/README.md index 723d8749ee1..6cf61435b75 100644 --- a/modules/capability/README.md +++ b/modules/capability/README.md @@ -110,8 +110,8 @@ not own. ### Stores -* MemStore -* KeyStore +- MemStore +- KeyStore ## State @@ -122,8 +122,8 @@ not own. Indexes: -* Unique index: `[]byte("index") -> []byte(currentGlobalIndex)` -* Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)` +- Unique index: `[]byte("index") -> []byte(currentGlobalIndex)` +- Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)` ### In-memory KV store @@ -133,6 +133,6 @@ Indexes: Indexes: -* Initialized flag: `[]byte("mem_initialized")` -* RevCapabilityKey: `[]byte(moduleName + "/rev/" + capabilityName) -> []byte(index)` -* FwdCapabilityKey: `[]byte(moduleName + "/fwd/" + capabilityPointerAddress) -> []byte(capabilityName)` +- Initialized flag: `[]byte("mem_initialized")` +- RevCapabilityKey: `[]byte(moduleName + "/rev/" + capabilityName) -> []byte(index)` +- FwdCapabilityKey: `[]byte(moduleName + "/fwd/" + capabilityPointerAddress) -> []byte(capabilityName)` From 1087e641c866fbf4bec50b9ba328d5c4e84d1086 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 23 Jun 2023 19:24:41 +0800 Subject: [PATCH 20/59] Revert "lint docs same as docs-lint pr" This reverts commit 7ea500caed04d743675fe874fd6318c44880e483. --- CODE_OF_CONDUCT.md | 2 +- SECURITY.md | 4 +- docs/apps/transfer/client.md | 2 +- .../adr-008-app-caller-cbs.md | 26 +- .../transfer-callback-scaffold.md | 244 +++++++++--------- .../adr-010-light-clients-as-sdk-modules.md | 100 ++++--- ...r-011-transfer-total-escrow-state-entry.md | 4 +- docs/dev/go-style-guide.md | 2 +- docs/ibc/events.md | 2 +- .../light-clients/localhost/integration.md | 2 +- .../localhost/state-verification.md | 2 +- docs/ibc/troubleshooting.md | 2 +- docs/migrations/v6-to-v7.md | 4 +- docs/migrations/v7-to-v7_1.md | 4 +- docs/migrations/v7-to-v8.md | 70 ++--- docs/requirements/ics27-v2-requirements.md | 7 +- docs/requirements/localhost-requirements.md | 12 +- e2e/README.md | 2 +- modules/apps/transfer/keeper/MBT_README.md | 2 +- modules/capability/README.md | 14 +- 20 files changed, 253 insertions(+), 254 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7040f1d71a3..c9f9cc2405e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@interchain.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/SECURITY.md b/SECURITY.md index 9f342ef1022..b003cd6c80b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,8 +15,8 @@ contributors to help continually secure our operations. | All [actively supported releases branches](./RELEASES.md#stable-release-policy) | | main branch | -All actively supported release branches (see table in [section Stable Release Policy in RELEASES.md](./RELEASES.md#stable-release-policy)) -of this repository are supported for security updates as well as the **main** +All actively supported release branches (see table in [section Stable Release Policy in RELEASES.md](./RELEASES.md#stable-release-policy)) +of this repository are supported for security updates as well as the **main** branch. Security vulnerabilities should be reported if the vulnerability can be reproduced on either one of those. diff --git a/docs/apps/transfer/client.md b/docs/apps/transfer/client.md index 28034f54c73..515fad57d5c 100644 --- a/docs/apps/transfer/client.md +++ b/docs/apps/transfer/client.md @@ -63,4 +63,4 @@ Example output: { "amount": "100" } -``` +``` \ No newline at end of file diff --git a/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md b/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md index 674d1902db7..b67275ccf49 100644 --- a/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md +++ b/docs/architecture/adr-008-app-caller-cbs/adr-008-app-caller-cbs.md @@ -18,14 +18,14 @@ This setup worked well for off-chain users interacting with IBC applications. We are now seeing the desire for secondary applications (e.g. smart contracts, modules) to call into IBC apps as part of their state machine logic and then do some actions on the basis of the packet result. Or to receive a packet from IBC and do some logic upon receipt. Example Usecases: -* Send an ICS-20 packet, and if it is successful, then send an ICA-packet to swap tokens on LP and return funds to sender -* Execute some logic upon receipt of token transfer to a smart contract address +- Send an ICS-20 packet, and if it is successful, then send an ICA-packet to swap tokens on LP and return funds to sender +- Execute some logic upon receipt of token transfer to a smart contract address This requires a second layer of callbacks. The IBC application already gets the result of the packet from core IBC, but currently there is no standardized way to pass this information on to an actor module/smart contract. ## Definitions -* Actor: an actor is an on-chain module (this may be a hardcoded module in the chain binary or a smart contract) that wishes to execute custom logic whenever IBC receives a packet flow that it has either sent or received. It **must** be addressable by a string value. +- Actor: an actor is an on-chain module (this may be a hardcoded module in the chain binary or a smart contract) that wishes to execute custom logic whenever IBC receives a packet flow that it has either sent or received. It **must** be addressable by a string value. ## Decision @@ -113,7 +113,7 @@ IBC Apps or middleware can then call the IBCActor callbacks like so in their own ### Handshake Callbacks The `OnChanOpenInit` handshake callback will need to include an additional field so that the initiating actor can be tracked and called upon during handshake completion. -The actor provided in the `OnChanOpenInit` callback will be the signer of the `MsgChanOpenInit` message. +The actor provided in the `OnChanOpenInit` callback will be the signer of the `MsgChanOpenInit` message. ```go func OnChanOpenInit( @@ -188,7 +188,7 @@ func OnChanCloseConfirm( } ``` -NOTE: The handshake calls `OnChanOpenTry` and `OnChanOpenConfirm` are explicitly left out as it is still to be determined how the actor of the `OnChanOpenTry` step should be provided. Initially only the initiating side of the channel handshake may support setting a channel actor, future improvements should allow both sides of the channel handshake to set channel actors. +NOTE: The handshake calls `OnChanOpenTry` and `OnChanOpenConfirm` are explicitly left out as it is still to be determined how the actor of the `OnChanOpenTry` step should be provided. Initially only the initiating side of the channel handshake may support setting a channel actor, future improvements should allow both sides of the channel handshake to set channel actors. ### PacketCallbacks @@ -402,20 +402,20 @@ Chains are expected to specify a `chainDefinedActorCallbackLimit` to ensure that ### Positive -* IBC Actors can now programatically execute logic that involves sending a packet and then performing some additional logic once the packet lifecycle is complete -* Middleware implementing ADR-8 can be generally used for any application -* Leverages the same callback architecture used between core IBC and IBC applications +- IBC Actors can now programatically execute logic that involves sending a packet and then performing some additional logic once the packet lifecycle is complete +- Middleware implementing ADR-8 can be generally used for any application +- Leverages the same callback architecture used between core IBC and IBC applications ### Negative -* Callbacks may now have unbounded gas consumption since the actor may execute arbitrary logic. Chains implementing this feature should take care to place limitations on how much gas an actor callback can consume. +- Callbacks may now have unbounded gas consumption since the actor may execute arbitrary logic. Chains implementing this feature should take care to place limitations on how much gas an actor callback can consume. ### Neutral -* Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec +- Application packets that want to support ADR-8 must additionally have their packet data implement the `CallbackPacketData` interface and register their implementation on the chain codec ## References -* [Original issue](https://github.com/cosmos/ibc-go/issues/1660) -* [CallbackPacketData interface implementation](https://github.com/cosmos/ibc-go/pull/3287) -* [ICS 20, ICS 27 implementations of the CallbackPacketData interface](https://github.com/cosmos/ibc-go/pull/3287) +- [Original issue](https://github.com/cosmos/ibc-go/issues/1660) +- [CallbackPacketData interface implementation](https://github.com/cosmos/ibc-go/pull/3287) +- [ICS 20, ICS 27 implementations of the CallbackPacketData interface](https://github.com/cosmos/ibc-go/pull/3287) diff --git a/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md b/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md index dd2e9db013f..904a6c52423 100644 --- a/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md +++ b/docs/architecture/adr-008-app-caller-cbs/transfer-callback-scaffold.md @@ -6,20 +6,20 @@ The exact nature of the callbacks to the smart contract will depend on the envir Implementers may wish to support callbacks to more IBC applications by adding a switch statement to unmarshal the specific packet data types they wish to support and passing them into the smart contract callback functions. -## Scaffold Middleware +### Scaffold Middleware ```go package callbacks import ( - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - - transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" - "github.com/cosmos/ibc-go/v6/modules/core/exported" + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + + transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v6/modules/core/exported" ) var _ porttypes.Middleware = &IBCMiddleware{} @@ -27,197 +27,197 @@ var _ porttypes.Middleware = &IBCMiddleware{} // IBCMiddleware implements the ICS26 callbacks for the fee middleware given the // fee keeper and the underlying application. type IBCMiddleware struct { - app porttypes.IBCModule - chanWrapper porttypes.ICS4Wrapper + app porttypes.IBCModule + chanWrapper porttypes.ICS4Wrapper } // NewIBCMiddleware creates a new IBCMiddlware given the keeper and underlying application func NewIBCMiddleware(app porttypes.IBCModule, chanWrapper porttypes.ICS4Wrapper) IBCMiddleware { - return IBCMiddleware{ - app: app, - chanWrapper: chanWrapper, - } + return IBCMiddleware{ + app: app, + chanWrapper: chanWrapper, + } } // OnChanOpenInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID string, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - version string, + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, ) (string, error) { - // call underlying app's OnChanOpenInit callback - return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, - chanCap, counterparty, version) + // call underlying app's OnChanOpenInit callback + return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, + chanCap, counterparty, version) } // OnChanOpenTry implements the IBCMiddleware interface // If the channel is not fee enabled the underlying application version will be returned // If the channel is fee enabled we merge the underlying application version with the ics29 version func (im IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID, - channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - counterpartyVersion string, + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, ) (string, error) { - // call underlying app's OnChanOpenTry callback - return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) + // call underlying app's OnChanOpenTry callback + return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) } // OnChanOpenAck implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, - portID, - channelID string, - counterpartyChannelID string, - counterpartyVersion string, + ctx sdk.Context, + portID, + channelID string, + counterpartyChannelID string, + counterpartyVersion string, ) error { - // call underlying app's OnChanOpenAck callback - return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) + // call underlying app's OnChanOpenAck callback + return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) } // OnChanOpenConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenConfirm( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanOpenConfirm callback. - return im.app.OnChanOpenConfirm(ctx, portID, channelID) + // call underlying app's OnChanOpenConfirm callback. + return im.app.OnChanOpenConfirm(ctx, portID, channelID) } // OnChanCloseInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseInit( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanCloseInit callback. - return im.app.OnChanCloseInit(ctx, portID, channelID) + // call underlying app's OnChanCloseInit callback. + return im.app.OnChanCloseInit(ctx, portID, channelID) } // OnChanCloseConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseConfirm( - ctx sdk.Context, - portID, - channelID string, + ctx sdk.Context, + portID, + channelID string, ) error { - // call underlying app's OnChanCloseConfirm callback. - return im.app.OnChanCloseConfirm(ctx, portID, channelID) + // call underlying app's OnChanCloseConfirm callback. + return im.app.OnChanCloseConfirm(ctx, portID, channelID) } // OnRecvPacket implements the IBCMiddleware interface. // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnRecvPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, ) exported.Acknowledgement { - // first do the underlying ibc app callback - ack := im.app.OnRecvPacket(ctx, packet, relayer) - - // postprocess the ibc application by executing a callback to the receiver smart contract - // if the receiver of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Receiver is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error acknowledgement + // first do the underlying ibc app callback + ack := im.app.OnRecvPacket(ctx, packet, relayer) + + // postprocess the ibc application by executing a callback to the receiver smart contract + // if the receiver of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Receiver is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error acknowledgement if isSmartContract(data.Receiver) { err := data.Receiver.recvPacketCallback(data) if err != nil { return channeltypes.NewErrorAcknowledgement(err) } } - } - return ack + } + return ack } // OnAcknowledgementPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, ) error { - // call underlying callback - err := im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) - - // postprocess the ibc application by executing a callback to the sender smart contract - // if the sender of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Sender is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error + // call underlying callback + err := im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) + + // postprocess the ibc application by executing a callback to the sender smart contract + // if the sender of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Sender is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error if isSmartContract(data.Sender) { data.Sender.ackPacketCallback(data) } - } - return err + } + return err } // OnTimeoutPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnTimeoutPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, ) error { - // call underlying callback - err := im.app.OnTimeoutPacket(ctx, packet, relayer) - - // postprocess the ibc application by executing a callback to the sender smart contract - // if the sender of the transfer packet is a smart contract - var data transfertypes.FungibleTokenPacketData - if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { - // check if data.Sender is a smart contract address - // if it is a smart contract address - // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data - // if the callback returns an error, then return an error + // call underlying callback + err := im.app.OnTimeoutPacket(ctx, packet, relayer) + + // postprocess the ibc application by executing a callback to the sender smart contract + // if the sender of the transfer packet is a smart contract + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err == nil { + // check if data.Sender is a smart contract address + // if it is a smart contract address + // then call the smart-contract defined callback for RecvPacket and pass in the transfer packet data + // if the callback returns an error, then return an error if isSmartContract(data.Sender) { data.Sender.timeoutPacketCallback(data) } - } - return err + } + return err } // SendPacket implements the ICS4 Wrapper interface func (im IBCMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, ) (uint64, error) { - return im.chanWrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) + return im.chanWrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) } // WriteAcknowledgement implements the ICS4 Wrapper interface func (im IBCMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - packet exported.PacketI, - ack exported.Acknowledgement, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + packet exported.PacketI, + ack exported.Acknowledgement, ) error { - return im.chanWrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) + return im.chanWrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) } // GetAppVersion returns the application version of the underlying application func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { - return im.chanWrapper.GetAppVersion(ctx, portID, channelID) + return im.chanWrapper.GetAppVersion(ctx, portID, channelID) } -``` +``` \ No newline at end of file diff --git a/docs/architecture/adr-010-light-clients-as-sdk-modules.md b/docs/architecture/adr-010-light-clients-as-sdk-modules.md index 3ebfb2903ed..0c8f2bb8e6e 100644 --- a/docs/architecture/adr-010-light-clients-as-sdk-modules.md +++ b/docs/architecture/adr-010-light-clients-as-sdk-modules.md @@ -1,7 +1,6 @@ # ADR 010: IBC light clients as SDK modules ## Changelog - * 12/12/2022: initial draft ## Status @@ -11,55 +10,54 @@ Proposed ## Context ibc-go has 3 main consumers: -* IBC light clients -* IBC applications -* relayers +- IBC light clients +- IBC applications +- relayers -Relayers listen and respond to events emitted by ibc-go while IBC light clients and applications are invoked by core IBC. +Relayers listen and respond to events emitted by ibc-go while IBC light clients and applications are invoked by core IBC. Currently there exists two different approaches to callbacks being invoked by core IBC. IBC light clients currently are invoked by a `ClientState` and `ConsensusState` interface as defined by [core IBC](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L36). -The 02-client submodule will retrieve the `ClientState` or `ConsensusState` from the IBC store in order to perform callbacks to the light client. -This design requires all required information for the light client to function to be stored in the `ClientState` or `ConsensusState` or potentially under metadata keys for a specific client instance. -Additional information may be provided by core IBC via the defined interface arguments if that information is generic enough to be useful to all IBC light clients. -This constraint has proved problematic as pass through clients (such as wasm) cannot maintain easy access to a VM instance. -In addition, without increasing the size of the defined `ClientState` interface, light clients are unable to take advantage of basic built-in SDK functionality such as genesis import/export and migrations. - -The other approach used to perform callback logic is via registered SDK modules. -This approach is used by core IBC to interact with IBC applications. -IBC applications will register their callbacks on the IBC router at compile time. -When a packet comes in, core IBC will use the IBC router to lookup the registered callback functions for the provided packet. -The benefit of registered callbacks opposed to interface functions is that additional information may be accessed via external keepers. -Because the IBC applications are also SDK modules, they additionally get access to a host of functionality provided by the SDK. -This includes: genesis import/export, migrations, query/transaction CLI commands, type registration, gRPC query registration, and message server registration. - -As described in [ADR 006](./adr-006-02-client-refactor.md), generalizing light client behaviour is difficult. -IBC light clients will obtain greater flexibility and control via the registered SDK module approach. +The 02-client submodule will retrieve the `ClientState` or `ConsensusState` from the IBC store in order to perform callbacks to the light client. +This design requires all required information for the light client to function to be stored in the `ClientState` or `ConsensusState` or potentially under metadata keys for a specific client instance. +Additional information may be provided by core IBC via the defined interface arguments if that information is generic enough to be useful to all IBC light clients. +This constraint has proved problematic as pass through clients (such as wasm) cannot maintain easy access to a VM instance. +In addition, without increasing the size of the defined `ClientState` interface, light clients are unable to take advantage of basic built-in SDK functionality such as genesis import/export and migrations. + +The other approach used to perform callback logic is via registered SDK modules. +This approach is used by core IBC to interact with IBC applications. +IBC applications will register their callbacks on the IBC router at compile time. +When a packet comes in, core IBC will use the IBC router to lookup the registered callback functions for the provided packet. +The benefit of registered callbacks opposed to interface functions is that additional information may be accessed via external keepers. +Because the IBC applications are also SDK modules, they additionally get access to a host of functionality provided by the SDK. +This includes: genesis import/export, migrations, query/transaction CLI commands, type registration, gRPC query registration, and message server registration. + +As described in [ADR 006](./adr-006-02-client-refactor.md), generalizing light client behaviour is difficult. +IBC light clients will obtain greater flexibility and control via the registered SDK module approach. ## Decision Instead of using two different approaches to invoking callbacks, IBC light clients should be invoked as SDK modules. -Over time and as necessary, core IBC should adjust its interactions with light clients such that they are SDK modules as opposed to interfaces. - -One immediate decision that has already been applied is to formalize light client type registration via the inclusion of an `AppModuleBasic` within the `ModuleManager` for a chain. -The [tendermint](https://github.com/cosmos/ibc-go/pull/2825) and [solo machine](https://github.com/cosmos/ibc-go/pull/2826) clients were refactored to include this `AppModuleBasic` implementation and core IBC will no longer include either type as registered by default. - -Longer term solutions include using internal module communication as described in [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-033-protobuf-inter-module-comm.md) on the SDK. -The following functions should become callbacks invoked via intermodule communication: -* `Status` -* `GetTimestampAtHeight` -* `VerifyMembership` -* `VerifyNonMembership` -* `Initialize` -* `VerifyClientMessage` -* `CheckForMisbehaviour` -* `UpdateStateOnMisbehaviour` -* `UpdateState` -* `CheckSubstituteAndUpdateState` -* `VerifyUpgradeAndUpdateState` +Over time and as necessary, core IBC should adjust its interactions with light clients such that they are SDK modules as opposed to interfaces. + +One immediate decision that has already been applied is to formalize light client type registration via the inclusion of an `AppModuleBasic` within the `ModuleManager` for a chain. +The [tendermint](https://github.com/cosmos/ibc-go/pull/2825) and [solo machine](https://github.com/cosmos/ibc-go/pull/2826) clients were refactored to include this `AppModuleBasic` implementation and core IBC will no longer include either type as registered by default. + +Longer term solutions include using internal module communication as described in [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-033-protobuf-inter-module-comm.md) on the SDK. +The following functions should become callbacks invoked via intermodule communication: +- `Status` +- `GetTimestampAtHeight` +- `VerifyMembership` +- `VerifyNonMembership` +- `Initialize` +- `VerifyClientMessage` +- `CheckForMisbehaviour` +- `UpdateStateOnMisbehaviour` +- `UpdateState` +- `CheckSubstituteAndUpdateState` +- `VerifyUpgradeAndUpdateState` The ClientState interface should eventually be trimmed down to something along the lines of: - ```go type ClientState interface { proto.Message @@ -77,26 +75,26 @@ type ClientState interface { For the most part, any functions which require access to the client store should likely not be an interface function of the `ClientState`. -`ExportMetadata` should eventually be replaced by a light client's ability to import/export it's own genesis information. +`ExportMetadata` should eventually be replaced by a light client's ability to import/export it's own genesis information. ### Intermodule communication -To keep the transition from interface callbacks to SDK module callbacks as simple as possible, intermodule communication (when available) should be used to route to light client modules. -Without intermodule communication, a routing system would need to be developed/maintained to register callbacks. -This functionality of routing to another SDK module should and will be provided by the SDK. -Once it is possible to route to SDK modules, a `ClientState` type could expose the function `Route` which returns the callback route used to call the light client module. +To keep the transition from interface callbacks to SDK module callbacks as simple as possible, intermodule communication (when available) should be used to route to light client modules. +Without intermodule communication, a routing system would need to be developed/maintained to register callbacks. +This functionality of routing to another SDK module should and will be provided by the SDK. +Once it is possible to route to SDK modules, a `ClientState` type could expose the function `Route` which returns the callback route used to call the light client module. ## Consequences ### Positive -* use a single approach for interacting with callbacks -* greater flexibilty and control for IBC light clients -* does not require developing another routing system +- use a single approach for interacting with callbacks +- greater flexibilty and control for IBC light clients +- does not require developing another routing system ### Negative -* requires breaking changes -* requires waiting for intermodule communication +- requires breaking changes +- requires waiting for intermodule communication ### Neutral - N/A + diff --git a/docs/architecture/adr-011-transfer-total-escrow-state-entry.md b/docs/architecture/adr-011-transfer-total-escrow-state-entry.md index 48dc163aece..18241965386 100644 --- a/docs/architecture/adr-011-transfer-total-escrow-state-entry.md +++ b/docs/architecture/adr-011-transfer-total-escrow-state-entry.md @@ -45,7 +45,7 @@ if coin.Amount.IsZero() { ### Bundle escrow/unescrow with setting state entry -Two new functions are implemented that bundle together the operations of escrowing/unescrowing and setting the total escrow amount in state, since these operations need to be executed together. +Two new functions are implemented that bundle together the operations of escrowing/unescrowing and setting the total escrow amount in state, since these operations need to be executed together. For escrowing tokens: @@ -142,4 +142,4 @@ Issues: PRs: * [#3019](https://github.com/cosmos/ibc-go/pull/3019) -* [#3558](https://github.com/cosmos/ibc-go/pull/3558) +* [#3558](https://github.com/cosmos/ibc-go/pull/3558) \ No newline at end of file diff --git a/docs/dev/go-style-guide.md b/docs/dev/go-style-guide.md index d8aa8544eb2..7301e49edfa 100644 --- a/docs/dev/go-style-guide.md +++ b/docs/dev/go-style-guide.md @@ -88,7 +88,7 @@ import ( ) ``` -Run `make lint-fix` to get the imports ordered and grouped automatically. +Run `make lint-fix` to get the imports ordered and grouped automatically. ## Dependencies diff --git a/docs/ibc/events.md b/docs/ibc/events.md index 42e329f05e4..ea077454c72 100644 --- a/docs/ibc/events.md +++ b/docs/ibc/events.md @@ -245,7 +245,7 @@ callbacks to IBC applications. | Type | Attribute Key | Attribute Value | Status | |--------------------|--------------------------|-------------------------------|------------| | acknowledge_packet | packet_timeout_height | {timeoutHeight} | | -| acknowledge_packet | packet_timeout_timestamp | {timeoutTimestamp} | | +| acknowledge_packet | packet_timeout_timestamp | {timeoutTimestamp} | | | acknowledge_packet | packet_sequence | {sequence} | | | acknowledge_packet | packet_src_port | {sourcePort} | | | acknowledge_packet | packet_src_channel | {sourceChannel} | | diff --git a/docs/ibc/light-clients/localhost/integration.md b/docs/ibc/light-clients/localhost/integration.md index 73e03c4eacb..15a236e2efe 100644 --- a/docs/ibc/light-clients/localhost/integration.md +++ b/docs/ibc/light-clients/localhost/integration.md @@ -13,4 +13,4 @@ var ( // DefaultAllowedClients are the default clients for the AllowedClients parameter. DefaultAllowedClients = []string{exported.Solomachine, exported.Tendermint, exported.Localhost} ) -``` +``` \ No newline at end of file diff --git a/docs/ibc/light-clients/localhost/state-verification.md b/docs/ibc/light-clients/localhost/state-verification.md index 51f34f4dd56..5d1c16d4447 100644 --- a/docs/ibc/light-clients/localhost/state-verification.md +++ b/docs/ibc/light-clients/localhost/state-verification.md @@ -10,7 +10,7 @@ When verifying channel state in handshakes or processing packets the `09-localho For existence proofs via `VerifyMembership` the 09-localhost client will retrieve the value stored under the provided key path and compare it against the value provided by the caller. In contrast, non-existence proofs via `VerifyNonMembership` assert the absence of a value at the provided key path. -Relayers are expected to provide a sentinel proof when sending IBC messages. Submission of nil or empty proofs is disallowed in core IBC messaging. +Relayers are expected to provide a sentinel proof when sending IBC messages. Submission of nil or empty proofs is disallowed in core IBC messaging. The 09-localhost light client module defines a `SentinelProof` as a single byte. Localhost client state verification will fail if the sentinel proof value is not provided. ```go diff --git a/docs/ibc/troubleshooting.md b/docs/ibc/troubleshooting.md index f5a16f562d0..95576752e73 100644 --- a/docs/ibc/troubleshooting.md +++ b/docs/ibc/troubleshooting.md @@ -1,6 +1,6 @@ # Troubleshooting -## Unauthorized client states +### Unauthorized client states If it is being reported that a client state is unauthorized, this is due to the client type not being present in the [`AllowedClients`](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/core/02-client/types/client.pb.go#L345) array. diff --git a/docs/migrations/v6-to-v7.md b/docs/migrations/v6-to-v7.md index 7f31557c72f..ba9a053a267 100644 --- a/docs/migrations/v6-to-v7.md +++ b/docs/migrations/v6-to-v7.md @@ -296,13 +296,13 @@ import ( The following should be considered as complementary to [Cosmos SDK v0.47 UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc2/UPGRADING.md). -### Protobuf +### Protobuf Protobuf code generation, linting and formatting have been updated to leverage the `ghcr.io/cosmos/proto-builder:0.11.5` docker container. IBC protobuf definitions are now packaged and published to [buf.build/cosmos/ibc](https://buf.build/cosmos/ibc) via CI workflows. The `third_party/proto` directory has been removed in favour of dependency management using [buf.build](https://docs.buf.build/introduction). ### App modules -Legacy APIs of the `AppModule` interface have been removed from ibc-go modules. For example, for +Legacy APIs of the `AppModule` interface have been removed from ibc-go modules. For example, for ```diff - // Route implements the AppModule interface diff --git a/docs/migrations/v7-to-v7_1.md b/docs/migrations/v7-to-v7_1.md index d4d17b0224c..18cf64df01f 100644 --- a/docs/migrations/v7-to-v7_1.md +++ b/docs/migrations/v7-to-v7_1.md @@ -22,7 +22,7 @@ In the previous release of ibc-go, the localhost `v1` light client module was de An [automatic migration handler](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/module.go#L127-L145) is configured in the core IBC module to set the localhost `ClientState` and sentinel `ConnectionEnd` in state. In order to use the 09-localhost client chains must update the `AllowedClients` parameter in the 02-client submodule of core IBC. This can be configured directly in the application upgrade handler or alternatively updated via the legacy governance parameter change proposal. -We **strongly** recommend chains to perform this action so that intra-ledger communication can be carried out using the familiar IBC interfaces. +We __strongly__ recommend chains to perform this action so that intra-ledger communication can be carried out using the familiar IBC interfaces. See the upgrade handler code sample provided below or [follow this link](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/testing/simapp/upgrades/upgrades.go#L85) for the upgrade handler used by the ibc-go simapp. @@ -53,7 +53,7 @@ An automatic migration handler (TODO: add link after backport to v7.1.x is merge ## Relayers -The event attribute `packet_connection` (`connectiontypes.AttributeKeyConnection`) has been deprecated. +The event attribute `packet_connection` (`connectiontypes.AttributeKeyConnection`) has been deprecated. Please use the `connection_id` attribute (`connectiontypes.AttributeKeyConnectionID`) which is emitted by all channel events. Only send packet, receive packet, write acknowledgement, and acknowledge packet events used `packet_connection` previously. diff --git a/docs/migrations/v7-to-v8.md b/docs/migrations/v7-to-v8.md index c04577f1fff..d49bd178e6e 100644 --- a/docs/migrations/v7-to-v8.md +++ b/docs/migrations/v7-to-v8.md @@ -5,30 +5,30 @@ This guide provides instructions for migrating to version `v8.0.0` of ibc-go. There are four sections based on the four potential user groups of this document: - [Migrating from v7 to v8](#migrating-from-v7-to-v8) - - [Chains](#chains) - - [IBC Apps](#ibc-apps) - - [Relayers](#relayers) - - [IBC Light Clients](#ibc-light-clients) + - [Chains](#chains) + - [IBC Apps](#ibc-apps) + - [Relayers](#relayers) + - [IBC Light Clients](#ibc-light-clients) **Note:** ibc-go supports golang semantic versioning and therefore all imports must be updated on major version releases. ## Chains -TODO: (extra parameter added to transfer's `GenesisState`) +TODO: https://github.com/cosmos/ibc-go/pull/3505 (extra parameter added to transfer's `GenesisState`) - You must pass the `authority` to the icahost keeper. ([#3520](https://github.com/cosmos/ibc-go/pull/3520)) See [diff](https://github.com/cosmos/ibc-go/pull/3520/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). ```diff // app.go - // ICA Host keeper - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // ICA Host keeper + app.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You must pass the `authority` to the icacontroller keeper. ([#3590](https://github.com/cosmos/ibc-go/pull/3590)) See [diff](https://github.com/cosmos/ibc-go/pull/3590/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -36,14 +36,14 @@ TODO: (extra parameter added to tra ```diff // app.go - // ICA Controller keeper - app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // ICA Controller keeper + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, app.MsgServiceRouter(), ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You must pass the `authority` to the ibctransfer keeper. ([#3553](https://github.com/cosmos/ibc-go/pull/3553)) See [diff](https://github.com/cosmos/ibc-go/pull/3553/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -51,15 +51,15 @@ TODO: (extra parameter added to tra ```diff // app.go - // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper - // since fee middleware will wrap the IBCKeeper for underlying application. - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, -+ authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper + // since fee middleware will wrap the IBCKeeper for underlying application. + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, ++ authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` - You should pass the `authority` to the IBC keeper. ([#3640](https://github.com/cosmos/ibc-go/pull/3640) and [#3650](https://github.com/cosmos/ibc-go/pull/3650)) See [diff](https://github.com/cosmos/ibc-go/pull/3640/files#diff-d18972debee5e64f16e40807b2ae112ddbe609504a93ea5e1c80a5d489c3a08a). @@ -67,16 +67,16 @@ TODO: (extra parameter added to tra ```diff // app.go - // IBC Keepers - app.IBCKeeper = ibckeeper.NewKeeper( + // IBC Keepers + app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, -+ appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) ++ appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) ``` ## IBC Apps -TODO: +TODO: https://github.com/cosmos/ibc-go/pull/3303 ## Relayers diff --git a/docs/requirements/ics27-v2-requirements.md b/docs/requirements/ics27-v2-requirements.md index 4eb1c3769dc..c2cdae349f8 100644 --- a/docs/requirements/ics27-v2-requirements.md +++ b/docs/requirements/ics27-v2-requirements.md @@ -30,11 +30,11 @@ We believe that the lack of controller chains so far have been because: ### Custom authentication module needs to access IBC packet callbacks -Application developers of custom authentication modules that wish to consume IBC packet callbacks and react upon packet acknowledgements or timeouts must continue using the controller submodule's legacy APIs. +Application developers of custom authentication modules that wish to consume IBC packet callbacks and react upon packet acknowledgements or timeouts must continue using the controller submodule's legacy APIs. ### Custom authentication module does not need access to IBC packet callbacks -The authentication module should interact with the controller submodule via the message server for registering interchain accounts and sending messages to it. +The authentication module should interact with the controller submodule via the message server for registering interchain accounts and sending messages to it. ### No need for custom authentication module @@ -68,12 +68,13 @@ See section [Definitions](https://github.com/cosmos/ibc/blob/main/spec/app/ics-0 | --- | ----------- | ------------ | ------ | ------- | | 2.01 | An application shall have the ability to use an RPC endpoint to submit transactions to be executed on the host chain on the behalf of the interchain account. | [Acceptance test](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go#L31) | `Verified` | v6.0.0 | + # Non-functional requirements ## 3 - Migration | ID | Description | Verification | Status | Release | -| -- | ----------- | ------------ | ------ | ------- | +| -- | ----------- | ------------ | ------ | ------- | | 3.01 | Chains shall be able to run a migration to assign ownership of the channel capability of a custom authentication module to the ICS 27 controller submodule. | [Acceptance test](https://github.com/cosmos/ibc-go/blob/v6.0.0/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go#L89) | `Verified` | v6.0.0 | # External interface requirements diff --git a/docs/requirements/localhost-requirements.md b/docs/requirements/localhost-requirements.md index a44aa2b169d..2508d87fece 100644 --- a/docs/requirements/localhost-requirements.md +++ b/docs/requirements/localhost-requirements.md @@ -10,7 +10,7 @@ Currently applications, or smart contracts, on a single chain cannot communicate ## Objectives -To provide a single interface in line with IBC application layer semantics, that enables a user to interact with multiple different applications or smart contracts remotely on a given blockchain. +To provide a single interface in line with IBC application layer semantics, that enables a user to interact with multiple different applications or smart contracts remotely on a given blockchain. ## Scope @@ -25,13 +25,13 @@ To provide a single interface in line with IBC application layer semantics, that ### Interacting with Smart Contracts -Many IBC connected blockchains utilise smart contracts, these could be written in rust, solidity or javascript depending on the smart contract platform being used. Through the localhost client, a user can interact with and call into smart contracts by sending ibc messages from the localhost client to the smart contract. +Many IBC connected blockchains utilise smart contracts, these could be written in rust, solidity or javascript depending on the smart contract platform being used. Through the localhost client, a user can interact with and call into smart contracts by sending ibc messages from the localhost client to the smart contract. On Agoric, a planned use case is for managing delegations and staking with smart contracts on a given chain. MsgDelegate, MsgUndelegate, MsgBeginRedelegate messages would be sent using the localhost client to the staking module. The same interface could be used to manage staking cross chain, sending the same messages through IBC to an interchain account. ### Interoperability Infrastructure -Polymer plans to leverage the localhost client with multiple connections as part of their architecture to connect chains not using Tendermint or the Cosmos SDK to IBC enabled chains. Polymer will act as a hub connecting multiple blockchains together. +Polymer plans to leverage the localhost client with multiple connections as part of their architecture to connect chains not using Tendermint or the Cosmos SDK to IBC enabled chains. Polymer will act as a hub connecting multiple blockchains together. # Functional requirements @@ -47,7 +47,7 @@ Polymer plans to leverage the localhost client with multiple connections as part | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | | 1.01 | The localhost client shall have a client ID of the string `09-localhost`. | [Localhost client is created with client ID `09-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/02-client/keeper/keeper.go#L60). | `Implemented` | | -| 1.02 | The localhost client shall have a sentinel connection ID of the string `connection-localhost`. | [Creation of sentinel connection with ID `connection-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/keeper/keeper.go#L200). | `Implemented` | | +| 1.02 | The localhost client shall have a sentinel connection ID of the string `connection-localhost`. | [Creation of sentinel connection with ID `connection-localhost`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/keeper/keeper.go#L200). | `Implemented` | | | 1.03 | Only 1 localhost connection is required | Localhost connection handshakes are forbidden in [Init](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/types/msgs.go#L47) and [Try](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/03-connection/types/msgs.go#L110). | `Implemented` | | | 1.04 | When the localhost client is initialised the consensus state must be `nil`. | [Error is returned if consensus state is not `nil`](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/light-clients/09-localhost/client_state.go#L57). | `Implemented` | | | 1.05 | The localhost client can be added to a chain through an upgrade. | [Automatic migration handler configured in core IBC module to set the localhost `ClientState` and sentinel `ConnectionEnd` in state.](https://github.com/cosmos/ibc-go/blob/release/v7.1.x/modules/core/module.go#L132-L145). | `Implemented` | | @@ -58,11 +58,11 @@ Polymer plans to leverage the localhost client with multiple connections as part | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | | 2.01 | A user of the localhost client can send IBC messages to an application on the same chain. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented`| | -| 2.02 | A user can use the localhost client through the existing IBC application module interfaces. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented` | | +| 2.02 | A user can use the localhost client through the existing IBC application module interfaces. | [e2e test with transfer](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/localhost_test.go#L32). | `Implemented` | | # External interface requirements -## 3 - CLI +### 3 - CLI | ID | Description | Verification | Status | Release | | -- | ----------- | ------------ | ------ | ------- | diff --git a/e2e/README.md b/e2e/README.md index e1d46b0187d..1c016a24402 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -370,7 +370,7 @@ json matrix files under .github/compatibility-test-matrices and is equivalent to ### Accessing Logs -- When a test fails in GitHub. The logs of the test will be uploaded (viewable in the summary page of the workflow). Note: There +- When a test fails in GitHub. The logs of the test will be uploaded (viewable in the summary page of the workflow). Note: There may be some discrepancy in the logs collected and the output of interchain test. The containers may run for a some time after the logs are collected, resulting in the displayed logs to differ slightly. diff --git a/modules/apps/transfer/keeper/MBT_README.md b/modules/apps/transfer/keeper/MBT_README.md index 4ea9a3801cc..564d87bc6af 100644 --- a/modules/apps/transfer/keeper/MBT_README.md +++ b/modules/apps/transfer/keeper/MBT_README.md @@ -46,4 +46,4 @@ To wrap Apalache docker image into an executable you might create the following docker run --rm -v $(pwd):/var/apalache apalache/mc $@ ``` -In case of any questions please don't hesitate to contact Andrey Kuprianov (). +In case of any questions please don't hesitate to contact Andrey Kuprianov (andrey@informal.systems). diff --git a/modules/capability/README.md b/modules/capability/README.md index 6cf61435b75..723d8749ee1 100644 --- a/modules/capability/README.md +++ b/modules/capability/README.md @@ -110,8 +110,8 @@ not own. ### Stores -- MemStore -- KeyStore +* MemStore +* KeyStore ## State @@ -122,8 +122,8 @@ not own. Indexes: -- Unique index: `[]byte("index") -> []byte(currentGlobalIndex)` -- Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)` +* Unique index: `[]byte("index") -> []byte(currentGlobalIndex)` +* Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)` ### In-memory KV store @@ -133,6 +133,6 @@ Indexes: Indexes: -- Initialized flag: `[]byte("mem_initialized")` -- RevCapabilityKey: `[]byte(moduleName + "/rev/" + capabilityName) -> []byte(index)` -- FwdCapabilityKey: `[]byte(moduleName + "/fwd/" + capabilityPointerAddress) -> []byte(capabilityName)` +* Initialized flag: `[]byte("mem_initialized")` +* RevCapabilityKey: `[]byte(moduleName + "/rev/" + capabilityName) -> []byte(index)` +* FwdCapabilityKey: `[]byte(moduleName + "/fwd/" + capabilityPointerAddress) -> []byte(capabilityName)` From 8de95ef64ef0342ac946f0c9444554b5d1441db7 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 23 Jun 2023 22:46:24 +0800 Subject: [PATCH 21/59] remove a change to e2e --- e2e/go.mod | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/go.mod b/e2e/go.mod index f84b40f54b6..dc8f0a42a59 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -235,7 +235,6 @@ replace ( github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7 ) -replace github.com/strangelove-ventures/interchaintest/v7 => github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e // uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. replace github.com/cosmos/ibc-go/v7 => ../ From 40c8bdc755154475708759f5e8530b92482b848d Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 23 Jun 2023 22:47:37 +0800 Subject: [PATCH 22/59] tidy --- e2e/go.mod | 1 - e2e/go.sum | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index dc8f0a42a59..950b71e021d 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -235,7 +235,6 @@ replace ( github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7 ) - // uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. replace github.com/cosmos/ibc-go/v7 => ../ diff --git a/e2e/go.sum b/e2e/go.sum index c1d3d7d0197..c6a9949baaf 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -432,8 +432,6 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.11.2 h1:z/luyejbevDCAMUUiu0rc80dxJxOnpoG58k5o0tSawc= github.com/ethereum/go-ethereum v1.11.2/go.mod h1:DuefStAgaxoaYGLR0FueVcVbehmn5n9QUcVrMCuOvuc= -github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e h1:5/pvLDbpUmxQN31DZT/HfERX5u7h0vAogCUVL4wyDOM= -github.com/faddat/ibctest/v7 v7.0.0-20230617151442-0f71333f7e9e/go.mod h1:e9Efky+L7EfeZID8/dneMUPRt/ZkNs1RaY3B4PoxrU0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= @@ -984,6 +982,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 h1:+FRVLRfJwZNkkipuPuK+FyY/5ZEkAjAjtiWQg6qc550= +github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7/go.mod h1:/FpoaMKTF3OREchZZvg6eGfVYvk7lAwqP9q2TN+lOGs= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= From 22aa59e01778bc2d5a786542629c89963b77fb07 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 23 Jun 2023 22:55:20 +0800 Subject: [PATCH 23/59] bump interchaintest --- e2e/go.mod | 16 ++++++++-------- e2e/go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index 950b71e021d..7882fc141a0 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -11,7 +11,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.1.0 github.com/cosmos/interchain-accounts v0.5.1 github.com/docker/docker v24.0.1+incompatible - github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 + github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230622193330-220ce33823c0 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.24.0 golang.org/x/mod v0.11.0 @@ -195,15 +195,15 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.10.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.11.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.9.3 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/term v0.9.0 // indirect + golang.org/x/text v0.10.0 // indirect + golang.org/x/tools v0.10.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.122.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/e2e/go.sum b/e2e/go.sum index c6a9949baaf..91058f25ed3 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -982,8 +982,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= -github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7 h1:+FRVLRfJwZNkkipuPuK+FyY/5ZEkAjAjtiWQg6qc550= -github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230503171723-5e55f37618b7/go.mod h1:/FpoaMKTF3OREchZZvg6eGfVYvk7lAwqP9q2TN+lOGs= +github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230622193330-220ce33823c0 h1:EmPhftNfcYilfyhv0X8a2wGdLAro19zooZoQqe9/6Ms= +github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230622193330-220ce33823c0/go.mod h1:CQxeTz7/TUfTbwJ3hJgHwxaZGfeJUuyIXvSQOz5gH38= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1091,8 +1091,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1195,8 +1195,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1238,8 +1238,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1339,13 +1339,13 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1357,8 +1357,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1424,8 +1424,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 6131edae940f60cd5e767e76209f56aa35a596ad Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:15:54 +0800 Subject: [PATCH 24/59] remove nft and use the upgrade code --- testing/simapp/app.go | 44 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 863128ca5ea..25f57d07e08 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,6 +2,7 @@ package simapp import ( "encoding/json" + "fmt" "io" "os" "path/filepath" @@ -76,9 +77,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/nft" - nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" - nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" @@ -98,6 +96,7 @@ import ( dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" @@ -175,9 +174,7 @@ var ( ibcmock.AppModuleBasic{}, ica.AppModuleBasic{}, authzmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, - nftmodule.AppModuleBasic{}, ibcfee.AppModuleBasic{}, consensus.AppModuleBasic{}, ) @@ -190,7 +187,6 @@ var ( stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, - nft.ModuleName: nil, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, ibcfeetypes.ModuleName: nil, icatypes.ModuleName: nil, @@ -239,7 +235,6 @@ type SimApp struct { TransferKeeper ibctransferkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper - NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper // make scoped keepers public for test purposes @@ -324,13 +319,11 @@ func NewSimApp( bApp.SetTxEncoder(txConfig.TxEncoder()) keys := sdk.NewKVStoreKeys( - // SDK Keys authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, paramstypes.StoreKey, + govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, consensusparamtypes.StoreKey, authzkeeper.StoreKey, - // IBC Keys ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, ibcfeetypes.StoreKey, ibcexported.StoreKey, ) @@ -468,8 +461,6 @@ func NewSimApp( ), ) - app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) - // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( appCodec, keys[ibcfeetypes.StoreKey], @@ -624,7 +615,6 @@ func NewSimApp( params.NewAppModule(app.ParamsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), // IBC modules @@ -645,7 +635,6 @@ func NewSimApp( evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, - nft.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -653,7 +642,6 @@ func NewSimApp( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, - nft.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -668,7 +656,7 @@ func NewSimApp( slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, nft.ModuleName, + vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) @@ -737,6 +725,9 @@ func NewSimApp( // upgrade. app.setPostHandler() + app.setupUpgradeHandlers() + app.setupUpgradeStoreLoaders() + if loadLatest { if err := app.LoadLatestVersion(); err != nil { logger.Error("error on loading last version", "err", err) @@ -985,20 +976,19 @@ func makeEncodingConfig() simappparams.EncodingConfig { } // IBC Upgrade examples -/* // setupUpgradeHandlers sets all necessary upgrade handlers for testing purposes func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( - upgrades.V5, - upgrades.CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator), + V5, + CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator), ) // NOTE: The moduleName arg of v6.CreateUpgradeHandler refers to the auth module ScopedKeeper name to which the channel capability should be migrated from. // This should be the same string value provided upon instantiation of the ScopedKeeper with app.CapabilityKeeper.ScopeToModule() // See: https://github.com/cosmos/ibc-go/blob/v6.1.0/testing/simapp/app.go#L310 app.UpgradeKeeper.SetUpgradeHandler( - upgrades.V6, - upgrades.CreateV6UpgradeHandler( + V6, + CreateV6UpgradeHandler( app.ModuleManager, app.configurator, app.appCodec, @@ -1009,8 +999,8 @@ func (app *SimApp) setupUpgradeHandlers() { ) app.UpgradeKeeper.SetUpgradeHandler( - upgrades.V7, - upgrades.CreateV7UpgradeHandler( + V7, + CreateV7UpgradeHandler( app.ModuleManager, app.configurator, app.appCodec, @@ -1021,12 +1011,11 @@ func (app *SimApp) setupUpgradeHandlers() { ) app.UpgradeKeeper.SetUpgradeHandler( - upgrades.V7_1, - upgrades.CreateV7LocalhostUpgradeHandler(app.ModuleManager, app.configurator, app.IBCKeeper.ClientKeeper), + V7_1, + CreateV7LocalhostUpgradeHandler(app.ModuleManager, app.configurator, app.IBCKeeper.ClientKeeper), ) } - // setupUpgradeStoreLoaders sets all necessary store loaders required by upgrades. func (app *SimApp) setupUpgradeStoreLoaders() { upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() @@ -1034,7 +1023,7 @@ func (app *SimApp) setupUpgradeStoreLoaders() { tmos.Exit(fmt.Sprintf("failed to read upgrade info from disk %s", err)) } - if upgradeInfo.Name == upgrades.V7 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if upgradeInfo.Name == V7 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{ consensusparamtypes.StoreKey, @@ -1046,7 +1035,6 @@ func (app *SimApp) setupUpgradeStoreLoaders() { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } -*/ // IBC TestingApp functions From fbe043e5c0bd59a424069ee1e94364ce40fd41e8 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:31:15 +0800 Subject: [PATCH 25/59] remove rosetta --- testing/simapp/simd/cmd/root.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index c6070fbd471..19726607031 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -8,8 +8,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -185,8 +183,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { keys.Commands(simapp.DefaultNodeHome), ) - // add rosetta - rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) } func addModuleInitFlags(startCmd *cobra.Command) { From 0b52d7fead60a9dcc85e4a8c85d70ef44af4ffe9 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:32:04 +0800 Subject: [PATCH 26/59] remove rosetta --- go.mod | 2 +- testing/simapp/simd/cmd/root.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4fc9193a277..c65d6b2761d 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.1 - cosmossdk.io/tools/rosetta v0.2.1 github.com/armon/go-metrics v0.4.1 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 @@ -36,6 +35,7 @@ require ( cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/log v1.1.0 // indirect + cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 19726607031..049ff6a51a0 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -182,7 +182,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { txCommand(), keys.Commands(simapp.DefaultNodeHome), ) - } func addModuleInitFlags(startCmd *cobra.Command) { From 8d39fbf9d00b2a01d08f23d1131f3219446e619e Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:36:18 +0800 Subject: [PATCH 27/59] remove subspaces for the paramters keeper --- testing/simapp/app.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 25f57d07e08..04b087dc8a1 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -948,14 +948,6 @@ func BlockedAddresses() map[string]bool { func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName) - paramsKeeper.Subspace(crisistypes.ModuleName) // TODO: ibc module subspaces can be removed after migration of params // https://github.com/cosmos/ibc-go/issues/2010 paramsKeeper.Subspace(ibctransfertypes.ModuleName) From 03b0eeb98ed594903da6577c62c7c9741d6f1ba1 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:39:48 +0800 Subject: [PATCH 28/59] remove commented out NewTestnetCommand --- testing/simapp/simd/cmd/root.go | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 049ff6a51a0..0e276b49f40 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -165,7 +165,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome), - // NewTestnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(), config.Cmd(), pruning.PruningCmd(newApp), From 750f54bf5d1a0bf83746d4dfd4a00304cfd843d1 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:42:45 +0800 Subject: [PATCH 29/59] fix the benchmarking command --- testing/simapp/sim_bench_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/sim_bench_test.go b/testing/simapp/sim_bench_test.go index 05e019a4ecc..e3bf4d29c31 100644 --- a/testing/simapp/sim_bench_test.go +++ b/testing/simapp/sim_bench_test.go @@ -18,7 +18,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() From 18334f5539be13cd592ffde4fedc8e47922ec43d Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Tue, 27 Jun 2023 14:50:22 +0800 Subject: [PATCH 30/59] revert Marshaler -> Codec --- .../controller/types/msgs_test.go | 4 ++-- .../apps/27-interchain-accounts/types/codec_test.go | 10 +++++----- testing/app.go | 2 +- testing/simapp/app.go | 2 +- testing/simapp/params/encoding.go | 2 +- testing/simapp/params/proto.go | 2 +- testing/simapp/simd/cmd/root.go | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index 48b383e0026..2a84109fad0 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -143,7 +143,7 @@ func TestMsgSendTxValidateBasic(t *testing.T) { Amount: ibctesting.TestCoins, } - data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{msgBankSend}) + data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{msgBankSend}) require.NoError(t, err) packetData := icatypes.InterchainAccountPacketData{ @@ -179,7 +179,7 @@ func TestMsgSendTxGetSigners(t *testing.T) { Amount: ibctesting.TestCoins, } - data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{msgBankSend}) + data, err := icatypes.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{msgBankSend}) require.NoError(t, err) packetData := icatypes.InterchainAccountPacketData{ diff --git a/modules/apps/27-interchain-accounts/types/codec_test.go b/modules/apps/27-interchain-accounts/types/codec_test.go index f47219862cb..33616d38790 100644 --- a/modules/apps/27-interchain-accounts/types/codec_test.go +++ b/modules/apps/27-interchain-accounts/types/codec_test.go @@ -110,10 +110,10 @@ func (suite *TypesTestSuite) TestSerializeAndDeserializeCosmosTx() { tc := tc suite.Run(tc.name, func() { - bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, tc.msgs) + bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, tc.msgs) suite.Require().NoError(err, tc.name) - msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, bz) + msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, bz) if tc.expPass { suite.Require().NoError(err, tc.name) } else { @@ -127,16 +127,16 @@ func (suite *TypesTestSuite) TestSerializeAndDeserializeCosmosTx() { } // test serializing non sdk.Msg type - bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []proto.Message{&banktypes.MsgSendResponse{}}) + bz, err := types.SerializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []proto.Message{&banktypes.MsgSendResponse{}}) suite.Require().NoError(err) suite.Require().NotEmpty(bz) // test deserializing unknown bytes - _, err = types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, bz) + _, err = types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, bz) suite.Require().Error(err) // unregistered type // test deserializing unknown bytes - msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Codec, []byte("invalid")) + msgs, err := types.DeserializeCosmosTx(simapp.MakeTestEncodingConfig().Marshaler, []byte("invalid")) suite.Require().Error(err) suite.Require().Empty(msgs) } diff --git a/testing/app.go b/testing/app.go index a67f46e2870..5b8d134742d 100644 --- a/testing/app.go +++ b/testing/app.go @@ -57,7 +57,7 @@ func SetupTestingApp() (TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := simapp.MakeTestEncodingConfig() app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) - return app, simapp.NewDefaultGenesisState(encCdc.Codec) + return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) } // SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 04b087dc8a1..c9a412cc445 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -281,7 +281,7 @@ func NewSimApp( ) *SimApp { encodingConfig := makeEncodingConfig() - appCodec := encodingConfig.Codec + appCodec := encodingConfig.Marshaler legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry txConfig := encodingConfig.TxConfig diff --git a/testing/simapp/params/encoding.go b/testing/simapp/params/encoding.go index 8ff9ea04b39..3d634abf16b 100644 --- a/testing/simapp/params/encoding.go +++ b/testing/simapp/params/encoding.go @@ -10,7 +10,7 @@ import ( // This is provided for compatibility between protobuf and amino implementations. type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry - Codec codec.Codec + Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino } diff --git a/testing/simapp/params/proto.go b/testing/simapp/params/proto.go index 2a38fff0400..c6de3b08fc2 100644 --- a/testing/simapp/params/proto.go +++ b/testing/simapp/params/proto.go @@ -20,7 +20,7 @@ func MakeTestEncodingConfig() EncodingConfig { return EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Codec: codec, + Marshaler: codec, TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), Amino: cdc, } diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 0e276b49f40..b0a45beca25 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -41,13 +41,13 @@ func NewRootCmd() *cobra.Command { tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(simapp.DefaultNodeHome)) encodingConfig := params.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), - Codec: tempApp.AppCodec(), + Marshaler: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), Amino: tempApp.LegacyAmino(), } initClientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). + WithCodec(encodingConfig.Marshaler). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). From 3616944d7f04c5bd44dbec0440d4072c7ebc04a4 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:48:21 +0800 Subject: [PATCH 31/59] cleanup --- testing/app.go | 2 +- testing/simapp/simd/cmd/root.go | 2 +- testing/simapp/test_helpers.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/app.go b/testing/app.go index 5b8d134742d..a67f46e2870 100644 --- a/testing/app.go +++ b/testing/app.go @@ -57,7 +57,7 @@ func SetupTestingApp() (TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := simapp.MakeTestEncodingConfig() app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) - return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) + return app, simapp.NewDefaultGenesisState(encCdc.Codec) } // SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 86ebfffed4b..0e276b49f40 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -41,7 +41,7 @@ func NewRootCmd() *cobra.Command { tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(simapp.DefaultNodeHome)) encodingConfig := params.EncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), - Marshaler: tempApp.AppCodec(), + Codec: tempApp.AppCodec(), TxConfig: tempApp.TxConfig(), Amino: tempApp.LegacyAmino(), } diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 1f337cf8b1d..fd305ba9a0a 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -54,6 +54,7 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { app := NewSimApp(log.NewNopLogger(), db, nil, true, appOptions) if withGenesis { return app, app.DefaultGenesis() + } return app, GenesisState{} } From a513786df2c46e5a171769e5fe998678afa6bdb0 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:51:28 +0800 Subject: [PATCH 32/59] move upgrades --- testing/simapp/app.go | 13 +++++++------ testing/simapp/{ => upgrades}/upgrades.go | 0 2 files changed, 7 insertions(+), 6 deletions(-) rename testing/simapp/{ => upgrades}/upgrades.go (100%) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index a71a23e77e1..a0ef368b986 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -92,6 +92,7 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -970,16 +971,16 @@ func makeEncodingConfig() simappparams.EncodingConfig { // setupUpgradeHandlers sets all necessary upgrade handlers for testing purposes func (app *SimApp) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( - V5, - CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator), + upgrades.V5, + upgrades.CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator), ) // NOTE: The moduleName arg of v6.CreateUpgradeHandler refers to the auth module ScopedKeeper name to which the channel capability should be migrated from. // This should be the same string value provided upon instantiation of the ScopedKeeper with app.CapabilityKeeper.ScopeToModule() // See: https://github.com/cosmos/ibc-go/blob/v6.1.0/testing/simapp/app.go#L310 app.UpgradeKeeper.SetUpgradeHandler( - V6, - CreateV6UpgradeHandler( + upgrades.V6, + upgrades.CreateV6UpgradeHandler( app.ModuleManager, app.configurator, app.appCodec, @@ -990,8 +991,8 @@ func (app *SimApp) setupUpgradeHandlers() { ) app.UpgradeKeeper.SetUpgradeHandler( - V7, - CreateV7UpgradeHandler( + upgrades.V7, + upgrades.CreateV7UpgradeHandler( app.ModuleManager, app.configurator, app.appCodec, diff --git a/testing/simapp/upgrades.go b/testing/simapp/upgrades/upgrades.go similarity index 100% rename from testing/simapp/upgrades.go rename to testing/simapp/upgrades/upgrades.go From e03d5bb51931881c3471924661760accad7a4ad4 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:52:48 +0800 Subject: [PATCH 33/59] fix simapp --- testing/simapp/app.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index a0ef368b986..c8b1861b3d3 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -92,7 +92,7 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" + upgrades "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -1003,8 +1003,8 @@ func (app *SimApp) setupUpgradeHandlers() { ) app.UpgradeKeeper.SetUpgradeHandler( - V7_1, - CreateV7LocalhostUpgradeHandler(app.ModuleManager, app.configurator, app.IBCKeeper.ClientKeeper), + upgrades.V7_1, + upgrades.CreateV7LocalhostUpgradeHandler(app.ModuleManager, app.configurator, app.IBCKeeper.ClientKeeper), ) } @@ -1015,7 +1015,7 @@ func (app *SimApp) setupUpgradeStoreLoaders() { tmos.Exit(fmt.Sprintf("failed to read upgrade info from disk %s", err)) } - if upgradeInfo.Name == V7 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if upgradeInfo.Name == upgrades.V7 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{ consensusparamtypes.StoreKey, From 54321e0b3ac6aaaba3f322d3a84d57f61e47ed2c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:53:11 +0800 Subject: [PATCH 34/59] fix simapp (lint) --- testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index c8b1861b3d3..9842cb8245d 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -92,7 +92,6 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - upgrades "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -127,6 +126,7 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibcmock "github.com/cosmos/ibc-go/v7/testing/mock" simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params" + upgrades "github.com/cosmos/ibc-go/v7/testing/simapp/upgrades" ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" ) From 873c44e63d0454f4d952e763fbabefd42ca76dbf Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:54:18 +0800 Subject: [PATCH 35/59] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47cde75522c..09119cfcabc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (simapp) [\#3874](https://github.com/cosmos/ibc-go/pull/3874) Refactor simapp to more closely resemble the style used in cosmos-sdk +* (simapp) [\#3874](https://github.com/cosmos/ibc-go/pull/3874) imp: refactor simapp to more closely resemble the style used in cosmos-sdk * (tests) [\#3138](https://github.com/cosmos/ibc-go/pull/3138) Support benchmarks and fuzz tests through `testing.TB`. ### Features From 2751bed9a9a786d288e11a73e5ce395e2b2b4fbb Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 15:55:54 +0800 Subject: [PATCH 36/59] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09119cfcabc..e281a8568f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -152,7 +152,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (06-solomachine) [\#1972](https://github.com/cosmos/ibc-go/pull/1972) Solo machine implementation of `ZeroCustomFields` fn now panics as the fn is only used for upgrades which solo machine does not support. * (light-clients/06-solomachine) Moving `verifyMisbehaviour` function from update.go to misbehaviour_handle.go. * [\#2434](https://github.com/cosmos/ibc-go/pull/2478) Removed all `TypeMsg` constants -* (modules/core/exported) [\#2539] () Removing `GetVersions` from `ConnectionI` interface. +* (modules/core/exported) [\#2539](https://github.com/cosmos/ibc-go/pull/2539) Removing `GetVersions` from `ConnectionI` interface. * (core/02-connection) [\#2419](https://github.com/cosmos/ibc-go/pull/2419) Add optional proof data to proto definitions of `MsgConnectionOpenTry` and `MsgConnectionOpenAck` for host state machines that are unable to introspect their own consensus state. * (light-clients/07-tendermint) [\#3046](https://github.com/cosmos/ibc-go/pull/3046) Moved non-verification misbehaviour checks to `CheckForMisbehaviour`. * (apps/29-fee) [\#2975](https://github.com/cosmos/ibc-go/pull/2975) Adding distribute fee events to ics29. From e0b3e4a2de0e4157bf4e0aa615ce31942d22b8b2 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 16:01:26 +0800 Subject: [PATCH 37/59] correct the envprefix --- testing/simapp/simd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/simd/main.go b/testing/simapp/simd/main.go index b431382a732..8322af205ec 100644 --- a/testing/simapp/simd/main.go +++ b/testing/simapp/simd/main.go @@ -12,7 +12,7 @@ import ( func main() { rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, "SIMD", simapp.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) From 7fab58e40eb98c7d5ecfde7384391b6ca7a65c57 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 16:02:51 +0800 Subject: [PATCH 38/59] remove newtestnetworkfixture (used for the testnet command) --- testing/simapp/test_helpers.go | 37 ---------------------------------- 1 file changed, 37 deletions(-) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index fd305ba9a0a..d0d88d5f19d 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -2,9 +2,7 @@ package simapp import ( "encoding/json" - "fmt" "math/rand" - "os" "testing" "time" @@ -19,11 +17,8 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - "github.com/cosmos/cosmos-sdk/testutil/network" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -178,38 +173,6 @@ func initAccountWithCoins(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, coi } } -// NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests -func NewTestNetworkFixture() network.TestFixture { - dir, err := os.MkdirTemp("", "simapp") - if err != nil { - panic(fmt.Sprintf("failed creating temporary directory: %v", err)) - } - defer os.RemoveAll(dir) - - app := NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(dir)) - - appCtr := func(val network.ValidatorI) servertypes.Application { - return NewSimApp( - val.GetCtx().Logger, dbm.NewMemDB(), nil, true, - simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir), - bam.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - bam.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - bam.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)), - ) - } - - return network.TestFixture{ - AppConstructor: appCtr, - GenesisState: app.DefaultGenesis(), - EncodingConfig: testutil.TestEncodingConfig{ - InterfaceRegistry: app.InterfaceRegistry(), - Codec: app.AppCodec(), - TxConfig: app.TxConfig(), - Amino: app.LegacyAmino(), - }, - } -} - // SetupWithGenesisAccounts initializes a new SimApp with the provided genesis // accounts and possible balances. func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { From 4d8d4e8e78d17a1ca8264e792c39167095bf17e5 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 16:03:59 +0800 Subject: [PATCH 39/59] remove other unused code --- testing/simapp/test_helpers.go | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index d0d88d5f19d..e1692ac26ee 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -8,8 +8,6 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/math" - bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -21,7 +19,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -143,36 +140,6 @@ func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState { return genesisState } -// AddTestAddrsIncremental constructs and returns accNum amount of accounts with an -// initial balance of accAmt in random order -func AddTestAddrsIncremental(app *SimApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress { - return addTestAddrs(app, ctx, accNum, accAmt, simtestutil.CreateIncrementalAccounts) -} - -func addTestAddrs(app *SimApp, ctx sdk.Context, accNum int, accAmt math.Int, strategy simtestutil.GenerateAccountStrategy) []sdk.AccAddress { - testAddrs := strategy(accNum) - - initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) - - for _, addr := range testAddrs { - initAccountWithCoins(app, ctx, addr, initCoins) - } - - return testAddrs -} - -func initAccountWithCoins(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { - err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) - if err != nil { - panic(err) - } - - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) - if err != nil { - panic(err) - } -} - // SetupWithGenesisAccounts initializes a new SimApp with the provided genesis // accounts and possible balances. func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { From 6bb5abb3e64d587c4eff2f449313a1864d4d6459 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 16:06:28 +0800 Subject: [PATCH 40/59] supernit: testdata_pulsar -> testdatapb --- testing/simapp/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 9842cb8245d..d1dd71f4d68 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -30,7 +30,7 @@ import ( "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/store/streaming" storetypes "github.com/cosmos/cosmos-sdk/store/types" - testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" + testdatapb "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" @@ -681,7 +681,7 @@ func NewSimApp( reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) // add test gRPC service for testing gRPC queries in isolation - testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) + testdatapb.RegisterQueryServer(app.GRPCQueryRouter(), testdatapb.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations // From ab6c054111db0ed31a1cb467076ab346481a7488 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 18:55:49 +0800 Subject: [PATCH 41/59] remove setup with single validator --- testing/simapp/test_helpers.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index e1692ac26ee..03fe947caed 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -110,36 +110,6 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs return app } -// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts -// that also act as delegators. -func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState { - t.Helper() - - privVal := mock.NewPV() - pubKey, err := privVal.GetPubKey() - require.NoError(t, err) - - // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) - - // generate genesis account - senderPrivKey := secp256k1.GenPrivKey() - acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) - balances := []banktypes.Balance{ - { - Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), - }, - } - - genesisState := app.DefaultGenesis() - genesisState, err = simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) - require.NoError(t, err) - - return genesisState -} - // SetupWithGenesisAccounts initializes a new SimApp with the provided genesis // accounts and possible balances. func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { From 3a4e5768d80dd9ed182bcbca3c4aadd81363f795 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 18:56:36 +0800 Subject: [PATCH 42/59] remove home flag check --- testing/simapp/simd/cmd/cmd_test.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/testing/simapp/simd/cmd/cmd_test.go b/testing/simapp/simd/cmd/cmd_test.go index 15cc433cab4..2a034ea25da 100644 --- a/testing/simapp/simd/cmd/cmd_test.go +++ b/testing/simapp/simd/cmd/cmd_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/client/flags" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" @@ -24,20 +23,3 @@ func TestInitCmd(t *testing.T) { require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome)) } - -func TestHomeFlagRegistration(t *testing.T) { - homeDir := "/tmp/foo" - - rootCmd := cmd.NewRootCmd() - rootCmd.SetArgs([]string{ - "query", - fmt.Sprintf("--%s", flags.FlagHome), - homeDir, - }) - - require.NoError(t, svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome)) - - result, err := rootCmd.Flags().GetString(flags.FlagHome) - require.NoError(t, err) - require.Equal(t, result, homeDir) -} From e79f6db7194594808c8dbcac325bbb0acd813d7f Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 18:58:53 +0800 Subject: [PATCH 43/59] remove comment --- testing/simapp/app.go | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index d1dd71f4d68..c16406b7524 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -420,7 +420,6 @@ func NewSimApp( */ app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) - // get skipUpgradeHeights from the app options skipUpgradeHeights := map[int64]bool{} for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { skipUpgradeHeights[int64(h)] = true From b626af18b5c80e8c2f7e5b9c24f942ab9c680ed1 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 19:11:55 +0800 Subject: [PATCH 44/59] remove utils.go --- testing/simapp/utils.go | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 testing/simapp/utils.go diff --git a/testing/simapp/utils.go b/testing/simapp/utils.go deleted file mode 100644 index 31f4b1aa05a..00000000000 --- a/testing/simapp/utils.go +++ /dev/null @@ -1,41 +0,0 @@ -package simapp - -import ( - "os" - - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" -) - -// SetupSimulation creates the config, db (levelDB), temporary directory and logger for -// the simulation tests. If `FlagEnabledValue` is false it skips the current test. -// Returns error on an invalid db intantiation or temp dir creation. -func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) { - if !FlagEnabledValue { - return simtypes.Config{}, nil, "", nil, true, nil - } - - config := NewConfigFromFlags() - config.ChainID = "simulation-app" - - var logger log.Logger - if FlagVerboseValue { - logger = log.TestingLogger() - } else { - logger = log.NewNopLogger() - } - - dir, err := os.MkdirTemp("", dirPrefix) - if err != nil { - return simtypes.Config{}, nil, "", nil, false, err - } - - db, err := dbm.NewDB(dbName, dbm.BackendType(config.DBBackend), dir) - if err != nil { - return simtypes.Config{}, nil, "", nil, false, err - } - - return config, db, dir, logger, false, nil -} From 40f00d082a6626bb9c3f76bcaf87adf8399c6116 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 19:13:04 +0800 Subject: [PATCH 45/59] remove state.go --- testing/simapp/state.go | 235 ---------------------------------------- 1 file changed, 235 deletions(-) delete mode 100644 testing/simapp/state.go diff --git a/testing/simapp/state.go b/testing/simapp/state.go deleted file mode 100644 index d7e5853d162..00000000000 --- a/testing/simapp/state.go +++ /dev/null @@ -1,235 +0,0 @@ -package simapp - -import ( - "encoding/json" - "fmt" - "io" - "math/rand" - "os" - "time" - - sdkmath "cosmossdk.io/math" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - tmjson "github.com/cometbft/cometbft/libs/json" - tmtypes "github.com/cometbft/cometbft/types" - - simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params" -) - -// AppStateFn returns the initial application state using a genesis or the simulation parameters. -// It panics if the user provides files for both of them. -// If a file is not given for the genesis or the sim params, it creates a randomized one. -func AppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) simtypes.AppStateFn { - return func(r *rand.Rand, accs []simtypes.Account, config simtypes.Config, - ) (appState json.RawMessage, simAccs []simtypes.Account, chainID string, genesisTimestamp time.Time) { - if FlagGenesisTimeValue == 0 { - genesisTimestamp = simtypes.RandTimestamp(r) - } else { - genesisTimestamp = time.Unix(FlagGenesisTimeValue, 0) - } - - chainID = config.ChainID - switch { - case config.ParamsFile != "" && config.GenesisFile != "": - panic("cannot provide both a genesis file and a params file") - - case config.GenesisFile != "": - // override the default chain-id from simapp to set it later to the config - genesisDoc, accounts := AppStateFromGenesisFileFn(r, cdc, config.GenesisFile) - - if FlagGenesisTimeValue == 0 { - // use genesis timestamp if no custom timestamp is provided (i.e no random timestamp) - genesisTimestamp = genesisDoc.GenesisTime - } - - appState = genesisDoc.AppState - chainID = genesisDoc.ChainID - simAccs = accounts - - case config.ParamsFile != "": - appParams := make(simtypes.AppParams) - bz, err := os.ReadFile(config.ParamsFile) - if err != nil { - panic(err) - } - - err = json.Unmarshal(bz, &appParams) - if err != nil { - panic(err) - } - appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams) - - default: - appParams := make(simtypes.AppParams) - appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams) - } - - rawState := make(map[string]json.RawMessage) - err := json.Unmarshal(appState, &rawState) - if err != nil { - panic(err) - } - - stakingStateBz, ok := rawState[stakingtypes.ModuleName] - if !ok { - panic("staking genesis state is missing") - } - - stakingState := new(stakingtypes.GenesisState) - err = cdc.UnmarshalJSON(stakingStateBz, stakingState) - if err != nil { - panic(err) - } - // compute not bonded balance - notBondedTokens := sdkmath.ZeroInt() - for _, val := range stakingState.Validators { - if val.Status != stakingtypes.Unbonded { - continue - } - notBondedTokens = notBondedTokens.Add(val.GetTokens()) - } - notBondedCoins := sdk.NewCoin(stakingState.Params.BondDenom, notBondedTokens) - // edit bank state to make it have the not bonded pool tokens - bankStateBz, ok := rawState[banktypes.ModuleName] - // TODO(fdymylja/jonathan): should we panic in this case - if !ok { - panic("bank genesis state is missing") - } - bankState := new(banktypes.GenesisState) - err = cdc.UnmarshalJSON(bankStateBz, bankState) - if err != nil { - panic(err) - } - - bankState.Balances = append(bankState.Balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.NotBondedPoolName).String(), - Coins: sdk.NewCoins(notBondedCoins), - }) - - // change appState back - rawState[stakingtypes.ModuleName] = cdc.MustMarshalJSON(stakingState) - rawState[banktypes.ModuleName] = cdc.MustMarshalJSON(bankState) - - // replace appstate - appState, err = json.Marshal(rawState) - if err != nil { - panic(err) - } - return appState, simAccs, chainID, genesisTimestamp - } -} - -// AppStateRandomizedFn creates calls each module's GenesisState generator function -// and creates the simulation params -func AppStateRandomizedFn( - simManager *module.SimulationManager, r *rand.Rand, cdc codec.JSONCodec, - accs []simtypes.Account, genesisTimestamp time.Time, appParams simtypes.AppParams, -) (json.RawMessage, []simtypes.Account) { - numAccs := int64(len(accs)) - genesisState := NewDefaultGenesisState(cdc) - - // generate a random amount of initial stake coins and a random initial - // number of bonded accounts - var initialStake, numInitiallyBonded int64 - appParams.GetOrGenerate( - cdc, simappparams.StakePerAccount, &initialStake, r, - func(r *rand.Rand) { initialStake = r.Int63n(1e12) }, - ) - appParams.GetOrGenerate( - cdc, simappparams.InitiallyBondedValidators, &numInitiallyBonded, r, - func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) }, - ) - - if numInitiallyBonded > numAccs { - numInitiallyBonded = numAccs - } - - fmt.Printf( - `Selected randomly generated parameters for simulated genesis: -{ - stake_per_account: "%d", - initially_bonded_validators: "%d" -} -`, initialStake, numInitiallyBonded, - ) - - simState := &module.SimulationState{ - AppParams: appParams, - Cdc: cdc, - Rand: r, - GenState: genesisState, - Accounts: accs, - InitialStake: sdkmath.NewInt(initialStake), - NumBonded: numInitiallyBonded, - GenTimestamp: genesisTimestamp, - } - - simManager.GenerateGenesisStates(simState) - - appState, err := json.Marshal(genesisState) - if err != nil { - panic(err) - } - - return appState, accs -} - -// AppStateFromGenesisFileFn util function to generate the genesis AppState -// from a genesis.json file. -func AppStateFromGenesisFileFn(r io.Reader, cdc codec.JSONCodec, genesisFile string) (tmtypes.GenesisDoc, []simtypes.Account) { - bytes, err := os.ReadFile(genesisFile) - if err != nil { - panic(err) - } - - var genesis tmtypes.GenesisDoc - // NOTE: Tendermint uses a custom JSON decoder for GenesisDoc - err = tmjson.Unmarshal(bytes, &genesis) - if err != nil { - panic(err) - } - - var appState GenesisState - err = json.Unmarshal(genesis.AppState, &appState) - if err != nil { - panic(err) - } - - var authGenesis authtypes.GenesisState - if appState[authtypes.ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[authtypes.ModuleName], &authGenesis) - } - - newAccs := make([]simtypes.Account, len(authGenesis.Accounts)) - for i, acc := range authGenesis.Accounts { - // Pick a random private key, since we don't know the actual key - // This should be fine as it's only used for mock Tendermint validators - // and these keys are never actually used to sign by mock Tendermint. - privkeySeed := make([]byte, 15) - if _, err := r.Read(privkeySeed); err != nil { - panic(err) - } - - privKey := secp256k1.GenPrivKeyFromSecret(privkeySeed) - - a, ok := acc.GetCachedValue().(authtypes.AccountI) - if !ok { - panic("expected account") - } - - // create simulator accounts - simAcc := simtypes.Account{PrivKey: privKey, PubKey: privKey.PubKey(), Address: a.GetAddress()} - newAccs[i] = simAcc - } - - return genesis, newAccs -} From 7c1d24e159c822f540f96de8a1b2cfa420cc8128 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 19:14:11 +0800 Subject: [PATCH 46/59] rename sm to simulationManager --- testing/simapp/app.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index c16406b7524..f4134387880 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -256,7 +256,7 @@ type SimApp struct { ModuleManager *module.Manager // simulation manager - sm *module.SimulationManager + simulationManager *module.SimulationManager // module configurator configurator module.Configurator @@ -689,9 +689,9 @@ func NewSimApp( overrideModules := map[string]module.AppModuleSimulation{ authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } - app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) + app.simulationManager = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) - app.sm.RegisterStoreDecoders() + app.simulationManager.RegisterStoreDecoders() // initialize stores app.MountKVStores(keys) @@ -873,7 +873,7 @@ func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace { // SimulationManager implements the SimulationApp interface func (app *SimApp) SimulationManager() *module.SimulationManager { - return app.sm + return app.simulationManager } // RegisterAPIRoutes registers all application module routes with the provided From 42f0eabbe3580e39c2b369f92c32cc4cf5d9761d Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 19:15:12 +0800 Subject: [PATCH 47/59] remove testingkey --- testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index f4134387880..94c3b8b620d 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -331,7 +331,7 @@ func NewSimApp( tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey, "testingkey") + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) // load state streaming if enabled if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { From df4dd5692f641b243dd08e56f99307050941a1d5 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 20:40:34 +0800 Subject: [PATCH 48/59] Update testing/simapp/app.go Co-authored-by: Damian Nolan --- testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index f4134387880..d4d3eb1a955 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -837,7 +837,7 @@ func (app *SimApp) TxConfig() client.TxConfig { return app.txConfig } -// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +// DefaultGenesis returns a raw json message containing the AppModuleBasic's default genesis state. func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { return ModuleBasics.DefaultGenesis(a.appCodec) } From 5012d059f6a9c7ae16809038b31b09c01d71e0ad Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:03:49 +0800 Subject: [PATCH 49/59] move comments about Seal() --- testing/simapp/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 101884a744d..6ea388775ab 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -358,8 +358,6 @@ func NewSimApp( // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) @@ -373,6 +371,8 @@ func NewSimApp( scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) // seal capability keeper after scoping modules + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` app.CapabilityKeeper.Seal() // SDK module keepers From 84751e0db0360cbabdc53ac364ba53d19ac83e9c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:04:26 +0800 Subject: [PATCH 50/59] remove changelog entry --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e281a8568f3..cc66dd2f473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (simapp) [\#3874](https://github.com/cosmos/ibc-go/pull/3874) imp: refactor simapp to more closely resemble the style used in cosmos-sdk * (tests) [\#3138](https://github.com/cosmos/ibc-go/pull/3138) Support benchmarks and fuzz tests through `testing.TB`. ### Features From 69db2749943cc2b0b5fdde463ee187e70d64565b Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:05:47 +0800 Subject: [PATCH 51/59] remove unnecessary comment about upgrade handlers --- testing/simapp/app.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 6ea388775ab..6978c030d0e 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -667,10 +667,6 @@ func NewSimApp( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.ModuleManager.RegisterServices(app.configurator) - // RegisterUpgradeHandlers is used for registering any on-chain upgrades. - // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. - // app.RegisterUpgradeHandlers() - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) reflectionSvc, err := runtimeservices.NewReflectionService() From 9e7c498d7e919a2dae5f04af4ff8b88577e4755c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:06:39 +0800 Subject: [PATCH 52/59] godocs for the configurator --- testing/simapp/app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 6978c030d0e..00c6bfe7d02 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -788,6 +788,7 @@ func (app *SimApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Re return app.ModuleManager.EndBlock(ctx, req) } +// Configurator returns the configurator for the app func (a *SimApp) Configurator() module.Configurator { return a.configurator } From 3ed90cc597e4a44a75be0f1e13a399af3e16318b Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:07:36 +0800 Subject: [PATCH 53/59] use "upgrades" package for upgrades.go --- testing/simapp/upgrades/upgrades.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/upgrades/upgrades.go b/testing/simapp/upgrades/upgrades.go index 2019f07d1d4..1a8a8a9052c 100644 --- a/testing/simapp/upgrades/upgrades.go +++ b/testing/simapp/upgrades/upgrades.go @@ -1,4 +1,4 @@ -package simapp +package upgrades import ( "github.com/cosmos/cosmos-sdk/baseapp" From f054d31ef3a2efb32c26df5e7a83639c495811b8 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:58:42 +0800 Subject: [PATCH 54/59] Update testing/simapp/sim_test.go Co-authored-by: Damian Nolan --- testing/simapp/sim_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/simapp/sim_test.go b/testing/simapp/sim_test.go index 573579573fc..7330747ba5d 100644 --- a/testing/simapp/sim_test.go +++ b/testing/simapp/sim_test.go @@ -37,7 +37,6 @@ import ( "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - // IBC capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" From d13cd9a314938d6d752fd2f705a2818a368a9e37 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 28 Jun 2023 21:58:58 +0800 Subject: [PATCH 55/59] Update testing/simapp/app.go Co-authored-by: Damian Nolan --- testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 00c6bfe7d02..9fd3eeb5955 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -329,7 +329,7 @@ func NewSimApp( ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - // NOTE: The testingkey is just mounted for testing purposes. Actual applications should + // NOTE: The ibcmock.MemStoreKey is just mounted for testing purposes. Actual applications should // not include this key. memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) From 70fbefedd9b257e43180f2fcd545c6ea153996b8 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 3 Jul 2023 15:54:20 +0800 Subject: [PATCH 56/59] Update testing/simapp/test_helpers.go Co-authored-by: Carlos Rodriguez --- testing/simapp/test_helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 03fe947caed..7c7aaafe32d 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -67,7 +67,7 @@ func Setup(t *testing.T, isCheckTx bool) *SimApp { acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance) From 6ccf86e8705b31247e3711a14f222a261e27e227 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 3 Jul 2023 15:58:05 +0800 Subject: [PATCH 57/59] lint and restore the sdkmath import --- testing/simapp/test_helpers.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index 7c7aaafe32d..c9b97885422 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -8,6 +8,8 @@ import ( "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" From 21c9fa56ea2682ec83dcf91b3db9f298e9f39ddb Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 3 Jul 2023 16:13:25 +0800 Subject: [PATCH 58/59] don't set simappchainid --- testing/simapp/app.go | 3 ++- testing/simapp/params/doc.go | 8 ++++---- testing/simapp/sim_bench_test.go | 1 - testing/simapp/simd/cmd/root.go | 1 + testing/simapp/simd/main.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 9fd3eeb5955..92a3ccb0326 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -281,6 +281,7 @@ func NewSimApp( baseAppOptions ...func(*baseapp.BaseApp), ) *SimApp { encodingConfig := makeEncodingConfig() + appCodec := encodingConfig.Codec legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry @@ -834,7 +835,7 @@ func (app *SimApp) TxConfig() client.TxConfig { return app.txConfig } -// DefaultGenesis returns a raw json message containing the AppModuleBasic's default genesis state. +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { return ModuleBasics.DefaultGenesis(a.appCodec) } diff --git a/testing/simapp/params/doc.go b/testing/simapp/params/doc.go index bef67c83b3d..a2f3620a835 100644 --- a/testing/simapp/params/doc.go +++ b/testing/simapp/params/doc.go @@ -3,9 +3,9 @@ Package params defines the simulation parameters in the simapp. It contains the default weights used for each transaction used on the module's simulation. These weights define the chance for a transaction to be simulated at -any gived operation. +any given operation. -You can repace the default values for the weights by providing a params.json +You can replace the default values for the weights by providing a params.json file with the weights defined for each of the transaction operations: { @@ -13,7 +13,7 @@ file with the weights defined for each of the transaction operations: "op_weight_msg_delegate": 100, } -In the example above, the MsgSend has 60% chance to be simulated, while the -MsgDelegate will always be simulated. +In the example above, the `MsgSend` has 60% chance to be simulated, while the +`MsgDelegate` will always be simulated. */ package params diff --git a/testing/simapp/sim_bench_test.go b/testing/simapp/sim_bench_test.go index e3bf4d29c31..9685bbe896a 100644 --- a/testing/simapp/sim_bench_test.go +++ b/testing/simapp/sim_bench_test.go @@ -23,7 +23,6 @@ func BenchmarkFullAppSimulation(b *testing.B) { b.ReportAllocs() config := simcli.NewConfigFromFlags() - config.ChainID = SimAppChainID db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "goleveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) if err != nil { diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 0e276b49f40..0ab058b17a1 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -253,6 +253,7 @@ func newApp( traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) return simapp.NewSimApp( diff --git a/testing/simapp/simd/main.go b/testing/simapp/simd/main.go index 8322af205ec..b431382a732 100644 --- a/testing/simapp/simd/main.go +++ b/testing/simapp/simd/main.go @@ -12,7 +12,7 @@ import ( func main() { rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "SIMD", simapp.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) From f728dc6945949d93b174639c6c662a3b2c401210 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 3 Jul 2023 16:16:11 +0800 Subject: [PATCH 59/59] lint --- testing/simapp/simd/cmd/root.go | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 0ab058b17a1..0e276b49f40 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -253,7 +253,6 @@ func newApp( traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { - baseappOptions := server.DefaultBaseappOptions(appOpts) return simapp.NewSimApp(