Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.3: update ibc-go to v4.0.0 #74

Merged
merged 16 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
.vscode/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ The Relayer uses "vX.Y.Z" as its version format. "v0.Y.Z" will be used until the

In addition, "Y" corresponds to the specific major version of ibc-go (i.e., "X"). The following table shows the Relayer version and its corresponding ibc-go version.

| Relayer | ibc-go |
|---------|--------------|
| v0.2.0 | v1.0.0-beta1 |

| Relayer | ibc-go |
|-------------------------------------------------------------------------------|--------------|
| v0.3.0(current branch) | v4.0.0 |
| [v0.2.0](https://github.com/hyperledger-labs/yui-relayer/releases/tag/v0.2.0) | v1.0.0-beta1 |

## Glossary

Expand Down
6 changes: 3 additions & 3 deletions chains/tendermint/client-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
tmclient "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
tmclient "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/light"
)
Expand Down
2 changes: 1 addition & 1 deletion chains/tendermint/cmd/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"

"github.com/cosmos/cosmos-sdk/client/flags"
tmclient "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
tmclient "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
"github.com/hyperledger-labs/yui-relayer/chains/tendermint"
"github.com/hyperledger-labs/yui-relayer/config"
"github.com/spf13/cobra"
Expand Down
10 changes: 2 additions & 8 deletions chains/tendermint/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions chains/tendermint/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"path/filepath"

"github.com/avast/retry-go"
tmclient "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
tmclient "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/light"
lightp "github.com/tendermint/tendermint/light/provider"
Expand Down Expand Up @@ -164,10 +164,12 @@ func (pr *Prover) GetLightSignedHeaderAtHeight(height int64) (*tmclient.Header,
return nil, err
}

protoVal, err := tmtypes.NewValidatorSet(sh.ValidatorSet.Validators).ToProto()
valSet := tmtypes.NewValidatorSet(sh.ValidatorSet.Validators)
protoVal, err := valSet.ToProto()
if err != nil {
return nil, err
}
protoVal.TotalVotingPower = valSet.TotalVotingPower()
siburu marked this conversation as resolved.
Show resolved Hide resolved

return &tmclient.Header{SignedHeader: sh.SignedHeader.ToProto(), ValidatorSet: protoVal}, nil
}
Expand Down
8 changes: 4 additions & 4 deletions chains/tendermint/log-chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"strings"

sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
proto "github.com/gogo/protobuf/proto"
)

Expand Down
34 changes: 20 additions & 14 deletions chains/tendermint/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/modules/core/exported"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
tmclient "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/v4/modules/core/exported"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
tmclient "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
"github.com/tendermint/tendermint/light"
tmtypes "github.com/tendermint/tendermint/types"

Expand Down Expand Up @@ -78,13 +78,18 @@ func (pr *Prover) QueryPacketAcknowledgementCommitmentWithProof(height int64, se
return pr.chain.queryPacketAcknowledgementCommitment(height, seq, true)
}

// QueryHeader returns the header corresponding to the height
func (pr *Prover) QueryHeader(height int64) (out core.HeaderI, err error) {
return pr.queryHeaderAtHeight(height)
}

// QueryLatestHeader returns the latest header from the chain
func (pr *Prover) QueryLatestHeader() (out core.HeaderI, err error) {
var h int64
if h, err = pr.chain.GetLatestHeight(); err != nil {
return nil, err
}
return pr.queryHeaderAtHeight(h)
return pr.QueryHeader(h)
}

// GetLatestLightHeight uses the CLI utilities to pull the latest height from a given chain
Expand Down Expand Up @@ -187,20 +192,19 @@ func (pr *Prover) UpdateLightWithHeader() (header core.HeaderI, provableHeight i
}
}

protoVal, err := tmtypes.NewValidatorSet(sh.ValidatorSet.Validators).ToProto()
valSet := tmtypes.NewValidatorSet(sh.ValidatorSet.Validators)
protoVal, err := valSet.ToProto()
if err != nil {
return nil, 0, 0, err
}
protoVal.TotalVotingPower = valSet.TotalVotingPower()

h := &tmclient.Header{
SignedHeader: sh.SignedHeader.ToProto(),
ValidatorSet: protoVal,
}
queryableHeight = int64(h.GetHeight().GetRevisionHeight())
// NOTE: We query connection at height - 1 because of the way tendermint returns
// proofs the commit for height n is contained in the header of height n + 1
provableHeight = queryableHeight - 1
return h, provableHeight, queryableHeight, nil
height := int64(h.GetHeight().GetRevisionHeight())
return h, height, height, nil
siburu marked this conversation as resolved.
Show resolved Hide resolved
}

// TrustOptions returns light.TrustOptions given a height and hash
Expand Down Expand Up @@ -240,10 +244,12 @@ func (c *Prover) queryHeaderAtHeight(height int64) (*tmclient.Header, error) {
return nil, err
}

protoVal, err := tmtypes.NewValidatorSet(val.Validators).ToProto()
valSet := tmtypes.NewValidatorSet(val.Validators)
protoVal, err := valSet.ToProto()
if err != nil {
return nil, err
}
protoVal.TotalVotingPower = valSet.TotalVotingPower()

return &tmclient.Header{
// NOTE: This is not a SignedHeader
Expand Down
25 changes: 15 additions & 10 deletions chains/tendermint/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import (
querytypes "github.com/cosmos/cosmos-sdk/types/query"
bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
transfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
clientutils "github.com/cosmos/ibc-go/modules/core/02-client/client/utils"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
connutils "github.com/cosmos/ibc-go/modules/core/03-connection/client/utils"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chanutils "github.com/cosmos/ibc-go/modules/core/04-channel/client/utils"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
committypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
clientutils "github.com/cosmos/ibc-go/v4/modules/core/02-client/client/utils"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
connutils "github.com/cosmos/ibc-go/v4/modules/core/03-connection/client/utils"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chanutils "github.com/cosmos/ibc-go/v4/modules/core/04-channel/client/utils"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
committypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
"github.com/hyperledger-labs/yui-relayer/core"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand Down Expand Up @@ -323,7 +323,12 @@ func (c *Chain) QueryValsetAtHeight(height clienttypes.Height) (*tmproto.Validat
}
tmValSet.GetProposer()

return tmValSet.ToProto()
protoValSet, err := tmValSet.ToProto()
if err != nil {
return nil, err
}
protoValSet.TotalVotingPower = tmValSet.TotalVotingPower()
return protoValSet, err
}

func (c *Chain) toTmValidators(vals stakingtypes.Validators) ([]*tmtypes.Validator, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/modules/core/exported"
"github.com/cosmos/ibc-go/v4/modules/core/exported"
"github.com/hyperledger-labs/yui-relayer/config"
"github.com/hyperledger-labs/yui-relayer/core"
"github.com/hyperledger-labs/yui-relayer/helpers"
Expand Down
5 changes: 3 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ func Execute(modules ...config.ModuleI) error {

cobra.EnableCommandSorting = false
rootCmd.SilenceUsage = true
rootCmd.SilenceErrors = true

// Register top level flags --home and --debug
rootCmd.PersistentFlags().StringVar(&homePath, flags.FlagHome, defaultHome, "set home directory")
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "debug output")
if err := viper.BindPFlag(flags.FlagHome, rootCmd.Flags().Lookup(flags.FlagHome)); err != nil {
if err := viper.BindPFlag(flags.FlagHome, rootCmd.PersistentFlags().Lookup(flags.FlagHome)); err != nil {
return err
}
if err := viper.BindPFlag("debug", rootCmd.Flags().Lookup("debug")); err != nil {
if err := viper.BindPFlag("debug", rootCmd.PersistentFlags().Lookup("debug")); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/xfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
"github.com/hyperledger-labs/yui-relayer/config"
"github.com/hyperledger-labs/yui-relayer/core"
"github.com/spf13/cobra"
Expand Down
10 changes: 5 additions & 5 deletions core/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
)

// ProvableChain represents a chain that is supported by the relayer
Expand Down
2 changes: 1 addition & 1 deletion core/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

retry "github.com/avast/retry-go"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
)

// CreateChannel runs the channel creation messages on timeout until they pass
Expand Down
4 changes: 2 additions & 2 deletions core/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
transfer "github.com/cosmos/ibc-go/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/modules/core"
transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
)

var moduleBasics = module.NewBasicManager(
Expand Down
6 changes: 3 additions & 3 deletions core/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

retry "github.com/avast/retry-go"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion core/headers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package core

import (
"github.com/cosmos/ibc-go/modules/core/exported"
"github.com/cosmos/ibc-go/v4/modules/core/exported"
)

type HeaderI interface {
Expand Down
2 changes: 1 addition & 1 deletion core/ics24.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

host "github.com/cosmos/ibc-go/modules/core/24-host"
host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
)

// Vclient validates the client identifier in the path
Expand Down
2 changes: 1 addition & 1 deletion core/naive-strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

retry "github.com/avast/retry-go"
sdk "github.com/cosmos/cosmos-sdk/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
"golang.org/x/sync/errgroup"
)

Expand Down
6 changes: 3 additions & 3 deletions core/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"golang.org/x/sync/errgroup"
"gopkg.in/yaml.v2"

clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
)

const (
Expand Down
20 changes: 9 additions & 11 deletions core/pathEnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
commitmentypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
ibcexported "github.com/cosmos/ibc-go/modules/core/exported"
tmclient "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
chantypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
commitmentypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
tmclient "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/light"
)
Expand Down Expand Up @@ -136,7 +136,6 @@ func (pe *PathEnd) ConnTry(
panic(err)
}
msg := conntypes.NewMsgConnectionOpenTry(
"",
pe.ClientID,
dst.ConnectionID,
dst.ClientID,
Expand Down Expand Up @@ -211,7 +210,6 @@ func (pe *PathEnd) ChanInit(dst *PathEnd, signer sdk.AccAddress) sdk.Msg {
func (pe *PathEnd) ChanTry(dst *PathEnd, dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg {
return chantypes.NewMsgChannelOpenTry(
pe.PortID,
"",
pe.Version,
dstChanState.Channel.Ordering,
[]string{pe.ConnectionID},
Expand Down Expand Up @@ -304,7 +302,7 @@ func (pe *PathEnd) NewPacket(dst *PathEnd, sequence uint64, packetData []byte,
func (pe *PathEnd) XferPacket(amount sdk.Coin, sender, receiver string) []byte {
return transfertypes.NewFungibleTokenPacketData(
amount.Denom,
amount.Amount.Uint64(),
amount.Amount.String(),
sender,
receiver,
).GetBytes()
Expand Down
Loading