diff --git a/CHANGELOG.md b/CHANGELOG.md index effe33f3252..b7e870e2eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,7 +64,6 @@ 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. -* (testing) [\#3295](https://github.com/cosmos/ibc-go/pull/3295) The function to initialize the `TestingApp` takes now the chain ID as parameter. ### State Machine Breaking @@ -122,6 +121,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (testing) [\#3295](https://github.com/cosmos/ibc-go/pull/3295) The function `SetupWithGenesisValSet` will set the baseapp chainID before running `InitChain` * (light-clients/solomachine) [#1839](https://github.com/cosmos/ibc-go/pull/1839) Fixed usage of the new diversifier in validation of changing diversifiers for the solo machine. The current diversifier must sign over the new diversifier. * (light-clients/07-tendermint) [\#1674](https://github.com/cosmos/ibc-go/pull/1674) Submitted ClientState is zeroed out before checking the proof in order to prevent the proposal from containing information governance is not actually voting on. * (modules/core/02-client)[\#1676](https://github.com/cosmos/ibc-go/pull/1676) ClientState must be zeroed out for `UpgradeProposals` to pass validation. This prevents a proposal containing information governance is not actually voting on. diff --git a/docs/migrations/v6-to-v7.md b/docs/migrations/v6-to-v7.md index aa203d093f5..ba9a053a267 100644 --- a/docs/migrations/v6-to-v7.md +++ b/docs/migrations/v6-to-v7.md @@ -95,15 +95,6 @@ It may be useful to reference the [PR](https://github.com/cosmos/ibc-go/pull/282 The `SetChannelClosed` utility method in `testing/endpoint.go` has been updated to `SetChannelState`, which will take a `channeltypes.State` argument so that the `ChannelState` can be set to any of the possible channel states. -The function to initialize the `TestingApp` takes now the chain ID as parameter: - - ```go -- func SetupTestingApp() (TestingApp, map[string]json.RawMessage) -+ func SetupTestingApp(chainID string) (TestingApp, map[string]json.RawMessage) -``` - -The chain ID should then be pass to `SetChainID` and used as a `baseapp` option in the `NewSimApp` constructor. - ## IBC Apps - No relevant changes were made in this release. diff --git a/testing/README.md b/testing/README.md index 9bb7a28818e..c00eb19af4e 100644 --- a/testing/README.md +++ b/testing/README.md @@ -117,7 +117,7 @@ It is assumed your application contains an embedded BaseApp and thus implements The testing package requires that you provide a function to initialize your TestingApp. This is how ibc-go implements the initialize function with its `SimApp`: ```go -func SetupTestingApp(chainID string) (TestingApp, map[string]json.RawMessage) { +func SetupTestingApp() (TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := simapp.MakeTestEncodingConfig() app := simapp.NewSimApp( @@ -130,7 +130,6 @@ func SetupTestingApp(chainID string) (TestingApp, map[string]json.RawMessage) { 5, encCdc, simapp.EmptyAppOptions{}, - baseapp.SetChainID(chainID), ) return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) } @@ -276,7 +275,7 @@ import ( ibctesting "github.com/cosmos/ibc-go/v7/testing" ) -func SetupTransferTestingApp(chainID string) (ibctesting.TestingApp, map[string]json.RawMessage) { +func SetupTransferTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := simapp.MakeTestEncodingConfig() app := simapp.NewSimApp( @@ -289,7 +288,6 @@ func SetupTransferTestingApp(chainID string) (ibctesting.TestingApp, map[string] 5, encCdc, simapp.EmptyAppOptions{}, - baseapp.SetChainID(chainID), ) return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) } diff --git a/testing/app.go b/testing/app.go index 8eda31d2853..f277a5cd98a 100644 --- a/testing/app.go +++ b/testing/app.go @@ -50,10 +50,10 @@ type TestingApp interface { LastBlockHeight() int64 } -func SetupTestingApp(chainID string) (TestingApp, map[string]json.RawMessage) { +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{}, baseapp.SetChainID(chainID)) + app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, encCdc, simtestutil.EmptyAppOptions{}) return app, simapp.NewDefaultGenesisState(encCdc.Marshaler) } @@ -62,7 +62,10 @@ func SetupTestingApp(chainID string) (TestingApp, map[string]json.RawMessage) { // of one consensus engine unit (10^6) in the default token of the simapp from first genesis // account. A Nop logger is set in SimApp. func SetupWithGenesisValSet(t testing.TB, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, powerReduction math.Int, balances ...banktypes.Balance) TestingApp { - app, genesisState := DefaultTestingAppInit(chainID) + app, genesisState := DefaultTestingAppInit() + + // ensure baseapp has a chain-id set before running InitChain + baseapp.SetChainID(chainID)(app.GetBaseApp()) // set genesis accounts authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)