diff --git a/.github/workflows/e2e-conformance.yml b/.github/workflows/e2e-conformance.yml new file mode 100644 index 000000000..e432206c3 --- /dev/null +++ b/.github/workflows/e2e-conformance.yml @@ -0,0 +1,32 @@ +name: Conformance End-To-End Tests + +on: + pull_request: + +# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-conformance: + name: test-conformance + runs-on: ubuntu-latest + steps: + # Install and setup go + - name: Set up Go 1.21 + uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: checkout interchaintest + uses: actions/checkout@v4 + + # cleanup environment on self-hosted test runner + - name: clean + run: |- + rm -rf ~/.interchaintest + + # run tests + - name: run conformance tests + run: (go test -race -timeout 30m -failfast -v -p 2 ./cmd/interchaintest) || (echo "\n\n*****CHAIN and RELAYER LOGS*****" && cat "$HOME/.interchaintest/logs/interchaintest.log" && exit 1) diff --git a/.github/workflows/e2e-cosmos.yml b/.github/workflows/e2e-cosmos.yml new file mode 100644 index 000000000..a46d6ebe8 --- /dev/null +++ b/.github/workflows/e2e-cosmos.yml @@ -0,0 +1,33 @@ +name: Conformance End-To-End Tests + +on: + pull_request: + +# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-cosmos-examples: + name: test-cosmos-examples + runs-on: ubuntu-latest + steps: + # Install and setup go + - name: Set up Go 1.21 + uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: false + + - name: checkout interchaintest + uses: actions/checkout@v4 + + # cleanup environment on self-hosted test runner + - name: clean + run: |- + rm -rf ~/.interchaintest + + # run tests + - name: run example cosmos tests + run: go test -race -failfast -timeout 30m -v -p 2 ./examples/cosmos diff --git a/.github/workflows/e2e-ibc.yml b/.github/workflows/e2e-ibc.yml new file mode 100644 index 000000000..79c12b0c3 --- /dev/null +++ b/.github/workflows/e2e-ibc.yml @@ -0,0 +1,33 @@ +name: IBC End-To-End Tests + +on: + pull_request: + +# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-ibc-examples: + name: test-ibc-examples + runs-on: ubuntu-latest + steps: + # Install and setup go + - name: Set up Go 1.21 + uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: false + + - name: checkout interchaintest + uses: actions/checkout@v4 + + # cleanup environment on self-hosted test runner + - name: clean + run: |- + rm -rf ~/.interchaintest + + # run tests + - name: run example ibc tests + run: go test -race -timeout 30m -failfast -v -p 2 ./examples/ibc diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml deleted file mode 100644 index ea0f7bf39..000000000 --- a/.github/workflows/e2e-tests.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Run End-To-End Tests - -on: - pull_request: - -# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed. -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test-conformance: - name: test-conformance - runs-on: ubuntu-latest - steps: - # Install and setup go - - name: Set up Go 1.21 - uses: actions/setup-go@v5 - with: - go-version: '1.21' - - - name: checkout interchaintest - uses: actions/checkout@v4 - - # cleanup environment on self-hosted test runner - - name: clean - run: |- - rm -rf ~/.interchaintest - - # run tests - - name: run conformance tests - run: (go test -race -timeout 30m -failfast -v -p 2 ./cmd/interchaintest) || (echo "\n\n*****CHAIN and RELAYER LOGS*****" && cat "$HOME/.interchaintest/logs/interchaintest.log" && exit 1) - test-ibc-examples: - name: test-ibc-examples - runs-on: ubuntu-latest - steps: - # Install and setup go - - name: Set up Go 1.21 - uses: actions/setup-go@v5 - with: - go-version: '1.21' - cache: false - - - name: checkout interchaintest - uses: actions/checkout@v4 - - # cleanup environment on self-hosted test runner - - name: clean - run: |- - rm -rf ~/.interchaintest - - # run tests - - name: run example ibc tests - run: go test -race -timeout 30m -failfast -v -p 2 ./examples/ibc - test-cosmos-examples: - name: test-cosmos-examples - runs-on: ubuntu-latest - steps: - # Install and setup go - - name: Set up Go 1.21 - uses: actions/setup-go@v5 - with: - go-version: '1.21' - cache: false - - - name: checkout interchaintest - uses: actions/checkout@v4 - - # cleanup environment on self-hosted test runner - - name: clean - run: |- - rm -rf ~/.interchaintest - - # run tests - - name: run example cosmos tests - run: go test -race -failfast -timeout 30m -v -p 2 ./examples/cosmos diff --git a/chain/cosmos/broadcaster.go b/chain/cosmos/broadcaster.go index 7dd7a8027..f46cc25f2 100644 --- a/chain/cosmos/broadcaster.go +++ b/chain/cosmos/broadcaster.go @@ -101,7 +101,7 @@ func (b *Broadcaster) GetFactory(ctx context.Context, user User) (tx.Factory, er // client.Context. func (b *Broadcaster) GetClientContext(ctx context.Context, user User) (client.Context, error) { chain := b.chain - cn := chain.getFullNode() + cn := chain.GetFullNode() _, ok := b.keyrings[user] if !ok { @@ -158,7 +158,7 @@ func (b *Broadcaster) defaultClientContext(fromUser User, sdkAdd sdk.AccAddress) // initialize a clean buffer each time b.buf.Reset() kr := b.keyrings[fromUser] - cn := b.chain.getFullNode() + cn := b.chain.GetFullNode() return cn.CliContext(). WithOutput(b.buf). WithFrom(fromUser.FormattedAddress()). diff --git a/chain/cosmos/cosmos_chain.go b/chain/cosmos/cosmos_chain.go index 0d88ea1b2..704d96f8a 100644 --- a/chain/cosmos/cosmos_chain.go +++ b/chain/cosmos/cosmos_chain.go @@ -155,7 +155,7 @@ func (c *CosmosChain) AddFullNodes(ctx context.Context, configFileOverrides map[ prevCount := c.numFullNodes c.numFullNodes += inc - if err := c.initializeChainNodes(ctx, c.testName, c.getFullNode().DockerClient, c.getFullNode().NetworkID); err != nil { + if err := c.initializeChainNodes(ctx, c.testName, c.GetFullNode().DockerClient, c.GetFullNode().NetworkID); err != nil { return err } @@ -212,7 +212,11 @@ func (c *CosmosChain) Initialize(ctx context.Context, testName string, cli *clie return c.initializeChainNodes(ctx, testName, cli, networkID) } -func (c *CosmosChain) getFullNode() *ChainNode { +func (c *CosmosChain) GetFullNode() *ChainNode { + if len(c.FullNodes) > 0 { + return c.FullNodes[0] + } + return c.GetNode() } @@ -222,70 +226,70 @@ func (c *CosmosChain) GetNode() *ChainNode { // Exec implements ibc.Chain. func (c *CosmosChain) Exec(ctx context.Context, cmd []string, env []string) (stdout, stderr []byte, err error) { - return c.getFullNode().Exec(ctx, cmd, env) + return c.GetFullNode().Exec(ctx, cmd, env) } // Implements Chain interface. func (c *CosmosChain) GetRPCAddress() string { if c.Config().UsesCometMock() { - return fmt.Sprintf("http://%s:22331", c.getFullNode().HostnameCometMock()) + return fmt.Sprintf("http://%s:22331", c.GetFullNode().HostnameCometMock()) } - return fmt.Sprintf("http://%s:26657", c.getFullNode().HostName()) + return fmt.Sprintf("http://%s:26657", c.GetFullNode().HostName()) } // Implements Chain interface. func (c *CosmosChain) GetAPIAddress() string { - return fmt.Sprintf("http://%s:1317", c.getFullNode().HostName()) + return fmt.Sprintf("http://%s:1317", c.GetFullNode().HostName()) } // Implements Chain interface. func (c *CosmosChain) GetGRPCAddress() string { - return fmt.Sprintf("%s:9090", c.getFullNode().HostName()) + return fmt.Sprintf("%s:9090", c.GetFullNode().HostName()) } // GetHostRPCAddress returns the address of the RPC server accessible by the host. // This will not return a valid address until the chain has been started. func (c *CosmosChain) GetHostRPCAddress() string { - return "http://" + c.getFullNode().hostRPCPort + return "http://" + c.GetFullNode().hostRPCPort } // GetHostAPIAddress returns the address of the REST API server accessible by the host. // This will not return a valid address until the chain has been started. func (c *CosmosChain) GetHostAPIAddress() string { - return "http://" + c.getFullNode().hostAPIPort + return "http://" + c.GetFullNode().hostAPIPort } // GetHostGRPCAddress returns the address of the gRPC server accessible by the host. // This will not return a valid address until the chain has been started. func (c *CosmosChain) GetHostGRPCAddress() string { - return c.getFullNode().hostGRPCPort + return c.GetFullNode().hostGRPCPort } // GetHostP2PAddress returns the address of the P2P server accessible by the host. // This will not return a valid address until the chain has been started. func (c *CosmosChain) GetHostPeerAddress() string { - return c.getFullNode().hostP2PPort + return c.GetFullNode().hostP2PPort } // HomeDir implements ibc.Chain. func (c *CosmosChain) HomeDir() string { - return c.getFullNode().HomeDir() + return c.GetFullNode().HomeDir() } // Implements Chain interface. func (c *CosmosChain) CreateKey(ctx context.Context, keyName string) error { - return c.getFullNode().CreateKey(ctx, keyName) + return c.GetFullNode().CreateKey(ctx, keyName) } // Implements Chain interface. func (c *CosmosChain) RecoverKey(ctx context.Context, keyName, mnemonic string) error { - return c.getFullNode().RecoverKey(ctx, keyName, mnemonic) + return c.GetFullNode().RecoverKey(ctx, keyName, mnemonic) } // Implements Chain interface. func (c *CosmosChain) GetAddress(ctx context.Context, keyName string) ([]byte, error) { - b32Addr, err := c.getFullNode().AccountKeyBech32(ctx, keyName) + b32Addr, err := c.GetFullNode().AccountKeyBech32(ctx, keyName) if err != nil { return nil, err } @@ -345,12 +349,12 @@ func (c *CosmosChain) BuildRelayerWallet(ctx context.Context, keyName string) (i // Implements Chain interface. func (c *CosmosChain) SendFunds(ctx context.Context, keyName string, amount ibc.WalletAmount) error { - return c.getFullNode().BankSend(ctx, keyName, amount) + return c.GetFullNode().BankSend(ctx, keyName, amount) } // Implements Chain interface. func (c *CosmosChain) SendFundsWithNote(ctx context.Context, keyName string, amount ibc.WalletAmount, note string) (string, error) { - return c.getFullNode().BankSendWithNote(ctx, keyName, amount, note) + return c.GetFullNode().BankSendWithNote(ctx, keyName, amount, note) } // Implements Chain interface. @@ -361,7 +365,7 @@ func (c *CosmosChain) SendIBCTransfer( amount ibc.WalletAmount, options ibc.TransferOptions, ) (tx ibc.Tx, _ error) { - txHash, err := c.getFullNode().SendIBCTransfer(ctx, channelID, keyName, amount, options) + txHash, err := c.GetFullNode().SendIBCTransfer(ctx, channelID, keyName, amount, options) if err != nil { return tx, fmt.Errorf("send ibc transfer: %w", err) } @@ -419,18 +423,18 @@ func (c *CosmosChain) SendIBCTransfer( // RegisterICA will attempt to register an interchain account on the given counterparty chain. func (c *CosmosChain) RegisterICA(ctx context.Context, keyName string, connectionID string) (string, error) { - return c.getFullNode().RegisterICA(ctx, keyName, connectionID) + return c.GetFullNode().RegisterICA(ctx, keyName, connectionID) } // QueryICA will query for an interchain account controlled by the given address on the counterparty chain. func (c *CosmosChain) QueryICAAddress(ctx context.Context, connectionID, address string) (string, error) { - return c.getFullNode().QueryICA(ctx, connectionID, address) + return c.GetFullNode().QueryICA(ctx, connectionID, address) } // SendICATx sends an interchain account transaction for a specified address and sends it to the respective // interchain account on the counterparty chain. func (c *CosmosChain) SendICATx(ctx context.Context, keyName, connectionID string, msgs []sdk.Msg, icaTxMemo string) (string, error) { - node := c.getFullNode() + node := c.GetFullNode() registry := node.Chain.Config().EncodingConfig.InterfaceRegistry encoding := "proto3" return node.SendICATx(ctx, keyName, connectionID, registry, msgs, icaTxMemo, encoding) @@ -458,7 +462,7 @@ func (c *CosmosChain) PushNewWasmClientProposal(ctx context.Context, keyName str return tx, "", err } prop.Messages = append(prop.Messages, msg) - txHash, err := c.getFullNode().SubmitProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().SubmitProposal(ctx, keyName, prop) if err != nil { return tx, "", fmt.Errorf("failed to submit wasm client proposal: %w", err) } @@ -468,7 +472,7 @@ func (c *CosmosChain) PushNewWasmClientProposal(ctx context.Context, keyName str // UpgradeProposal submits a software-upgrade governance proposal to the chain. func (c *CosmosChain) UpgradeProposal(ctx context.Context, keyName string, prop SoftwareUpgradeProposal) (tx TxProposal, _ error) { - txHash, err := c.getFullNode().UpgradeProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().UpgradeProposal(ctx, keyName, prop) if err != nil { return tx, fmt.Errorf("failed to submit upgrade proposal: %w", err) } @@ -477,7 +481,7 @@ func (c *CosmosChain) UpgradeProposal(ctx context.Context, keyName string, prop // SubmitProposal submits a gov v1 proposal to the chain. func (c *CosmosChain) SubmitProposal(ctx context.Context, keyName string, prop TxProposalv1) (tx TxProposal, _ error) { - txHash, err := c.getFullNode().SubmitProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().SubmitProposal(ctx, keyName, prop) if err != nil { return tx, fmt.Errorf("failed to submit gov v1 proposal: %w", err) } @@ -486,7 +490,7 @@ func (c *CosmosChain) SubmitProposal(ctx context.Context, keyName string, prop T // TextProposal submits a text governance proposal to the chain. func (c *CosmosChain) TextProposal(ctx context.Context, keyName string, prop TextProposal) (tx TxProposal, _ error) { - txHash, err := c.getFullNode().TextProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().TextProposal(ctx, keyName, prop) if err != nil { return tx, fmt.Errorf("failed to submit upgrade proposal: %w", err) } @@ -495,7 +499,7 @@ func (c *CosmosChain) TextProposal(ctx context.Context, keyName string, prop Tex // ParamChangeProposal submits a param change proposal to the chain, signed by keyName. func (c *CosmosChain) ParamChangeProposal(ctx context.Context, keyName string, prop *paramsutils.ParamChangeProposalJSON) (tx TxProposal, _ error) { - txHash, err := c.getFullNode().ParamChangeProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().ParamChangeProposal(ctx, keyName, prop) if err != nil { return tx, fmt.Errorf("failed to submit param change proposal: %w", err) } @@ -505,17 +509,17 @@ func (c *CosmosChain) ParamChangeProposal(ctx context.Context, keyName string, p // QueryParam returns the param state of a given key. func (c *CosmosChain) QueryParam(ctx context.Context, subspace, key string) (*ParamChange, error) { - return c.getFullNode().QueryParam(ctx, subspace, key) + return c.GetFullNode().QueryParam(ctx, subspace, key) } // QueryBankMetadata returns the metadata of a given token denomination. func (c *CosmosChain) QueryBankMetadata(ctx context.Context, denom string) (*BankMetaData, error) { - return c.getFullNode().QueryBankMetadata(ctx, denom) + return c.GetFullNode().QueryBankMetadata(ctx, denom) } // ConsumerAdditionProposal submits a legacy governance proposal to add a consumer to the chain. func (c *CosmosChain) ConsumerAdditionProposal(ctx context.Context, keyName string, prop ccvclient.ConsumerAdditionProposalJSON) (tx TxProposal, _ error) { - txHash, err := c.getFullNode().ConsumerAdditionProposal(ctx, keyName, prop) + txHash, err := c.GetFullNode().ConsumerAdditionProposal(ctx, keyName, prop) if err != nil { return tx, fmt.Errorf("failed to submit consumer addition proposal: %w", err) } @@ -544,57 +548,57 @@ func (c *CosmosChain) txProposal(txHash string) (tx TxProposal, _ error) { // StoreContract takes a file path to smart contract and stores it on-chain. Returns the contracts code id. func (c *CosmosChain) StoreContract(ctx context.Context, keyName string, fileName string, extraExecTxArgs ...string) (string, error) { - return c.getFullNode().StoreContract(ctx, keyName, fileName, extraExecTxArgs...) + return c.GetFullNode().StoreContract(ctx, keyName, fileName, extraExecTxArgs...) } // InstantiateContract takes a code id for a smart contract and initialization message and returns the instantiated contract address. func (c *CosmosChain) InstantiateContract(ctx context.Context, keyName string, codeID string, initMessage string, needsNoAdminFlag bool, extraExecTxArgs ...string) (string, error) { - return c.getFullNode().InstantiateContract(ctx, keyName, codeID, initMessage, needsNoAdminFlag, extraExecTxArgs...) + return c.GetFullNode().InstantiateContract(ctx, keyName, codeID, initMessage, needsNoAdminFlag, extraExecTxArgs...) } // ExecuteContract executes a contract transaction with a message using it's address. func (c *CosmosChain) ExecuteContract(ctx context.Context, keyName string, contractAddress string, message string, extraExecTxArgs ...string) (res *types.TxResponse, err error) { - return c.getFullNode().ExecuteContract(ctx, keyName, contractAddress, message, extraExecTxArgs...) + return c.GetFullNode().ExecuteContract(ctx, keyName, contractAddress, message, extraExecTxArgs...) } // MigrateContract performs contract migration. func (c *CosmosChain) MigrateContract(ctx context.Context, keyName string, contractAddress string, codeID string, message string, extraExecTxArgs ...string) (res *types.TxResponse, err error) { - return c.getFullNode().MigrateContract(ctx, keyName, contractAddress, codeID, message, extraExecTxArgs...) + return c.GetFullNode().MigrateContract(ctx, keyName, contractAddress, codeID, message, extraExecTxArgs...) } // QueryContract performs a smart query, taking in a query struct and returning a error with the response struct populated. func (c *CosmosChain) QueryContract(ctx context.Context, contractAddress string, query any, response any) error { - return c.getFullNode().QueryContract(ctx, contractAddress, query, response) + return c.GetFullNode().QueryContract(ctx, contractAddress, query, response) } // DumpContractState dumps the state of a contract at a block height. func (c *CosmosChain) DumpContractState(ctx context.Context, contractAddress string, height int64) (*DumpContractStateResponse, error) { - return c.getFullNode().DumpContractState(ctx, contractAddress, height) + return c.GetFullNode().DumpContractState(ctx, contractAddress, height) } // StoreClientContract takes a file path to a client smart contract and stores it on-chain. Returns the contracts code id. func (c *CosmosChain) StoreClientContract(ctx context.Context, keyName string, fileName string, extraExecTxArgs ...string) (string, error) { - return c.getFullNode().StoreClientContract(ctx, keyName, fileName, extraExecTxArgs...) + return c.GetFullNode().StoreClientContract(ctx, keyName, fileName, extraExecTxArgs...) } // QueryClientContractCode performs a query with the contract codeHash as the input and code as the output. func (c *CosmosChain) QueryClientContractCode(ctx context.Context, codeHash string, response any) error { - return c.getFullNode().QueryClientContractCode(ctx, codeHash, response) + return c.GetFullNode().QueryClientContractCode(ctx, codeHash, response) } // ExportState exports the chain state at specific height. // Implements Chain interface. func (c *CosmosChain) ExportState(ctx context.Context, height int64) (string, error) { - return c.getFullNode().ExportState(ctx, height) + return c.GetFullNode().ExportState(ctx, height) } // QueryContractInfo queries the chain for the contract metadata. func (c *CosmosChain) QueryContractInfo(ctx context.Context, contractAddress string) (*ContractInfoResponse, error) { - return c.getFullNode().QueryContractInfo(ctx, contractAddress) + return c.GetFullNode().QueryContractInfo(ctx, contractAddress) } func (c *CosmosChain) GetTransaction(txhash string) (*types.TxResponse, error) { - fn := c.getFullNode() + fn := c.GetFullNode() return fn.GetTransaction(fn.CliContext(), txhash) } @@ -1068,18 +1072,18 @@ func (c *CosmosChain) Start(testName string, ctx context.Context, additionalGene } // Wait for blocks before considering the chains "started" - return testutil.WaitForBlocks(ctx, 2, c.getFullNode()) + return testutil.WaitForBlocks(ctx, 2, c.GetFullNode()) } // Height implements ibc.Chain. func (c *CosmosChain) Height(ctx context.Context) (int64, error) { - return c.getFullNode().Height(ctx) + return c.GetFullNode().Height(ctx) } // Acknowledgements implements ibc.Chain, returning all acknowledgments in block at height. func (c *CosmosChain) Acknowledgements(ctx context.Context, height int64) ([]ibc.PacketAcknowledgement, error) { var acks []*chanTypes.MsgAcknowledgement - err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.getFullNode().Client, height, func(msg types.Msg) bool { + err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg types.Msg) bool { found, ok := msg.(*chanTypes.MsgAcknowledgement) if ok { acks = append(acks, found) @@ -1112,7 +1116,7 @@ func (c *CosmosChain) Acknowledgements(ctx context.Context, height int64) ([]ibc // Timeouts implements ibc.Chain, returning all timeouts in block at height. func (c *CosmosChain) Timeouts(ctx context.Context, height int64) ([]ibc.PacketTimeout, error) { var timeouts []*chanTypes.MsgTimeout - err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.getFullNode().Client, height, func(msg types.Msg) bool { + err := RangeBlockMessages(ctx, c.cfg.EncodingConfig.InterfaceRegistry, c.GetFullNode().Client, height, func(msg types.Msg) bool { found, ok := msg.(*chanTypes.MsgTimeout) if ok { timeouts = append(timeouts, found) @@ -1143,7 +1147,7 @@ func (c *CosmosChain) Timeouts(ctx context.Context, height int64) ([]ibc.PacketT // FindTxs implements blockdb.BlockSaver. func (c *CosmosChain) FindTxs(ctx context.Context, height int64) ([]blockdb.Tx, error) { - fn := c.getFullNode() + fn := c.GetFullNode() c.findTxMu.Lock() defer c.findTxMu.Unlock() return fn.FindTxs(ctx, height) diff --git a/chain/cosmos/ics.go b/chain/cosmos/ics.go index beb0e9ead..43aa68567 100644 --- a/chain/cosmos/ics.go +++ b/chain/cosmos/ics.go @@ -129,7 +129,7 @@ func (c *CosmosChain) StartProvider(testName string, ctx context.Context, additi return fmt.Errorf("failed to add proposer key: %s", err) } - proposerAddr, err := c.getFullNode().AccountKeyBech32(ctx, proposerKeyName) + proposerAddr, err := c.GetFullNode().AccountKeyBech32(ctx, proposerKeyName) if err != nil { return fmt.Errorf("failed to get proposer key: %s", err) } @@ -408,7 +408,7 @@ func (c *CosmosChain) StartConsumer(testName string, ctx context.Context, additi } // Wait for 5 blocks before considering the chains "started" - return testutil.WaitForBlocks(ctx, 5, c.getFullNode()) + return testutil.WaitForBlocks(ctx, 5, c.GetFullNode()) } func (c *CosmosChain) transformCCVState(ctx context.Context, ccvState []byte, consumerVersion, providerVersion string, icsCfg ibc.ICSConfig) ([]byte, error) { diff --git a/chain/cosmos/module_tokenfactory.go b/chain/cosmos/module_tokenfactory.go index 76f16a7bd..ae35f66d0 100644 --- a/chain/cosmos/module_tokenfactory.go +++ b/chain/cosmos/module_tokenfactory.go @@ -87,7 +87,7 @@ func (tn *ChainNode) TokenFactoryMetadata(ctx context.Context, keyName, fullDeno // TokenFactoryQueryAdmin returns the admin of a tokenfactory token. func (c *CosmosChain) TokenFactoryQueryAdmin(ctx context.Context, fullDenom string) (*QueryDenomAuthorityMetadataResponse, error) { res := &QueryDenomAuthorityMetadataResponse{} - stdout, stderr, err := c.getFullNode().ExecQuery(ctx, "tokenfactory", "denom-authority-metadata", fullDenom) + stdout, stderr, err := c.GetFullNode().ExecQuery(ctx, "tokenfactory", "denom-authority-metadata", fullDenom) if err != nil { return nil, fmt.Errorf("failed to query tokenfactory denom-authority-metadata: %w\nstdout: %s\nstderr: %s", err, stdout, stderr) } diff --git a/chain/cosmos/osmosis.go b/chain/cosmos/osmosis.go index c6ecbb77f..f850d0a4c 100644 --- a/chain/cosmos/osmosis.go +++ b/chain/cosmos/osmosis.go @@ -20,7 +20,7 @@ type OsmosisPoolParams struct { } func OsmosisCreatePool(c *CosmosChain, ctx context.Context, keyName string, params OsmosisPoolParams) (string, error) { - tn := c.getFullNode() + tn := c.GetFullNode() poolbz, err := json.Marshal(params) if err != nil { return "", err @@ -57,7 +57,7 @@ func OsmosisCreatePool(c *CosmosChain, ctx context.Context, keyName string, para } func OsmosisSwapExactAmountIn(c *CosmosChain, ctx context.Context, keyName string, coinIn string, minAmountOut string, poolIDs []string, swapDenoms []string) (string, error) { - return c.getFullNode().ExecTx(ctx, keyName, + return c.GetFullNode().ExecTx(ctx, keyName, "gamm", "swap-exact-amount-in", coinIn, minAmountOut, "--swap-route-pool-ids", strings.Join(poolIDs, ","), diff --git a/chain/cosmos/poll.go b/chain/cosmos/poll.go index 39b34d965..2d3ec5b9c 100644 --- a/chain/cosmos/poll.go +++ b/chain/cosmos/poll.go @@ -58,7 +58,7 @@ func PollForMessage[T any](ctx context.Context, chain *CosmosChain, registry cod } doPoll := func(ctx context.Context, height int64) (T, error) { h := int64(height) - block, err := chain.getFullNode().Client.Block(ctx, &h) + block, err := chain.GetFullNode().Client.Block(ctx, &h) if err != nil { return zero, err } diff --git a/cmd/interchaintest/interchaintest_test.go b/cmd/interchaintest/interchaintest_test.go index 742e52e1a..639723c3d 100644 --- a/cmd/interchaintest/interchaintest_test.go +++ b/cmd/interchaintest/interchaintest_test.go @@ -100,11 +100,14 @@ func setUpTestMatrix() error { if extraFlags.MatrixFile == "" { fmt.Fprintln(os.Stderr, "No matrix file provided, falling back to rly with gaia and osmosis") + numValsOne := 1 + numFullNodesZero := 0 + testMatrix.Relayers = []string{"rly", "hermes"} testMatrix.ChainSets = [][]*interchaintest.ChainSpec{ { - {Name: "gaia", Version: "v7.0.1"}, - {Name: "osmosis", Version: "v7.2.0"}, + {Name: "gaia", Version: "v7.0.1", NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero}, + {Name: "osmosis", Version: "v7.2.0", NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero}, }, } diff --git a/examples/cosmos/bad_genesis_params_test.go b/examples/cosmos/bad_genesis_params_test.go index 274fd50d6..e49549430 100644 --- a/examples/cosmos/bad_genesis_params_test.go +++ b/examples/cosmos/bad_genesis_params_test.go @@ -18,6 +18,10 @@ var ( ) func TestBadInputParams(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "juno", diff --git a/blockdb/messages_view_test.go b/examples/cosmos/blockdb_messages_view_test.go similarity index 97% rename from blockdb/messages_view_test.go rename to examples/cosmos/blockdb_messages_view_test.go index 2b23a0a8d..cc0671200 100644 --- a/blockdb/messages_view_test.go +++ b/examples/cosmos/blockdb_messages_view_test.go @@ -1,7 +1,4 @@ -package blockdb_test - -// This test is in a separate file, so it can be in the blockdb_test package, -// so it can import interchaintest without creating an import cycle. +package cosmos_test import ( "context" @@ -22,7 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/types" ) -func TestMessagesView(t *testing.T) { +func TestBlockDBMessagesView(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } @@ -34,8 +31,8 @@ func TestMessagesView(t *testing.T) { const gaia0ChainID = "g0" const gaia1ChainID = "g1" cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ - {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia0ChainID}}, - {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia1ChainID}}, + {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia0ChainID}, NumValidators: &numVals, NumFullNodes: &numFullNodes}, + {Name: "gaia", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: gaia1ChainID}, NumValidators: &numVals, NumFullNodes: &numFullNodes}, }) chains, err := cf.Chains(t.Name()) diff --git a/examples/cosmos/chain_genesis_stake_test.go b/examples/cosmos/chain_genesis_stake_test.go index 962213845..8f0c39bda 100644 --- a/examples/cosmos/chain_genesis_stake_test.go +++ b/examples/cosmos/chain_genesis_stake_test.go @@ -34,6 +34,7 @@ func TestChainGenesisUnequalStake(t *testing.T) { ChainName: "gaia", Version: "v15.1.0", NumValidators: &validators, + NumFullNodes: &numFullNodesZero, ChainConfig: ibc.ChainConfig{ Denom: denom, ModifyGenesisAmounts: func(i int) (sdk.Coin, sdk.Coin) { diff --git a/examples/cosmos/chain_param_change_test.go b/examples/cosmos/chain_param_change_test.go index 74851e8dc..881239520 100644 --- a/examples/cosmos/chain_param_change_test.go +++ b/examples/cosmos/chain_param_change_test.go @@ -26,9 +26,6 @@ func CosmosChainParamChangeTest(t *testing.T, name, version string) { t.Parallel() - numVals := 1 - numFullNodes := 1 - // SDK v45 params for Juno genesis shortVoteGenesis := []cosmos.GenesisKV{ cosmos.NewGenesisKV("app_state.gov.voting_params.voting_period", votingPeriod), @@ -41,7 +38,7 @@ func CosmosChainParamChangeTest(t *testing.T, name, version string) { ModifyGenesis: cosmos.ModifyGenesis(shortVoteGenesis), } - chains := interchaintest.CreateChainWithConfig(t, numVals, numFullNodes, name, version, cfg) + chains := interchaintest.CreateChainWithConfig(t, numVals, numFullNodesZero, name, version, cfg) chain := chains[0].(*cosmos.CosmosChain) enableBlockDB := false diff --git a/examples/cosmos/code_coverage_test.go b/examples/cosmos/code_coverage_test.go index fd18d95a4..2abec2ba6 100644 --- a/examples/cosmos/code_coverage_test.go +++ b/examples/cosmos/code_coverage_test.go @@ -16,14 +16,16 @@ import ( ) func TestCodeCoverage(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Parallel() var ( ctx = context.Background() ExternalGoCoverDir = "/tmp/interchaintest-app-coverage" Denom = "umfx" - vals = 1 - fullNodes = 0 ) cfgA := ibc.ChainConfig{ @@ -53,8 +55,8 @@ func TestCodeCoverage(t *testing.T) { Name: "manifest", Version: cfgA.Images[0].Version, ChainName: cfgA.Name, - NumValidators: &vals, - NumFullNodes: &fullNodes, + NumValidators: &numVals, + NumFullNodes: &numFullNodesZero, ChainConfig: cfgA, }, }) diff --git a/examples/cosmos/cometmock_test.go b/examples/cosmos/cometmock_test.go index 157f5918b..1bdc4995a 100644 --- a/examples/cosmos/cometmock_test.go +++ b/examples/cosmos/cometmock_test.go @@ -24,6 +24,10 @@ var ( ) func TestCometMock(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "juno", diff --git a/examples/cosmos/ethermint_test.go b/examples/cosmos/ethermint_test.go index 04012122d..f6cb17430 100644 --- a/examples/cosmos/ethermint_test.go +++ b/examples/cosmos/ethermint_test.go @@ -111,6 +111,8 @@ func TestEthermintChain(t *testing.T) { ExposeAdditionalPorts: []string{"8545/tcp"}, ConfigFileOverrides: map[string]any{"config/app.toml": appTomlOverrides}, }, + NumValidators: &numValsOne, + NumFullNodes: &numFullNodesZero, }, }) @@ -143,7 +145,7 @@ func TestEthermintChain(t *testing.T) { require.Equal(t, "10000000000", balance.String()) // verify access to port exposed via ExposeAdditionalPorts - evmJsonRpcUrl, err := chain.FullNodes[0].GetHostAddress(ctx, "8545/tcp") + evmJsonRpcUrl, err := chain.GetNode().GetHostAddress(ctx, "8545/tcp") require.NoError(t, err) data := []byte(`{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x1", null]}`) diff --git a/examples/cosmos/sdk_boundary_test.go b/examples/cosmos/sdk_boundary_test.go index 280fc3782..3e4eb210d 100644 --- a/examples/cosmos/sdk_boundary_test.go +++ b/examples/cosmos/sdk_boundary_test.go @@ -33,10 +33,12 @@ func TestSDKBoundaries(t *testing.T) { name: "sdk 45 <-> 50", chainSpecs: []*interchaintest.ChainSpec{ { - Name: "gaia", ChainName: "gaia", Version: "v7.0.3", // sdk 0.45.6 + Name: "gaia", ChainName: "gaia", Version: "v7.0.3", //sdk 0.45.6 + NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero, }, { - Name: "ibc-go-simd", ChainName: "simd-50", Version: "feat-upgrade-sdk-v0.50", // sdk 0.50 alpha + Name: "ibc-go-simd", ChainName: "simd-50", Version: "feat-upgrade-sdk-v0.50", //sdk 0.50 alpha + NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero, }, }, relayerVersion: "colin-event-fix", @@ -45,10 +47,12 @@ func TestSDKBoundaries(t *testing.T) { name: "sdk 47 <-> 50", chainSpecs: []*interchaintest.ChainSpec{ { - Name: "ibc-go-simd", ChainName: "simd-47", Version: "v7.2.0", // sdk 0.47.3 + Name: "ibc-go-simd", ChainName: "simd-47", Version: "v7.2.0", //sdk 0.47.3 + NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero, }, { - Name: "ibc-go-simd", ChainName: "simd-50", Version: "feat-upgrade-sdk-v0.50", // sdk 0.50 alpha + Name: "ibc-go-simd", ChainName: "simd-50", Version: "feat-upgrade-sdk-v0.50", //sdk 0.50 alpha + NumValidators: &numValsOne, NumFullNodes: &numFullNodesZero, }, }, relayerVersion: "colin-event-fix", diff --git a/examples/ethereum/foundry_test.go b/examples/ethereum/foundry_test.go index 12a38cca5..741348516 100644 --- a/examples/ethereum/foundry_test.go +++ b/examples/ethereum/foundry_test.go @@ -18,7 +18,6 @@ import ( ) func TestFoundry(t *testing.T) { - if testing.Short() { t.Skip() } diff --git a/examples/ethereum/geth_test.go b/examples/ethereum/geth_test.go index e3232fdc0..0a25da76d 100644 --- a/examples/ethereum/geth_test.go +++ b/examples/ethereum/geth_test.go @@ -19,7 +19,6 @@ import ( ) func TestGeth(t *testing.T) { - if testing.Short() { t.Skip() } diff --git a/examples/ibc/ics_test.go b/examples/ibc/ics_test.go index 104f6c387..ca9d59ad5 100644 --- a/examples/ibc/ics_test.go +++ b/examples/ibc/ics_test.go @@ -20,8 +20,6 @@ import ( var ( icsVersions = []string{"v3.1.0", "v3.3.0", "v4.0.0"} - vals = 2 - fNodes = 0 providerChainID = "provider-1" ) @@ -34,13 +32,11 @@ func TestICS(t *testing.T) { icsVersions = []string{ver} } - relayers := []struct { + type relayerTypes struct { rly ibc.RelayerImplementation name string - }{ - {rly: ibc.Hermes, name: "hermes"}, - {rly: ibc.CosmosRly, name: "rly"}, } + relayers := []relayerTypes{{rly: ibc.CosmosRly, name: "rly"}} for _, version := range icsVersions { version := version @@ -63,15 +59,17 @@ func icsTest(t *testing.T, version string, rly ibc.RelayerImplementation) { consumerBechPrefix = "consumer" } + validators := 2 + cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "ics-provider", Version: version, - NumValidators: &vals, NumFullNodes: &fNodes, + NumValidators: &validators, NumFullNodes: &numFullNodes, ChainConfig: ibc.ChainConfig{GasAdjustment: 1.5, ChainID: providerChainID, TrustingPeriod: "336h"}, }, { Name: "ics-consumer", Version: version, - NumValidators: &vals, NumFullNodes: &fNodes, + NumValidators: &validators, NumFullNodes: &numFullNodes, ChainConfig: ibc.ChainConfig{GasAdjustment: 1.5, ChainID: "consumer-1", Bech32Prefix: consumerBechPrefix, InterchainSecurityConfig: ibc.ICSConfig{ ConsumerCopyProviderKey: func(i int) bool { return i == 0 @@ -120,6 +118,8 @@ func icsTest(t *testing.T, version string, rly ibc.RelayerImplementation) { // ------------------ ICS Setup ------------------ + require.GreaterOrEqual(t, len(provider.Validators), 2) + // Finish the ICS provider chain initialization. // - Restarts the relayer to connect ics20-1 transfer channel // - Delegates tokens to the provider to update consensus value diff --git a/interchain_test.go b/interchain_test.go index a6ceadca4..e8f296897 100644 --- a/interchain_test.go +++ b/interchain_test.go @@ -29,6 +29,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +var ( + numVals = 1 + numFullNodesZero = 0 +) + func TestInterchain_DuplicateChain_CosmosRly(t *testing.T) { duplicateChainTest(t, ibc.CosmosRly) } @@ -48,8 +53,8 @@ func duplicateChainTest(t *testing.T, relayerImpl ibc.RelayerImplementation) { cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. - {Name: "gaia", ChainName: "g1", Version: "v7.0.1"}, - {Name: "gaia", ChainName: "g2", Version: "v7.0.1"}, + {Name: "gaia", ChainName: "g1", Version: "v7.0.1", NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, + {Name: "gaia", ChainName: "g2", Version: "v7.0.1", NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, }) chains, err := cf.Chains(t.Name()) @@ -104,8 +109,8 @@ func getRelayerWalletsTest(t *testing.T, relayerImpl ibc.RelayerImplementation) cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. - {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, - {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}}, + {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}, NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, + {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}, NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, }) chains, err := cf.Chains(t.Name()) @@ -183,7 +188,7 @@ func TestInterchain_CreateUser(t *testing.T) { cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. - {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, + {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}, NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, }) chains, err := cf.Chains(t.Name()) @@ -359,8 +364,8 @@ func broadcastTxCosmosChainTest(t *testing.T, relayerImpl ibc.RelayerImplementat cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ // Two otherwise identical chains that only differ by ChainID. - {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}}, - {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}}, + {Name: "gaia", ChainName: "g1", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-0"}, NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, + {Name: "gaia", ChainName: "g2", Version: "v7.0.1", ChainConfig: ibc.ChainConfig{ChainID: "cosmoshub-1"}, NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, }) chains, err := cf.Chains(t.Name()) @@ -446,7 +451,7 @@ func TestInterchain_OmitGitSHA(t *testing.T) { client, network := interchaintest.DockerSetup(t) cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ - {Name: "gaia", Version: "v7.0.1"}, + {Name: "gaia", Version: "v7.0.1", NumValidators: &numVals, NumFullNodes: &numFullNodesZero}, }) chains, err := cf.Chains(t.Name())