Skip to content

Commit

Permalink
fix: revert api break with alternative fix (#3297)
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-axner authored Mar 15, 2023
1 parent 04ba7fb commit 2b202cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
9 changes: 0 additions & 9 deletions docs/migrations/v6-to-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
}
Expand Down Expand Up @@ -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(
Expand All @@ -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)
}
Expand Down
9 changes: 6 additions & 3 deletions testing/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
Expand Down

0 comments on commit 2b202cc

Please sign in to comment.