Skip to content

Commit

Permalink
Merge branch 'main' into faddat/pre-blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan authored Sep 18, 2023
2 parents 1e85485 + 82d66ad commit 1524338
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 145 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/callbacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Callbacks Module
# This workflow runs when a PR is opened that targets code that is part of the callbacks module.
on:
pull_request:
paths:
- '.github/workflows/callbacks.yml'
- 'modules/apps/callbacks/**'
push:
branches:
- main
permissions:
contents: read

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
chain-binary: simd
chain-a-tag: v7.0.0
chain-b-tag: v7.0.0
chain-upgrade-tag: pr-4591 # TODO: update this to a real tag once v8 is released
chain-upgrade-tag: main # TODO: update this to a real tag once v8 is released
upgrade-plan-name: "v8"
test-entry-point: "TestUpgradeTestSuite"
test: "TestV7ToV8ChainUpgrade"
Expand Down
5 changes: 1 addition & 4 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/ibc-go/v8 v8.0.0-20230906115913-46ee5f92e1af
github.com/docker/docker v24.0.6+incompatible
github.com/strangelove-ventures/interchaintest/v8 v8.0.0-20230817191535-cc35cd35adbc
github.com/strangelove-ventures/interchaintest/v8 v8.0.0-20230913202406-3e11bf474a3b
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.25.0
golang.org/x/mod v0.12.0
Expand Down Expand Up @@ -235,6 +235,3 @@ replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.2021

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

//replace github.com/strangelove-ventures/interchaintest/v8 => github.com/notional-labs/interchaintest/v8 v8.0.0-20230905211440-c2dc240d2221

replace github.com/strangelove-ventures/interchaintest/v8 => github.com/colin-axner/interchaintest/v8 v8.0.0-20230906142353-5d89200aad4a
4 changes: 2 additions & 2 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/colin-axner/interchaintest/v8 v8.0.0-20230906142353-5d89200aad4a h1:rWxVtMsp/X9FVOzIvLCrJ8FWzuAGwpI7jwh51Pgt5Lc=
github.com/colin-axner/interchaintest/v8 v8.0.0-20230906142353-5d89200aad4a/go.mod h1:aXLHcZ5Tv0R5/LynEsE86bc4UwuHl5TZpzGSLqo79AE=
github.com/cometbft/cometbft v0.38.0 h1:ogKnpiPX7gxCvqTEF4ly25/wAxUqf181t30P3vqdpdc=
github.com/cometbft/cometbft v0.38.0/go.mod h1:5Jz0Z8YsHSf0ZaAqGvi/ifioSdVFPtEGrm8Y9T/993k=
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
Expand Down Expand Up @@ -994,6 +992,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
github.com/strangelove-ventures/interchaintest/v8 v8.0.0-20230913202406-3e11bf474a3b h1:B3VTNRBsh/kp9+TpMQVXsjUql38+82trUSxPOKd7R/k=
github.com/strangelove-ventures/interchaintest/v8 v8.0.0-20230913202406-3e11bf474a3b/go.mod h1:ELE57+yyFCeMuxuFHHu50Wxs3/CPmHxH2uBlvCF1lq4=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
Expand Down
8 changes: 2 additions & 6 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() {
})

if testvalues.TokenMetadataFeatureReleases.IsSupported(chainBVersion) {
t.Run("metadata for token exists on chainB", func(t *testing.T) {
balances, err := s.QueryAllBalances(ctx, chainB, chainBAddress, true)
s.Require().NoError(err)

// balance for IBC token returns a human-readable denomination
s.Require().Equal(chainBIBCToken.GetFullDenomPath(), balances[1].Denom)
t.Run("metadata for IBC denomination exists on chainB", func(t *testing.T) {
s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA)
})
}

Expand Down
7 changes: 0 additions & 7 deletions e2e/tests/upgrades/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package upgrades

import (
"context"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -198,12 +197,6 @@ func (s *GenesisTestSuite) HaltChainAndExportGenesis(ctx context.Context, chain
state, err := chain.ExportState(ctx, int64(haltHeight))
s.Require().NoError(err)

// state exports currently read from stdout which include log entries, this discards the log entry by the server module
// this may need to be updated if log entries are inserted in between exporting of state and the server module logging
// see issue: https://github.com/strangelove-ventures/interchaintest/issues/721
str := strings.SplitAfter(state, "server")
state = str[1]

appTomlOverrides := make(test.Toml)

appTomlOverrides["halt-height"] = 0
Expand Down
14 changes: 9 additions & 5 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,21 +721,21 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() {
s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA), "failed to wait for blocks")

t.Run("upgrade chain", func(t *testing.T) {
govProposalWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
s.UpgradeChain(ctx, chainA, govProposalWallet, testCfg.UpgradeConfig.PlanName, testCfg.ChainConfigs[0].Tag, testCfg.UpgradeConfig.Tag)
govProposalWallet := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount)
s.UpgradeChain(ctx, chainB, govProposalWallet, testCfg.UpgradeConfig.PlanName, testCfg.ChainConfigs[0].Tag, testCfg.UpgradeConfig.Tag)
})

t.Run("update params", func(t *testing.T) {
authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA)
authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainB)
s.Require().NoError(err)
s.Require().NotNil(authority)

msg := clienttypes.NewMsgUpdateParams(authority.String(), clienttypes.NewParams(exported.Tendermint, "some-client"))
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet)
s.ExecuteGovV1Proposal(ctx, msg, chainB, chainBWallet)
})

t.Run("query params", func(t *testing.T) {
clientParams, err := s.GetChainGRCPClients(chainA).ClientQueryClient.ClientParams(ctx, &clienttypes.QueryClientParamsRequest{})
clientParams, err := s.GetChainGRCPClients(chainB).ClientQueryClient.ClientParams(ctx, &clienttypes.QueryClientParamsRequest{})
s.Require().NoError(err)

allowedClients := clientParams.Params.AllowedClients
Expand All @@ -744,6 +744,10 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() {
s.Require().Contains(allowedClients, exported.Tendermint)
s.Require().Contains(allowedClients, "some-client")
})

t.Run("query human readable ibc denom", func(t *testing.T) {
s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA)
})
}

// RegisterInterchainAccount will attempt to register an interchain account on the counterparty chain.
Expand Down
41 changes: 27 additions & 14 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,6 @@ func (s *E2ETestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Cha
return res.CounterpartyPayee, nil
}

// QueryBalances returns all the balances on the given chain for the provided address.
func (s *E2ETestSuite) QueryAllBalances(ctx context.Context, chain ibc.Chain, address string, resolveDenom bool) (sdk.Coins, error) {
queryClient := s.GetChainGRCPClients(chain).BankQueryClient
res, err := queryClient.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{
Address: address,
ResolveDenom: resolveDenom,
})
if err != nil {
return sdk.Coins{}, err
}

return res.Balances, nil
}

// QueryProposalV1Beta1 queries the governance proposal on the given chain with the given proposal ID.
func (s *E2ETestSuite) QueryProposalV1Beta1(ctx context.Context, chain ibc.Chain, proposalID uint64) (govtypesv1beta1.Proposal, error) {
queryClient := s.GetChainGRCPClients(chain).GovQueryClient
Expand Down Expand Up @@ -394,3 +380,30 @@ func (s *E2ETestSuite) QueryGranterGrants(ctx context.Context, chain *cosmos.Cos

return grants.Grants, nil
}

// QueryBalances returns all the balances on the given chain for the provided address.
func (s *E2ETestSuite) QueryAllBalances(ctx context.Context, chain ibc.Chain, address string, resolveDenom bool) (sdk.Coins, error) {
queryClient := s.GetChainGRCPClients(chain).BankQueryClient
res, err := queryClient.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{
Address: address,
ResolveDenom: resolveDenom,
})
if err != nil {
return sdk.Coins{}, err
}

return res.Balances, nil
}

// QueryDenomMetadata queries the metadata for the given denom.
func (s *E2ETestSuite) QueryDenomMetadata(ctx context.Context, chain *cosmos.CosmosChain, denom string) (banktypes.Metadata, error) {
bankClient := s.GetChainGRCPClients(chain).BankQueryClient
queryRequest := &banktypes.QueryDenomMetadataRequest{
Denom: denom,
}
res, err := bankClient.DenomMetadata(ctx, queryRequest)
if err != nil {
return banktypes.Metadata{}, err
}
return res.Metadata, nil
}
32 changes: 11 additions & 21 deletions e2e/testsuite/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,6 @@ func newDefaultSimappConfig(cc ChainConfig, name, chainID, denom string, cometCf
tmTomlOverrides["log_level"] = cometCfg.LogLevel // change to debug in ~/.ibc-go-e2e-config.json to increase cometbft logging.
configFileOverrides["config/config.toml"] = tmTomlOverrides

var useNewGenesisCommand bool
if cc.Binary == defaultBinary && testvalues.SimdNewGenesisCommandsFeatureReleases.IsSupported(cc.Tag) {
useNewGenesisCommand = true
}

if cc.Binary == icadBinary && testvalues.IcadNewGenesisCommandsFeatureReleases.IsSupported(cc.Tag) {
useNewGenesisCommand = true
}

return ibc.ChainConfig{
Type: "cosmos",
Name: name,
Expand All @@ -413,18 +404,17 @@ func newDefaultSimappConfig(cc ChainConfig, name, chainID, denom string, cometCf
Version: cc.Tag,
},
},
Bin: cc.Binary,
Bech32Prefix: "cosmos",
CoinType: fmt.Sprint(sdk.GetConfig().GetCoinType()),
Denom: denom,
EncodingConfig: SDKEncodingConfig(),
GasPrices: fmt.Sprintf("0.00%s", denom),
GasAdjustment: 1.3,
TrustingPeriod: "508h",
NoHostMount: false,
ModifyGenesis: getGenesisModificationFunction(cc),
ConfigFileOverrides: configFileOverrides,
UsingNewGenesisCommand: useNewGenesisCommand,
Bin: cc.Binary,
Bech32Prefix: "cosmos",
CoinType: fmt.Sprint(sdk.GetConfig().GetCoinType()),
Denom: denom,
EncodingConfig: SDKEncodingConfig(),
GasPrices: fmt.Sprintf("0.00%s", denom),
GasAdjustment: 1.3,
TrustingPeriod: "508h",
NoHostMount: false,
ModifyGenesis: getGenesisModificationFunction(cc),
ConfigFileOverrides: configFileOverrides,
}
}

Expand Down
15 changes: 15 additions & 0 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ func (s *E2ETestSuite) AssertPacketRelayed(ctx context.Context, chain *cosmos.Co
s.Require().Empty(commitment)
}

// AssertHumanReadableDenom asserts that a human readable denom is present for a given chain.
func (s *E2ETestSuite) AssertHumanReadableDenom(ctx context.Context, chain *cosmos.CosmosChain, counterpartyNativeDenom string, counterpartyChannel ibc.ChannelOutput) {
chainIBCDenom := GetIBCToken(counterpartyNativeDenom, counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID)

denomMetadata, err := s.QueryDenomMetadata(ctx, chain, chainIBCDenom.IBCDenom())
s.Require().NoError(err)

s.Require().Equal(chainIBCDenom.IBCDenom(), denomMetadata.Base, "denom metadata base does not match expected %s: got %s", chainIBCDenom.IBCDenom(), denomMetadata.Base)
expectedName := fmt.Sprintf("%s/%s/%s IBC token", counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID, counterpartyNativeDenom)
s.Require().Equal(expectedName, denomMetadata.Name, "denom metadata name does not match expected %s: got %s", expectedName, denomMetadata.Name)
expectedDisplay := fmt.Sprintf("%s/%s/%s", counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID, counterpartyNativeDenom)
s.Require().Equal(expectedDisplay, denomMetadata.Display, "denom metadata display does not match expected %s: got %s", expectedDisplay, denomMetadata.Display)
s.Require().Equal(strings.ToUpper(counterpartyNativeDenom), denomMetadata.Symbol, "denom metadata symbol does not match expected %s: got %s", strings.ToUpper(counterpartyNativeDenom), denomMetadata.Symbol)
}

// createCosmosChains creates two separate chains in docker containers.
// test and can be retrieved with GetChains.
func (s *E2ETestSuite) createCosmosChains(chainOptions ChainOptions) (*cosmos.CosmosChain, *cosmos.CosmosChain) {
Expand Down
12 changes: 0 additions & 12 deletions e2e/testvalues/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ var IcadGovGenesisFeatureReleases = semverutil.FeatureReleases{
},
}

// IcadNewGenesisCommandsFeatureReleases represents the releases of icad using the new genesis commands.
var IcadNewGenesisCommandsFeatureReleases = semverutil.FeatureReleases{
MinorVersions: []string{
"v0.5",
},
}

// SimdNewGenesisCommandsFeatureReleases represents the releases the simd binary started using the new genesis command.
var SimdNewGenesisCommandsFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v8",
}

// SelfParamsFeatureReleases represents the releases the transfer module started managing its own params.
var SelfParamsFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v8",
Expand Down
11 changes: 0 additions & 11 deletions internal/collections/collections.go

This file was deleted.

44 changes: 0 additions & 44 deletions internal/collections/collections_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions modules/apps/27-interchain-accounts/host/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"encoding/json"
"fmt"
"slices"

"github.com/cosmos/gogoproto/proto"
"github.com/spf13/cobra"
Expand All @@ -12,7 +13,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"

"github.com/cosmos/ibc-go/v8/internal/collections"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
)

Expand Down Expand Up @@ -82,7 +82,7 @@ otherwise the encoding flag can be used in combination with either "proto3" or "
return err
}

if !collections.Contains(encoding, []string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}) {
if !slices.Contains([]string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}, encoding) {
return fmt.Errorf("unsupported encoding type: %s", encoding)
}

Expand Down
7 changes: 4 additions & 3 deletions modules/apps/27-interchain-accounts/types/metadata.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package types

import (
"slices"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/ibc-go/v8/internal/collections"
connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
)

Expand Down Expand Up @@ -134,7 +135,7 @@ func ValidateHostMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, connecti

// isSupportedEncoding returns true if the provided encoding is supported, otherwise false
func isSupportedEncoding(encoding string) bool {
return collections.Contains(encoding, getSupportedEncoding())
return slices.Contains(getSupportedEncoding(), encoding)
}

// getSupportedEncoding returns a string slice of supported encoding formats
Expand All @@ -144,7 +145,7 @@ func getSupportedEncoding() []string {

// isSupportedTxType returns true if the provided transaction type is supported, otherwise false
func isSupportedTxType(txType string) bool {
return collections.Contains(txType, getSupportedTxTypes())
return slices.Contains(getSupportedTxTypes(), txType)
}

// getSupportedTxTypes returns a string slice of supported transaction types
Expand Down
1 change: 0 additions & 1 deletion modules/apps/transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func NewKeeper(
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
panic("the IBC transfer module account has not been set")
}

// set KeyTable if it has not already been set
if !legacySubspace.HasKeyTable() {
legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable())
Expand Down
Loading

0 comments on commit 1524338

Please sign in to comment.