Skip to content

Commit

Permalink
Merge branch 'main' into carlos/fix-package-import
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega authored Mar 1, 2022
2 parents e522ad8 + e1be19b commit e6e6b5c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 54 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* [\#404](https://github.com/cosmos/ibc-go/pull/404) Bump Go version to 1.17
* [\#851](https://github.com/cosmos/ibc-go/pull/851) Bump SDK version to v0.45.1
* [\#948](https://github.com/cosmos/ibc-go/pull/948) Bump ics23/go to v0.7
* (core) [\#709](https://github.com/cosmos/ibc-go/pull/709) Replace github.com/pkg/errors with stdlib errors

### API Breaking
Expand Down Expand Up @@ -85,6 +86,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (testing) [\#884](https://github.com/cosmos/ibc-go/pull/884) Add and use in simapp a custom ante handler that rejects redundant transactions
* (transfer) [\#978](https://github.com/cosmos/ibc-go/pull/978) Support base denoms with slashes in denom validation
* (client) [\#941](https://github.com/cosmos/ibc-go/pull/941) Classify client states without consensus states as expired

## [v2.0.2](https://github.com/cosmos/ibc-go/releases/tag/v2.0.2) - 2021-12-15

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alp

require (
github.com/armon/go-metrics v0.3.10
github.com/confio/ics23/go v0.6.6
github.com/confio/ics23/go v0.7.0
github.com/cosmos/cosmos-sdk v0.45.1
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg=
github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE=
github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8=
github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/confio/ics23/go v0.7.0 h1:00d2kukk7sPoHWL4zZBZwzxnpA2pec1NPdwbSokJ5w8=
github.com/confio/ics23/go v0.7.0/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
Expand Down
41 changes: 19 additions & 22 deletions testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ import (
"github.com/cosmos/ibc-go/v3/testing/simapp"
)

var (
MaxAccounts = 10
)
var MaxAccounts = 10

type SenderAccount struct {
SenderPrivKey cryptotypes.PrivKey
Expand All @@ -51,7 +49,7 @@ type SenderAccount struct {
// is used for delivering transactions through the application state.
// NOTE: the actual application uses an empty chain-id for ease of testing.
type TestChain struct {
t *testing.T
*testing.T

Coordinator *Coordinator
App TestingApp
Expand Down Expand Up @@ -88,7 +86,6 @@ type TestChain struct {
// CONTRACT: Validator and signer array must be provided in the order expected by Tendermint.
// i.e. sorted first by power and then lexicographically by address.
func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, valSet *tmtypes.ValidatorSet, signers []tmtypes.PrivValidator) *TestChain {

genAccs := []authtypes.GenesisAccount{}
genBals := []banktypes.Balance{}
senderAccs := []SenderAccount{}
Expand Down Expand Up @@ -129,7 +126,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va

// create an account to send transactions from
chain := &TestChain{
t: t,
T: t,
Coordinator: coord,
ChainID: chainID,
App: app,
Expand Down Expand Up @@ -191,7 +188,7 @@ func (chain *TestChain) GetContext() sdk.Context {
// their own SimApp.
func (chain *TestChain) GetSimApp() *simapp.SimApp {
app, ok := chain.App.(*simapp.SimApp)
require.True(chain.t, ok)
require.True(chain.T, ok)

return app
}
Expand All @@ -213,10 +210,10 @@ func (chain *TestChain) QueryProofAtHeight(key []byte, height int64) ([]byte, cl
})

merkleProof, err := commitmenttypes.ConvertProofs(res.ProofOps)
require.NoError(chain.t, err)
require.NoError(chain.T, err)

proof, err := chain.App.AppCodec().Marshal(&merkleProof)
require.NoError(chain.t, err)
require.NoError(chain.T, err)

revision := clienttypes.ParseChainID(chain.ChainID)

Expand All @@ -237,10 +234,10 @@ func (chain *TestChain) QueryUpgradeProof(key []byte, height uint64) ([]byte, cl
})

merkleProof, err := commitmenttypes.ConvertProofs(res.ProofOps)
require.NoError(chain.t, err)
require.NoError(chain.T, err)

proof, err := chain.App.AppCodec().Marshal(&merkleProof)
require.NoError(chain.t, err)
require.NoError(chain.T, err)

revision := clienttypes.ParseChainID(chain.ChainID)

Expand Down Expand Up @@ -300,7 +297,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
chain.Coordinator.UpdateTimeForChain(chain)

_, r, err := simapp.SignAndDeliver(
chain.t,
chain.T,
chain.TxConfig,
chain.App.GetBaseApp(),
chain.GetContext().BlockHeader(),
Expand Down Expand Up @@ -329,7 +326,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
// expected to exist otherwise testing will fail.
func (chain *TestChain) GetClientState(clientID string) exported.ClientState {
clientState, found := chain.App.GetIBCKeeper().ClientKeeper.GetClientState(chain.GetContext(), clientID)
require.True(chain.t, found)
require.True(chain.T, found)

return clientState
}
Expand Down Expand Up @@ -361,7 +358,7 @@ func (chain *TestChain) GetValsAtHeight(height int64) (*tmtypes.ValidatorSet, bo
// acknowledgement does not exist then testing will fail.
func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte {
ack, found := chain.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(chain.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
require.True(chain.t, found)
require.True(chain.T, found)

return ack
}
Expand Down Expand Up @@ -436,7 +433,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
valSet *tmproto.ValidatorSet
trustedVals *tmproto.ValidatorSet
)
require.NotNil(chain.t, tmValSet)
require.NotNil(chain.T, tmValSet)

vsetHash := tmValSet.Hash()

Expand All @@ -461,7 +458,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
voteSet := tmtypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet)

commit, err := tmtypes.MakeCommit(blockID, blockHeight, 1, voteSet, signers, timestamp)
require.NoError(chain.t, err)
require.NoError(chain.T, err)

signedHeader := &tmproto.SignedHeader{
Header: tmHeader.ToProto(),
Expand Down Expand Up @@ -533,11 +530,11 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope
if !ok {
// create capability using the IBC capability keeper
cap, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), host.PortPath(portID))
require.NoError(chain.t, err)
require.NoError(chain.T, err)

// claim capability using the scopedKeeper
err = scopedKeeper.ClaimCapability(chain.GetContext(), cap, host.PortPath(portID))
require.NoError(chain.t, err)
require.NoError(chain.T, err)
}

chain.App.Commit()
Expand All @@ -549,7 +546,7 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope
// exist, otherwise testing will fail.
func (chain *TestChain) GetPortCapability(portID string) *capabilitytypes.Capability {
cap, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.PortPath(portID))
require.True(chain.t, ok)
require.True(chain.T, ok)

return cap
}
Expand All @@ -563,9 +560,9 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc
_, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), capName)
if !ok {
cap, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), capName)
require.NoError(chain.t, err)
require.NoError(chain.T, err)
err = scopedKeeper.ClaimCapability(chain.GetContext(), cap, capName)
require.NoError(chain.t, err)
require.NoError(chain.T, err)
}

chain.App.Commit()
Expand All @@ -577,7 +574,7 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc
// The capability must exist, otherwise testing will fail.
func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabilitytypes.Capability {
cap, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID))
require.True(chain.t, ok)
require.True(chain.T, ok)

return cap
}
26 changes: 13 additions & 13 deletions testing/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
// Coordinator is a testing struct which contains N TestChain's. It handles keeping all chains
// in sync with regards to time.
type Coordinator struct {
t *testing.T
*testing.T

CurrentTime time.Time
Chains map[string]*TestChain
Expand All @@ -29,7 +29,7 @@ type Coordinator struct {
func NewCoordinator(t *testing.T, n int) *Coordinator {
chains := make(map[string]*TestChain)
coord := &Coordinator{
t: t,
T: t,
CurrentTime: globalStartTime,
}

Expand Down Expand Up @@ -84,10 +84,10 @@ func (coord *Coordinator) Setup(path *Path) {
// caller does not anticipate any errors.
func (coord *Coordinator) SetupClients(path *Path) {
err := path.EndpointA.CreateClient()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointB.CreateClient()
require.NoError(coord.t, err)
require.NoError(coord.T, err)
}

// SetupClientConnections is a helper function to create clients and the appropriate
Expand All @@ -105,16 +105,16 @@ func (coord *Coordinator) SetupConnections(path *Path) {
// successfully opened otherwise testing will fail.
func (coord *Coordinator) CreateConnections(path *Path) {
err := path.EndpointA.ConnOpenInit()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointB.ConnOpenTry()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointA.ConnOpenAck()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointB.ConnOpenConfirm()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

// ensure counterparty is up to date
path.EndpointA.UpdateClient()
Expand Down Expand Up @@ -146,16 +146,16 @@ func (coord *Coordinator) CreateTransferChannels(path *Path) {
// opened otherwise testing will fail.
func (coord *Coordinator) CreateChannels(path *Path) {
err := path.EndpointA.ChanOpenInit()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointB.ChanOpenTry()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointA.ChanOpenAck()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

err = path.EndpointB.ChanOpenConfirm()
require.NoError(coord.t, err)
require.NoError(coord.T, err)

// ensure counterparty is up to date
path.EndpointA.UpdateClient()
Expand All @@ -165,7 +165,7 @@ func (coord *Coordinator) CreateChannels(path *Path) {
// not exist.
func (coord *Coordinator) GetChain(chainID string) *TestChain {
chain, found := coord.Chains[chainID]
require.True(coord.t, found, fmt.Sprintf("%s chain does not exist", chainID))
require.True(coord.T, found, fmt.Sprintf("%s chain does not exist", chainID))
return chain
}

Expand Down
Loading

0 comments on commit e6e6b5c

Please sign in to comment.