From 514953c0b244dd297511f395106077aed5f2e7d7 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Mon, 3 Apr 2023 15:18:48 +0900 Subject: [PATCH] feat: bump up line/ibc-go v3.3.2 (#21) * feat: bump up ibc * chore: change the import commit hash of ibc-go module to tag version (v3.3.2) * chore: update changelog --- CHANGELOG.md | 1 + go.mod | 2 +- go.sum | 4 ++-- x/wasm/ibctesting/chain.go | 32 ++++++++++++++++---------------- x/wasm/ibctesting/endpoint.go | 10 +++++----- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bac9c4f1a1..c782cfea40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/go.mod b/go.mod index 641e1a22b2..8bcbd728b7 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 90dfbfda7b..22a1c2546a 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index 82c447c853..7ebc996554 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -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" @@ -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. @@ -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 @@ -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{ @@ -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() { @@ -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 @@ -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 @@ -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, diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index b806b6149c..47080d4f1f 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -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" ) @@ -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, ) @@ -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())