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

Update to SDK 0.52 #1305

Closed
Closed
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ help: ## Print this help message

.PHONY: interchaintest
interchaintest: gen ## Build interchaintest binary into ./bin
go test -ldflags "-X github.com/strangelove-ventures/interchaintest/v8/interchaintest.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/interchaintest ./cmd/interchaintest
go test -ldflags "-X github.com/strangelove-ventures/interchaintest/v9/interchaintest.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/interchaintest ./cmd/interchaintest

.PHONY: test
test: ## Run unit tests
Expand Down
10 changes: 5 additions & 5 deletions blockdb/messages_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/types"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/strangelove-ventures/interchaintest/v9"
"github.com/strangelove-ventures/interchaintest/v9/ibc"
"github.com/strangelove-ventures/interchaintest/v9/relayer"
"github.com/strangelove-ventures/interchaintest/v9/testreporter"
"github.com/strangelove-ventures/interchaintest/v9/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/atotto/clipboard"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=mainContent
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/cosmos_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"strings"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
)

// CosmosMessage presents a blockdb.CosmosMessageResult.
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/cosmos_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/test_case.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package presenter
import (
"strconv"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
)

// TestCase presents a blockdb.TestCaseResult.
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/test_case_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"sync"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
)

var bufPool = sync.Pool{New: func() any { return new(bytes.Buffer) }}
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/presenter/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/blockdb/tui/presenter"
"github.com/strangelove-ventures/interchaintest/v9/blockdb/tui/presenter"
)

// Update should be the argument for *(tview.Application).SetInputCapture.
Expand Down
2 changes: 1 addition & 1 deletion blockdb/tui/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
4 changes: 2 additions & 2 deletions blockdb/tui/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb/tui/presenter"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/blockdb/tui/presenter"
)

func headerView(m *Model) *tview.Flex {
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/08-wasm-types/client_message.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

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

var _ exported.ClientMessage = &ClientMessage{}
Expand Down
4 changes: 2 additions & 2 deletions chain/cosmos/08-wasm-types/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" // nolint:staticcheck
"github.com/cosmos/ibc-go/v8/modules/core/exported"
clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" // nolint:staticcheck
"github.com/cosmos/ibc-go/v9/modules/core/exported"
)

var _ exported.ClientState = (*ClientState)(nil)
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/08-wasm-types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"

"github.com/cosmos/ibc-go/v8/modules/core/exported"
"github.com/cosmos/ibc-go/v9/modules/core/exported"
)

// RegisterInterfaces registers the tendermint concrete client-related
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/08-wasm-types/consensus_state.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

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

var _ exported.ConsensusState = (*ConsensusState)(nil)
Expand Down
4 changes: 0 additions & 4 deletions chain/cosmos/08-wasm-types/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"

//grpc "github.com/cosmos/gogoproto/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
)

var _ module.AppModuleBasic = AppModuleBasic{}

// AppModuleBasic defines the basic application module used by the tendermint light client.
// Only the RegisterInterfaces function needs to be implemented. All other function perform
// a no-op.
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/08-wasm-types/wasm.pb.go

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

9 changes: 2 additions & 7 deletions chain/cosmos/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// AccAddressFromBech32 creates an AccAddress from a Bech32 string.
// https://github.com/cosmos/cosmos-sdk/blob/v0.50.2/types/address.go#L193-L212
func (c *CosmosChain) AccAddressFromBech32(address string) (addr sdk.AccAddress, err error) {
func (c *CosmosChain) AccAddressFromBech32(address string) (sdk.AccAddress, error) {
if len(strings.TrimSpace(address)) == 0 {
return sdk.AccAddress{}, errors.New("empty address string is not allowed")
}
Expand All @@ -20,12 +20,7 @@ func (c *CosmosChain) AccAddressFromBech32(address string) (addr sdk.AccAddress,
return nil, err
}

err = sdk.VerifyAddressFormat(bz)
if err != nil {
return nil, err
}

return sdk.AccAddress(bz), nil
return bz, nil
}

func (c *CosmosChain) AccAddressToBech32(addr sdk.AccAddress) (string, error) {
Expand Down
17 changes: 11 additions & 6 deletions chain/cosmos/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/strangelove-ventures/interchaintest/v9/dockerutil"
"github.com/strangelove-ventures/interchaintest/v9/testutil"
)

type ClientContextOpt func(clientContext client.Context) client.Context
Expand Down Expand Up @@ -122,6 +122,12 @@ func (b *Broadcaster) GetClientContext(ctx context.Context, user User) (client.C
for _, opt := range b.clientContextOptions {
clientContext = opt(clientContext)
}

// Address Codec must be set.
if clientContext.AddressCodec == nil {
clientContext = clientContext.WithAddressCodec(clientContext.TxConfig.SigningContext().AddressCodec())
}

return clientContext, nil
}

Expand All @@ -135,9 +141,9 @@ func (b *Broadcaster) GetTxResponseBytes(ctx context.Context, user User) ([]byte

// UnmarshalTxResponseBytes accepts the sdk.TxResponse bytes and unmarshalls them into an
// instance of sdk.TxResponse.
func (b *Broadcaster) UnmarshalTxResponseBytes(ctx context.Context, bytes []byte) (sdk.TxResponse, error) {
func (b *Broadcaster) UnmarshalTxResponseBytes(ctx context.Context, cc client.Context, bytes []byte) (sdk.TxResponse, error) {
resp := sdk.TxResponse{}
if err := b.chain.cfg.EncodingConfig.Codec.UnmarshalJSON(bytes, &resp); err != nil {
if err := cc.Codec.UnmarshalJSON(bytes, &resp); err != nil {
return sdk.TxResponse{}, err
}

Expand Down Expand Up @@ -168,7 +174,6 @@ func (b *Broadcaster) defaultClientContext(fromUser User, sdkAdd sdk.AccAddress)
WithKeyring(kr).
WithBroadcastMode(flags.BroadcastSync).
WithCodec(b.chain.cfg.EncodingConfig.Codec)

// NOTE: the returned context used to have .WithHomeDir(cn.Home),
// but that field no longer exists and the test against Broadcaster still passes without it.
}
Expand Down Expand Up @@ -227,7 +232,7 @@ func BroadcastTx(ctx context.Context, broadcaster *Broadcaster, broadcastingUser
return sdk.TxResponse{}, err
}

respWithTxHash, err := broadcaster.UnmarshalTxResponseBytes(ctx, txBytes)
respWithTxHash, err := broadcaster.UnmarshalTxResponseBytes(ctx, cc, txBytes)
if err != nil {
return sdk.TxResponse{}, err
}
Expand Down
28 changes: 15 additions & 13 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/avast/retry-go/v4"
"hash/fnv"
"math/rand"
"os"
Expand All @@ -16,7 +17,8 @@ import (
"sync"
"time"

"github.com/avast/retry-go/v4"
banktypes "cosmossdk.io/x/bank/types"
stakingtypes "cosmossdk.io/x/staking/types"
tmjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/p2p"
rpcclient "github.com/cometbft/cometbft/rpc/client"
Expand All @@ -29,8 +31,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
authTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
volumetypes "github.com/docker/docker/api/types/volume"
dockerclient "github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
Expand All @@ -39,11 +39,11 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types"
"github.com/strangelove-ventures/interchaintest/v9/blockdb"
"github.com/strangelove-ventures/interchaintest/v9/dockerutil"
"github.com/strangelove-ventures/interchaintest/v9/ibc"
"github.com/strangelove-ventures/interchaintest/v9/testutil"
)

// ChainNode represents a node in the test network that is being created
Expand Down Expand Up @@ -127,7 +127,7 @@ func (tn *ChainNode) NewClient(addr string) error {
}

httpClient.Timeout = 10 * time.Second
rpcClient, err := rpchttp.NewWithClient(addr, "/websocket", httpClient)
rpcClient, err := rpchttp.NewWithClient(addr, httpClient)
if err != nil {
return err
}
Expand Down Expand Up @@ -431,7 +431,7 @@ func (tn *ChainNode) FindTxs(ctx context.Context, height int64) ([]blockdb.Tx, e
}
newTx.Data = b

rTx := blockRes.TxsResults[i]
rTx := blockRes.TxResults[i]

newTx.Events = make([]blockdb.Event, len(rTx.Events))
for j, e := range rTx.Events {
Expand Down Expand Up @@ -1004,13 +1004,15 @@ func (tn *ChainNode) CreateNodeContainer(ctx context.Context) error {

var cmd []string
if chainCfg.NoHostMount {
startCmd := fmt.Sprintf("cp -r %s %s_nomnt && %s start --home %s_nomnt --x-crisis-skip-assert-invariants", tn.HomeDir(), tn.HomeDir(), chainCfg.Bin, tn.HomeDir())
//startCmd := fmt.Sprintf("cp -r %s %s_nomnt && %s start --home %s_nomnt --x-crisis-skip-assert-invariants", tn.HomeDir(), tn.HomeDir(), chainCfg.Bin, tn.HomeDir())
startCmd := fmt.Sprintf("cp -r %s %s_nomnt && %s start --home %s_nomnt", tn.HomeDir(), tn.HomeDir(), chainCfg.Bin, tn.HomeDir())
if len(chainCfg.AdditionalStartArgs) > 0 {
startCmd = fmt.Sprintf("%s %s", startCmd, chainCfg.AdditionalStartArgs)
}
cmd = []string{"sh", "-c", startCmd}
} else {
cmd = []string{chainCfg.Bin, "start", "--home", tn.HomeDir(), "--x-crisis-skip-assert-invariants"}
//cmd = []string{chainCfg.Bin, "start", "--home", tn.HomeDir(), "--x-crisis-skip-assert-invariants"}
cmd = []string{chainCfg.Bin, "start", "--home", tn.HomeDir()}
if len(chainCfg.AdditionalStartArgs) > 0 {
cmd = append(cmd, chainCfg.AdditionalStartArgs...)
}
Expand Down Expand Up @@ -1368,7 +1370,7 @@ func (tn *ChainNode) SendICABankTransfer(ctx context.Context, connectionID, from
fromAddress := sdk.MustAccAddressFromBech32(fromAddr)
toAddress := sdk.MustAccAddressFromBech32(amount.Address)
coin := sdk.NewCoin(amount.Denom, amount.Amount)
msg := banktypes.NewMsgSend(fromAddress, toAddress, sdk.NewCoins(coin))
msg := banktypes.NewMsgSend(fromAddress.String(), toAddress.String(), sdk.NewCoins(coin))
msgs := []sdk.Msg{msg}

ir := tn.Chain.Config().EncodingConfig.InterfaceRegistry
Expand Down
Loading
Loading