Skip to content

Commit

Permalink
feat: bump up line/ibc-go v3.3.2 (#21)
Browse files Browse the repository at this point in the history
* feat: bump up ibc

* chore: change the import commit hash of ibc-go module to tag version (v3.3.2)

* chore: update changelog
  • Loading branch information
zemyblue authored Apr 3, 2023
1 parent 5c78b2d commit 514953c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

### Features
* [\#9](https://github.com/line/wasmd/pull/9) apply the changes of lbm-sdk and ostracon proto
* [\#21](https://github.com/line/wasmd/pull/21) bump up line/ibc-go v3.3.2

### Improvements
* [\#1](https://github.com/line/wasmd/pull/1) apply all changes of `x/wasm` in lbm-sdk until [lbm-sdk@3bdcb6ffe01c81615bedb777ca0e039cc46ef00c](https://github.com/line/lbm-sdk/tree/3bdcb6ffe01c81615bedb777ca0e039cc46ef00c)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/google/gofuzz v1.2.0
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/line/ibc-go/v3 v3.3.2-0.20230210040007-d855e1d87f26
github.com/line/ibc-go/v3 v3.3.2
github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597
github.com/line/ostracon v1.0.9-0.20230209043112-5aca894db3a6
github.com/line/wasmvm v1.1.1-0.11.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/line/ibc-go/v3 v3.3.2-0.20230210040007-d855e1d87f26 h1:uSnHy48K15ia3ceWxD++hPbaNdcR5TR5IVc3Ss1rGjc=
github.com/line/ibc-go/v3 v3.3.2-0.20230210040007-d855e1d87f26/go.mod h1:iIUVJLrKDzW/y1nrNQ3XyVrQ3FjNyd6fjgWTBbldAaQ=
github.com/line/ibc-go/v3 v3.3.2 h1:EgQ5NARjzm8oi6jyze6mfLwWQsMoNAUuq9mQh4IhsO0=
github.com/line/ibc-go/v3 v3.3.2/go.mod h1:iIUVJLrKDzW/y1nrNQ3XyVrQ3FjNyd6fjgWTBbldAaQ=
github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597 h1:J0Pr378D5JmHNjifZXVigAIunJXD2JDHJE/lY3tYTQc=
github.com/line/lbm-sdk v0.46.1-0.20230209105703-b88647308597/go.mod h1:Od+QeMi4JO4HB3HEdPTqzI7mAvn1w99PZ9pmKmtNDco=
github.com/line/ostracon v1.0.9-0.20230209043112-5aca894db3a6 h1:nuM0PTB04PCax35+u8LRpTufdmwoPZcBhhKjqbezMYA=
Expand Down
32 changes: 16 additions & 16 deletions x/wasm/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
host "github.com/line/ibc-go/v3/modules/core/24-host"
"github.com/line/ibc-go/v3/modules/core/exported"
"github.com/line/ibc-go/v3/modules/core/types"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types"
ibctmtypes "github.com/line/ibc-go/v3/modules/light-clients/07-tendermint/types"
"github.com/line/ibc-go/v3/testing/mock"
"github.com/line/lbm-sdk/client"
"github.com/line/lbm-sdk/codec"
Expand All @@ -41,7 +41,7 @@ import (
"github.com/line/wasmd/x/wasm"
)

// TestChain is a testing struct that wraps a simapp with the last OC Header, the current ABCI
// TestChain is a testing struct that wraps a simapp with the last TM Header, the current ABCI
// header and the validators of the TestChain. It also contains a field called ChainID. This
// is the clientID that *other* chains use to refer to this TestChain. The SenderAccount
// is used for delivering transactions through the application state.
Expand All @@ -52,7 +52,7 @@ type TestChain struct {
Coordinator *Coordinator
App *app.WasmApp
ChainID string
LastHeader *ibcoctypes.Header // header for last block height committed
LastHeader *ibctmtypes.Header // header for last block height committed
CurrentHeader tmproto.Header // header for current block height
QueryServer types.QueryServer
TxConfig client.TxConfig
Expand Down Expand Up @@ -213,7 +213,7 @@ func (chain *TestChain) QueryConsensusStateProof(clientID string) ([]byte, clien
func (chain *TestChain) NextBlock() {
// set the last header to the current header
// use nil trusted fields
chain.LastHeader = chain.CurrentOCClientHeader()
chain.LastHeader = chain.CurrentTMClientHeader()

// increment the current header
chain.CurrentHeader = tmproto.Header{
Expand Down Expand Up @@ -341,15 +341,15 @@ func (chain *TestChain) GetPrefix() commitmenttypes.MerklePrefix {
return commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes())
}

// ConstructUpdateOCClientHeader will construct a valid 99-ostracon Header to update the
// ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the
// light client on the source chain.
func (chain *TestChain) ConstructUpdateOCClientHeader(counterparty *TestChain, clientID string) (*ibcoctypes.Header, error) {
return chain.ConstructUpdateOCClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight())
func (chain *TestChain) ConstructUpdateTMClientHeader(counterparty *TestChain, clientID string) (*ibctmtypes.Header, error) {
return chain.ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight())
}

// ConstructUpdateOCClientHeader will construct a valid 99-ostracon Header to update the
// ConstructUpdateTMClientHeaderWithTrustedHeight will construct a valid 07-tendermint Header to update the
// light client on the source chain.
func (chain *TestChain) ConstructUpdateOCClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibcoctypes.Header, error) {
func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibctmtypes.Header, error) {
header := counterparty.LastHeader
// Relayer must query for LatestHeight on client to get TrustedHeight if the trusted height is not set
if trustedHeight.IsZero() {
Expand All @@ -371,7 +371,7 @@ func (chain *TestChain) ConstructUpdateOCClientHeaderWithTrustedHeight(counterpa
// NextValidatorsHash
tmTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.RevisionHeight + 1))
if !ok {
return nil, sdkerrors.Wrapf(ibcoctypes.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight)
return nil, sdkerrors.Wrapf(ibctmtypes.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight)
}
}
// inject trusted fields into last header
Expand All @@ -393,15 +393,15 @@ func (chain *TestChain) ExpireClient(amount time.Duration) {
chain.Coordinator.IncrementTimeBy(amount)
}

// CurrentOCClientHeader creates a OC header using the current header parameters
// CurrentTMClientHeader creates a TM header using the current header parameters
// on the chain. The trusted fields in the header are set to nil.
func (chain *TestChain) CurrentOCClientHeader() *ibcoctypes.Header {
return chain.CreateOCClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, nil, chain.Signers)
func (chain *TestChain) CurrentTMClientHeader() *ibctmtypes.Header {
return chain.CreateTMClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, nil, chain.Signers)
}

// CreateOCClientHeader creates a OC header to update the OC client. Args are passed in to allow
// CreateTMClientHeader creates a TM header to update the TM client. Args are passed in to allow
// caller flexibility to use params that differ from the chain.
func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, tmTrustedVals *octypes.ValidatorSet, signers []octypes.PrivValidator) *ibcoctypes.Header {
func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, tmTrustedVals *octypes.ValidatorSet, signers []octypes.PrivValidator) *ibctmtypes.Header {
var (
valSet *tmproto.ValidatorSet
trustedVals *tmproto.ValidatorSet
Expand Down Expand Up @@ -450,7 +450,7 @@ func (chain *TestChain) CreateOCClientHeader(chainID string, blockHeight int64,

// The trusted fields may be nil. They may be filled before relaying messages to a client.
// The relayer is responsible for querying client and injecting appropriate trusted fields.
return &ibcoctypes.Header{
return &ibctmtypes.Header{
SignedHeader: signedHeader,
ValidatorSet: valSet,
TrustedHeight: trustedHeight,
Expand Down
10 changes: 5 additions & 5 deletions x/wasm/ibctesting/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
commitmenttypes "github.com/line/ibc-go/v3/modules/core/23-commitment/types"
host "github.com/line/ibc-go/v3/modules/core/24-host"
"github.com/line/ibc-go/v3/modules/core/exported"
ibcoctypes "github.com/line/ibc-go/v3/modules/light-clients/99-ostracon/types"
ibctmtypes "github.com/line/ibc-go/v3/modules/light-clients/07-tendermint/types"
ibctesting "github.com/line/ibc-go/v3/testing"
)

Expand Down Expand Up @@ -86,12 +86,12 @@ func (endpoint *Endpoint) CreateClient() (err error) {
)

switch endpoint.ClientConfig.GetClientType() {
case exported.Ostracon:
case exported.Tendermint:
tmConfig, ok := endpoint.ClientConfig.(*ibctesting.OstraconConfig)
require.True(endpoint.Chain.t, ok)

height := endpoint.Counterparty.Chain.LastHeader.GetHeight().(clienttypes.Height)
clientState = ibcoctypes.NewClientState(
clientState = ibctmtypes.NewClientState(
endpoint.Counterparty.Chain.ChainID, tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift,
height, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, tmConfig.AllowUpdateAfterExpiry, tmConfig.AllowUpdateAfterMisbehaviour,
)
Expand Down Expand Up @@ -134,8 +134,8 @@ func (endpoint *Endpoint) UpdateClient() (err error) {
var header exported.Header

switch endpoint.ClientConfig.GetClientType() {
case exported.Ostracon:
header, err = endpoint.Chain.ConstructUpdateOCClientHeader(endpoint.Counterparty.Chain, endpoint.ClientID)
case exported.Tendermint:
header, err = endpoint.Chain.ConstructUpdateTMClientHeader(endpoint.Counterparty.Chain, endpoint.ClientID)

default:
err = fmt.Errorf("client type %s is not supported", endpoint.ClientConfig.GetClientType())
Expand Down

0 comments on commit 514953c

Please sign in to comment.