Skip to content

Commit 8dfbc9c

Browse files
ramacarluchocolin-axnerseantkingdependabot[bot]damiannolan
authored
fix: support custom chain IDs for testing (#774)
* Backport commits from main to v3 release branch (#682) * reorganize channel handshake handler (#647) * reorganize channel handshake handler split out channel state changes into its own function. * readjust 27-interchain-accounts to not rely on state being set before the application callback * add changelog and migration doc entry * Update modules/core/04-channel/keeper/handshake.go * docs: ICA Overview (#626) * docs: ica overview * fix: ordering * add spacing * fix: spacing * fix: remove bulletpoints * fix: wording * update go mod for security vulnerabilities (#655) * update go mod for security vulnerabilities * update package-lock.json * update vue dependency (#662) * bump glob-parent version in json package (#663) * build(deps): bump actions/setup-go from 2.1.4 to 2.1.5 (#656) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.4 to 2.1.5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v2.1.4...v2.1.5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: colin axnér <[email protected]> * docs: begin removal of internal "spec" directories (#634) * begin removal of spec docs within core ibc * remove broken link * Apply suggestions from code review Co-authored-by: Damian Nolan <[email protected]> * remove broken link * remove broken links * Apply suggestions from code review Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: Damian Nolan <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]> * Modify `OnChanOpenTry` application callback to perform app version negotitation (#646) * remove NegotiateAppVersion and AppVersion gRPC (#643) The NegotiateAppVersion callback has been removed from the IBC Application interface. The gRPC AppVersion has been removed. The app version negoitation will be handled by applications by returning the version in OnChanOpenTry. * Modify `OnChanOpenTry` to return application version (#650) * modify OnChanOpenTry to return negotiated version modify IBCModule interface function OnChanOpenTry to return the negotiated app version. Tests have not been updated * fix ibc_module_test.go tests * fix tests * Apply suggestions from code review * add handshake test case * add CHANGELOG and migration docs * update documentation * fix broken link * fix broken link (#664) * chore: update make build-docs, add docs build checker (#667) * update Makefile, add docs build checker * Update .github/workflows/check-docs.yml Co-authored-by: Marko <[email protected]> Co-authored-by: Marko <[email protected]> * register ICA query server, fix panics in params query cli (#666) Register the controller and host query servers to a chain. Returns an error upon cli params query failure instead of panicing. * update of roadmap with latest release (#653) * update of roadmap with latest release and changed the way release versions are encoded * fixed typo Co-authored-by: Carlos Rodriguez <[email protected]> * build(deps): bump actions/checkout from 2.3.1 to 2.4.0 (#672) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2.3.1...v2.4.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * allow ics20 to connect to middleware (#675) * allow ics20 to connect to middleware Creates ics4Wrapper which allows middleware applications to only implement SendPacket to connect ics20 as an application in its middleware stack * add changelog and migration doc * fix migration doc spelling * fix: register InterchainAccount as x/auth GenesisAccount (#676) * adding GenesisAccount interface registration for InterchainAccount impl * updating RegisterInterfaces ica godoc * enable mergify for backports (#678) Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: Sean King <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damian Nolan <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]> * fixes evmos tests * cleanup * changelog and cleanup * pr suggestions. bump chainid Co-authored-by: colin axnér <[email protected]> Co-authored-by: Sean King <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damian Nolan <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: Carlos Rodriguez <[email protected]> Co-authored-by: Federico Kunze Küllmer <[email protected]>
1 parent 1da4885 commit 8dfbc9c

File tree

25 files changed

+53
-51
lines changed

25 files changed

+53
-51
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4343

4444
### API Breaking
4545

46+
* (testing) [\#774](https://github.com/cosmos/ibc-go/pull/774) Added `ChainID` arg to `SetupWithGenesisValSet` on the testing app. `Coordinator` generated ChainIDs now starts at index 1
4647
* (transfer) [\#675](https://github.com/cosmos/ibc-go/pull/675) Transfer `NewKeeper` now takes in an ICS4Wrapper. The ICS4Wrapper may be the IBC Channel Keeper when ICS20 is not used in a middleware stack. The ICS4Wrapper is required for applications wishing to connect middleware to ICS20.
4748
* (core) [\#650](https://github.com/cosmos/ibc-go/pull/650) Modify `OnChanOpenTry` IBC application module callback to return the negotiated app version. The version passed into the `MsgChanOpenTry` has been deprecated and will be ignored by core IBC.
4849
* (core) [\#629](https://github.com/cosmos/ibc-go/pull/629) Removes the `GetProofSpecs` from the ClientState interface. This function was previously unused by core IBC.

modules/apps/27-interchain-accounts/controller/ibc_module_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func TestICATestSuite(t *testing.T) {
5454

5555
func (suite *InterchainAccountsTestSuite) SetupTest() {
5656
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
57-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
58-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
57+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
58+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
5959
}
6060

6161
func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ type KeeperTestSuite struct {
4747

4848
func (suite *KeeperTestSuite) SetupTest() {
4949
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
50-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
51-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
52-
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(2))
50+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
51+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
52+
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3))
5353
}
5454

5555
func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/apps/27-interchain-accounts/host/ibc_module_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func TestICATestSuite(t *testing.T) {
5656

5757
func (suite *InterchainAccountsTestSuite) SetupTest() {
5858
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
59-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
60-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
59+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
60+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
6161
}
6262

6363
func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/apps/27-interchain-accounts/host/keeper/keeper_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ type KeeperTestSuite struct {
4747

4848
func (suite *KeeperTestSuite) SetupTest() {
4949
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
50-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
51-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
52-
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(2))
50+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
51+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
52+
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3))
5353
}
5454

5555
func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/apps/27-interchain-accounts/types/account_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type TypesTestSuite struct {
3434
func (suite *TypesTestSuite) SetupTest() {
3535
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
3636

37-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
38-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
37+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
38+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3939
}
4040

4141
func TestTypesTestSuite(t *testing.T) {

modules/apps/transfer/keeper/keeper_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ type KeeperTestSuite struct {
2727

2828
func (suite *KeeperTestSuite) SetupTest() {
2929
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
30-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
31-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
32-
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(2))
30+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
31+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
32+
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3))
3333

3434
queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
3535
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().TransferKeeper)

modules/apps/transfer/transfer_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ type TransferTestSuite struct {
2525

2626
func (suite *TransferTestSuite) SetupTest() {
2727
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
28-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
29-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
30-
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(2))
28+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
29+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
30+
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3))
3131
}
3232

3333
func NewTransferPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {

modules/core/02-client/abci_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ type ClientTestSuite struct {
2828
func (suite *ClientTestSuite) SetupTest() {
2929
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
3030

31-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
32-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
31+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
32+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3333

3434
// set localhost client
3535
revision := types.ParseChainID(suite.chainA.GetContext().ChainID())

modules/core/02-client/keeper/keeper_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ type KeeperTestSuite struct {
7373
func (suite *KeeperTestSuite) SetupTest() {
7474
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
7575

76-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
77-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
76+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
77+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
7878

7979
isCheckTx := false
8080
suite.now = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)

modules/core/02-client/legacy/v100/store_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func TestLegacyTestSuite(t *testing.T) {
3232
// SetupTest creates a coordinator with 2 test chains.
3333
func (suite *LegacyTestSuite) SetupTest() {
3434
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
35-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
36-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
35+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
36+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3737
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)
3838
suite.coordinator.CommitNBlocks(suite.chainA, 2)
3939
suite.coordinator.CommitNBlocks(suite.chainB, 2)

modules/core/02-client/types/msgs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type TypesTestSuite struct {
2626

2727
func (suite *TypesTestSuite) SetupTest() {
2828
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
29-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
30-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
29+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
30+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3131
}
3232

3333
func TestTypesTestSuite(t *testing.T) {

modules/core/03-connection/keeper/keeper_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type KeeperTestSuite struct {
2222

2323
func (suite *KeeperTestSuite) SetupTest() {
2424
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
25-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
26-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
25+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
26+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
2727
}
2828

2929
func TestKeeperTestSuite(t *testing.T) {

modules/core/03-connection/types/msgs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ type MsgTestSuite struct {
4141
func (suite *MsgTestSuite) SetupTest() {
4242
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
4343

44-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
45-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
44+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
45+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
4646

4747
app := simapp.Setup(false)
4848
db := dbm.NewMemDB()

modules/core/04-channel/keeper/keeper_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func TestKeeperTestSuite(t *testing.T) {
2828
// SetupTest creates a coordinator with 2 test chains.
2929
func (suite *KeeperTestSuite) SetupTest() {
3030
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
31-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
32-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
31+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
32+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3333
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)
3434
suite.coordinator.CommitNBlocks(suite.chainA, 2)
3535
suite.coordinator.CommitNBlocks(suite.chainB, 2)

modules/core/ante/ante_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ type AnteTestSuite struct {
2828
// SetupTest creates a coordinator with 2 test chains.
2929
func (suite *AnteTestSuite) SetupTest() {
3030
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
31-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
32-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
31+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
32+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3333
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)
3434
suite.coordinator.CommitNBlocks(suite.chainA, 2)
3535
suite.coordinator.CommitNBlocks(suite.chainB, 2)

modules/core/genesis_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ type IBCTestSuite struct {
5050
func (suite *IBCTestSuite) SetupTest() {
5151
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
5252

53-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
54-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
53+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
54+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
5555
}
5656

5757
func TestIBCTestSuite(t *testing.T) {

modules/core/keeper/msg_server_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ type KeeperTestSuite struct {
3838
func (suite *KeeperTestSuite) SetupTest() {
3939
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
4040

41-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
42-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
41+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
42+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
4343

4444
// TODO: remove
4545
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)

modules/core/legacy/v100/genesis_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func TestLegacyTestSuite(t *testing.T) {
3838
// SetupTest creates a coordinator with 2 test chains.
3939
func (suite *LegacyTestSuite) SetupTest() {
4040
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
41-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
42-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
41+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
42+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
4343
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)
4444
suite.coordinator.CommitNBlocks(suite.chainA, 2)
4545
suite.coordinator.CommitNBlocks(suite.chainB, 2)

modules/light-clients/06-solomachine/types/solomachine_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type SoloMachineTestSuite struct {
3434

3535
func (suite *SoloMachineTestSuite) SetupTest() {
3636
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
37-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
38-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
37+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
38+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
3939

4040
suite.solomachine = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinesingle", "testing", 1)
4141
suite.solomachineMulti = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinemulti", "testing", 4)

modules/light-clients/07-tendermint/types/tendermint_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ type TendermintTestSuite struct {
5757

5858
func (suite *TendermintTestSuite) SetupTest() {
5959
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)
60-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
61-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
60+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
61+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
6262
// commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1)
6363
suite.coordinator.CommitNBlocks(suite.chainA, 2)
6464
suite.coordinator.CommitNBlocks(suite.chainB, 2)

testing/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ func TestKeeperTestSuite(t *testing.T) {
155155
// SetupTest creates a coordinator with 2 test chains.
156156
func (suite *KeeperTestSuite) SetupTest() {
157157
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) // initializes 2 test chains
158-
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0)) // convenience and readability
159-
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) // convenience and readability
158+
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) // convenience and readability
159+
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) // convenience and readability
160160
}
161161

162162
```

testing/app.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func SetupTestingApp() (TestingApp, map[string]json.RawMessage) {
5858
// that also act as delegators. For simplicity, each validator is bonded with a delegation
5959
// of one consensus engine unit (10^6) in the default token of the simapp from first genesis
6060
// account. A Nop logger is set in SimApp.
61-
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) TestingApp {
61+
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, balances ...banktypes.Balance) TestingApp {
6262
app, genesisState := DefaultTestingAppInit()
6363
// set genesis accounts
6464
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
@@ -117,6 +117,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
117117
// init chain will set the validator set and initialize the genesis accounts
118118
app.InitChain(
119119
abci.RequestInitChain{
120+
ChainId: chainID,
120121
Validators: []abci.ValidatorUpdate{},
121122
ConsensusParams: simapp.DefaultConsensusParams,
122123
AppStateBytes: stateBytes,
@@ -126,6 +127,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
126127
// commit genesis changes
127128
app.Commit()
128129
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{
130+
ChainID: chainID,
129131
Height: app.LastBlockHeight() + 1,
130132
AppHash: app.LastCommitID().Hash,
131133
ValidatorsHash: valSet.Hash(),

testing/chain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func NewTestChain(t *testing.T, coord *Coordinator, chainID string) *TestChain {
9090
Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amount)),
9191
}
9292

93-
app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, balance)
93+
app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, chainID, balance)
9494

9595
// create current header and call begin block
9696
header := tmproto.Header{

testing/coordinator.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import (
1010
abci "github.com/tendermint/tendermint/abci/types"
1111
)
1212

13-
const ChainIDPrefix = "testchain"
14-
1513
var (
14+
ChainIDPrefix = "testchain"
1615
globalStartTime = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)
1716
TimeIncrement = time.Second * 5
1817
)
@@ -34,7 +33,7 @@ func NewCoordinator(t *testing.T, n int) *Coordinator {
3433
CurrentTime: globalStartTime,
3534
}
3635

37-
for i := 0; i < n; i++ {
36+
for i := 1; i <= n; i++ {
3837
chainID := GetChainID(i)
3938
chains[chainID] = NewTestChain(t, coord, chainID)
4039
}

0 commit comments

Comments
 (0)