diff --git a/.github/ISSUE_TEMPLATE/release-tracker.md b/.github/ISSUE_TEMPLATE/release-tracker.md index 482951e3819..afbb89f2915 100644 --- a/.github/ISSUE_TEMPLATE/release-tracker.md +++ b/.github/ISSUE_TEMPLATE/release-tracker.md @@ -66,7 +66,7 @@ versions of ibc-go to guarantee that no regression is introduced --> - [ ] In `docs/versions.json`. - [ ] Rename `docs/versioned_sidebars/version-vx.y.z-sidebars.json` - [ ] Rename `docs/versioned_docs/version-vx.y.z` -- [ ] Update the [compatibility test matrices](https://github.com/cosmos/ibc-go/tree/main/.github/compatibility-test-matrices): +- [ ] Ensure annotations on tests are correct as per the [compatibility test tool](../../scripts/compatibility.md): - Add the new release. - Remove any tags that might not be recommended anymore. - [ ] Update the manual [e2e `simd`](https://github.com/cosmos/ibc-go/blob/main/.github/workflows/e2e-manual-simd.yaml) test workflow: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f6d30419b75..546be4b85a9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} diff --git a/.github/workflows/e2e-test-workflow-call.yml b/.github/workflows/e2e-test-workflow-call.yml index 3cecca02363..96558e5c1fc 100644 --- a/.github/workflows/e2e-test-workflow-call.yml +++ b/.github/workflows/e2e-test-workflow-call.yml @@ -126,7 +126,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker if: ${{ inputs.build-and-push-docker-image }} id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} @@ -173,7 +173,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker if: ${{ inputs.build-and-push-docker-image-wasm }} id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME_WASM }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41f5490b7b0..b28afcd9f27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} diff --git a/cmd/build_test_matrix/main.go b/cmd/build_test_matrix/main.go index 052328dc5f4..ad77e04c50d 100644 --- a/cmd/build_test_matrix/main.go +++ b/cmd/build_test_matrix/main.go @@ -9,6 +9,7 @@ import ( "io/fs" "os" "path/filepath" + "slices" "sort" "strings" ) @@ -80,15 +81,6 @@ func getExcludedTestFunctions() []string { return strings.Split(exclusions, ",") } -func contains(s string, items []string) bool { - for _, elem := range items { - if elem == s { - return true - } - } - return false -} - // getGithubActionMatrixForTests returns a json string representing the contents that should go in the matrix // field in a github action workflow. This string can be used with `fromJSON(str)` to dynamically build // the workflow matrix to include all E2E tests under the e2eRootDirectory directory. @@ -115,11 +107,11 @@ func getGithubActionMatrixForTests(e2eRootDirectory, testName string, suite stri return nil } - if testName != "" && contains(testName, testCases) { + if testName != "" && slices.Contains(testCases, testName) { testCases = []string{testName} } - if contains(suiteNameForFile, excludedItems) { + if slices.Contains(excludedItems, suiteNameForFile) { return nil } diff --git a/e2e/Makefile b/e2e/Makefile index 34938edb50e..06aa012289e 100644 --- a/e2e/Makefile +++ b/e2e/Makefile @@ -16,7 +16,4 @@ e2e-test: init cleanup-ibc-test-containers e2e-suite: init cleanup-ibc-test-containers RUN_SUITE="true" ./scripts/run-e2e.sh "" $(entrypoint) -compatibility-tests: - ./scripts/run-compatibility-tests.sh $(release_branch) - -.PHONY: cleanup-ibc-test-containers e2e-test compatibility-tests init +.PHONY: cleanup-ibc-test-containers e2e-test init diff --git a/e2e/README.md b/e2e/README.md index 957733b2639..5aca98902ea 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -1,33 +1,19 @@ # Table of Contents -1. [How to write tests](#how-to-write-tests) - - a. [Adding a new test](#adding-a-new-test) - - b. [Running the tests with custom images](#running-tests-with-custom-images) -2. [Test design](#test-design) +1. [Running Tests](#running-tests) +2. [Adding a new test](#adding-a-new-test) +3. [Test design](#test-design) - a. [interchaintest](#interchaintest) - b. [CI configuration](#ci-configuration) -3. [Github Workflows](#github-workflows) -4. [Running Compatibility Tests](#running-compatibility-tests) -5. [Troubleshooting](#troubleshooting) -6. [Importable Workflow](#importable-workflow) +4. [Building images](#building-and-pushing-images) +5. [Compatibility Tests](#compatibility-tests) + - a. [Running Compatibility Tests](#running-compatibility-tests) + - b. [How Compatibility Tests Work](#how-compatibility-tests-work) +6. [Troubleshooting](#troubleshooting) +7. [Importable Workflow](#importable-workflow) +8. [Future Improvements](#future-improvements) -# How to write tests - -## Adding a new test - -All tests should go under the [e2e](https://github.com/cosmos/ibc-go/tree/main/e2e) directory. When adding a new test, either add a new test function -to an existing test suite ***in the same file***, or create a new test suite in a new file and add test functions there. -New test files should follow the convention of `module_name_test.go`. - -After creating a new test file, be sure to add a build constraint that ensures this file will **not** be included in the package to be built when -running tests locally via `make test`. For an example of this, see any of the existing test files. - -New test suites should be composed of `testsuite.E2ETestSuite`. This type has lots of useful helper functionality that will -be quite common in most tests. - -> Note: see [here](#how-tests-are-run) for details about these requirements. - -## Running tests with custom images +# Running tests Tests can be run using a Makefile target under the e2e directory. `e2e/Makefile` @@ -36,19 +22,18 @@ The tests can be configured using a configuration file or environment variables. See the [minimal example](./sample.config.yaml) or [extended example](./sample.config.extended.yaml) to get started. The default location the tests look is `~/.ibc-go-e2e-config.yaml` But this can be specified directly using the `E2E_CONFIG_PATH` environment variable. -The sample config contains comments outlining the available fields and their purpose. +It is possible to maintain multiple configuration files for tests. This can be useful when wanting to run the tests +using different images, relayers etc. + +By creating an `./e2e/dev-configs` directory, and placing any number of configurations there. You will be prompted to choose +which configuration to use when running tests. + +> Note: this requires fzf to be installed to support the interactive selection of configuration files. There are several environment variables that alter the behaviour of the make target which will override any options specified in your config file. These are primarily used for CI and are not required for local development. -| Environment Variable | Description | Default Value | -|----------------------|-------------------------------------------|-----------------------------| -| CHAIN_IMAGE | The image that will be used for the chain | ghcr.io/cosmos/ibc-go-simd | -| CHAIN_A_TAG | The tag used for chain A | N/A | -| CHAIN_B_TAG | The tag used for chain B | N/A | -| CHAIN_BINARY | The binary used in the container | simd | -| RELAYER_TAG | The tag used for the relayer | 1.10.0 | -| RELAYER_ID | The type of relayer to use (rly/hermes) | hermes | +See the extended sample config to understand all the available fields and their purposes. > Note: when running tests locally, **no images are pushed** to the `ghcr.io/cosmos/ibc-go-simd` registry. > The images which are used only exist locally only. @@ -58,6 +43,24 @@ These environment variables allow us to run tests with arbitrary versions (from Every time changes are pushed to a branch or to `main`, a new `simd` image is built and pushed [here](https://github.com/orgs/cosmos/packages?repo_name=ibc-go). +On PRs, E2E tests will only run once the PR is marked as ready for review. This is to prevent unnecessary test runs on PRs that are still in progress. + +> If you need the E2E tests to run, you can either run them locally, or you can mark the PR as R4R and then convert it back to a draft PR. + +## Adding a new test + +All tests should go under the [e2e](https://github.com/cosmos/ibc-go/tree/main/e2e) directory. When adding a new test, either add a new test function +to an existing test suite ***in the same file***, or create a new test suite in a new file and add test functions there. +New test files should follow the convention of `module_name_test.go`. + +After creating a new test file, be sure to add a build constraint that ensures this file will **not** be included in the package to be built when +running tests locally via `make test`. For an example of this, see any of the existing test files. + +New test suites should be composed of `testsuite.E2ETestSuite`. This type has lots of useful helper functionality that will +be quite common in most tests. + +> Note: see [here](#how-tests-are-run) for details about these requirements. + ### Example of running a single test > NOTE: environment variables can be set to override one or more config file variables, but the config file can still @@ -119,9 +122,9 @@ In order for tests to be run in parallel, we create the chains in `SetupSuite`, creating clients/connections/channels for itself. This is explicitly not being done in `SetupTest` to enable maximum control and flexibility over the channel creation -params. +params. e.g. some tests may not want a channel created initially, and may want more flexibility over the channel creation itself. -### When to use t.Parallel +### When to use t.Parallel() tests should **not** be run in parallel when: @@ -129,9 +132,9 @@ tests should **not** be run in parallel when: - the test needs to perform a chain restart. - the test must make assertions which may not be deterministic due to other tests. (e.g. the TotalEscrowForDenom may be modified between tests) -### CI configuration +### CI Configuration -There are two main github actions for e2e tests. +There are two main github actions for standard e2e tests. [e2e.yaml](https://github.com/cosmos/ibc-go/blob/main/.github/workflows/e2e.yaml) which runs when collaborators create branches. @@ -142,7 +145,7 @@ that is run uses the image that was built. In `e2e-fork.yaml`, images are not pushed to this registry, but instead remain local to the host runner. -## How tests are run +## How Tests Are Run The tests use the `matrix` feature of Github Actions. The matrix is dynamically generated using [this tool](https://github.com/cosmos/ibc-go/blob/main/cmd/build_test_matrix/main.go). @@ -150,8 +153,7 @@ dynamically generated using [this tool](https://github.com/cosmos/ibc-go/blob/ma > Note: there is currently a limitation that all tests belonging to a test suite must be in the same file. > In order to support test functions spread in different files, we would either need to manually maintain a matrix > or update the script to account for this. The script assumes there is a single test suite per test file to avoid an -> overly complex -> generation process. +> overly complex generation process. Which looks under the `e2e` directory, and creates a task for each test suite function. @@ -166,11 +168,10 @@ This string is used to generate a test matrix in the Github Action that runs the All tests will be run on different hosts when running `make e2e-test` but `make e2e-suite` will run multiple tests in parallel on a shared host. -### Miscellaneous - -## GitHub Workflows +In a CI environment variables are passed to the test runner to configure test parameters, while locally using +environment variables is supported, but it is often more convenient to use configuration files. -### Building and pushing a `simd` image +## Building and pushing images If we ever need to manually build and push an image, we can do so with the [Build Simd Image](../.github/workflows/build-simd-image-from-tag.yml) GitHub workflow. @@ -180,24 +181,31 @@ This can be triggered manually from the UI by navigating to And providing the git tag. -Alternatively, the [gh](https://cli.github.com/) CLI tool can be used to trigger this workflow. +> There are similar workflows for other simapps in the repo. -```bash -gh workflow run "Build Simd Image" -f tag=v3.0.0 -``` +## Compatibility Tests -## Running Compatibility Tests +### Running Compatibility Tests -To trigger the compatibility tests for a release branch, you can use the following command. - -```bash -make compatibility-tests release_branch=release/v5.0.x -``` +To trigger the compatibility tests for a release branch, you can trigger these manually from the Github UI. This will build an image from the tip of the release branch and run all tests specified in the corresponding -json matrix files under .github/compatibility-test-matrices and is equivalent to going to the Github UI and navigating to +json matrix files under [.github/compatibility-test-matrices](../.github/compatibility-test-matrices). + +Navigate to `Actions` -> `Compatibility E2E` -> `Run Workflow` -> `release/v8.0.x` + +> Note: this will spawn a large number of runners, and should only be used when there is a release candidate and +> and so should not be run regularly. We can rely on the regular E2Es on PRs for the most part. + +### How Compatibility Tests Work + +The compatibility tests are executed in [this workflow](../.github/workflows/e2e-compatibility.yaml). This workflow +will build an image for a specified release candidate based on the release branch as an input. And run the corresponding +jobs which are maintained under the `.github/compatibility-test-matrices` directory. + +> At the moment these are manually maintained, but in the future we may be able to generate these matrices dynamically. See the [future improvements](#future-improvements) section for more details. -`Actions` -> `Compatibility E2E` -> `Run Workflow` -> `release/v5.0.x` +See [this example](https://github.com/cosmos/ibc-go/actions/runs/11645461969) to what the output of a compatibility test run looks like. ## Troubleshooting @@ -215,19 +223,19 @@ json matrix files under .github/compatibility-test-matrices and is equivalent to ### Accessing Logs - When a test fails in GitHub. The logs of the test will be uploaded (viewable in the summary page of the workflow). Note: There - may be some discrepancy in the logs collected and the output of interchain test. The containers may run for a some + may be some discrepancy in the logs collected and the output of interchaintest. The containers may run for a some time after the logs are collected, resulting in the displayed logs to differ slightly. ## Importable Workflow -This repository contains an [importable workflow](https://github.com/cosmos/ibc-go/blob/185a220244663457372185992cfc85ed9e458bf1/.github/workflows/e2e-compatibility-workflow-call.yaml) that can be used from any other repository to test chain upgrades. The workflow +This repository contains an [importable workflow](../.github/workflows/e2e-test-workflow-call.yml) that can be used from any other repository to test two chains. The workflow can be used to test both non-IBC chains, and also IBC-enabled chains. ### Prerequisites - In order to run this workflow, a docker container is required with tags for the versions you want to test. -- Have an upgrade handler in the chain binary which is being upgraded to. +- If you are running an upgrade, Have an upgrade handler in the chain binary which is being upgraded to. > It's worth noting that all github repositories come with a built-in docker registry that makes it convenient to build and push images to. @@ -249,15 +257,21 @@ The referenced job will do the following: ### Workflow Options -| Workflow Field | Purpose | -|-------------------|---------------------------------------------------| -| chain-image | The docker image to use for the test | -| chain-a-tag | The tag of chain A to use | -| chain-b-tag | The tag of chain B to use | -| chain-upgrade-tag | The tag chain A should be upgraded to | -| chain-binary | The chain binary name | -| upgrade-plan-name | The name of the upgrade plan to execute | -| test-entry-point | Always TestUpgradeTestSuite | -| test | Should be TestIBCChainUpgrade or TestChainUpgrade | - -> TestIBCChainUpgrade should be used for ibc tests, while TestChainUpgrade should be used for single chain tests. +For a full list of options that can be passed to the workflow, see the [workflow file](../.github/workflows/e2e-test-workflow-call.yml). + +## Future Improvements + +- We are transitioning to running a single test per host, to running a full test suite per host. This will allow us to + run more tests in parallel and reduce the time it takes to run the full suite. (see `make e2e-test` and `make e2e-suite`). Eventually we would like to run all tests with `make e2e-suite`. + However, it may not be possible run compatibility tests in this fashion, as there was a concurrency issue in older versions of the SDK that caused chains to panic. See [this issue](https://github.com/cosmos/cosmos-sdk/pull/21073) for more details. + Because of this, it may be necessary to run compatibility tests in a single test per host fashion. +- When running `make e2e-suite` we currently pre-create relayers, as each test uses a different relayer. + An improvement would be to ensure that only enough relayers are created to satisfy the tests that are being run. This may require some changes to interchaintest and/or ibc-go test code. See [this issue](https://github.com/cosmos/ibc-go/issues/7578) for more details. +- There is a lot of duplication in the e2e test code. It would be nice to refactor the tests themselves to be more composable. For example, lots of tests perform an ics20 transfer, it would be nice to have + this logic abstracted away into a helper function and be able to call this function from multiple tests. +- We currently have some e2e workflows that may no longer be necessary, such as the [e2e manual simd](../.github/workflows/e2e-manual-simd.yaml). These manual dispatch workflows were utilized a lot in the past, but are not used as much anymore. + It may be safe to remove these in the future. See [this issue](https://github.com/cosmos/ibc-go/issues/7579) for more details. +- We currently are maintaining a lot of different simapps, all with different configurations and wiring in their app.gos. Ideally, we only need to maintain a single one. Some refactoring will be necessary to achieve this. See [this](https://github.com/cosmos/ibc-go/issues/4527) related issue. +- The current parallel tests establish a connection and run each test on a different channel. This will need to be refactored once the concept Eureka is shipped, however consideration will need to be made for backwards compatibility tests. Both flows may need to be supported. +- CI still relies on passing lots of environment variables, it should be possible to provide a default CI configuration file to be used, and override specifics such as chain image, relayer image, etc. with environment variables. Or template configuration files in some way. This is tracked [here](https://github.com/cosmos/ibc-go/issues/4697). +- Currently, there is a single denom used for all tests. Ideally, there is a dynamically generated denom used on a per test level. The fact that a single denom is shared means certain features may not be testable in parallel, for example [this](https://github.com/cosmos/ibc-go/blob/main/e2e/tests/transfer/base_test.go#L94-L101). diff --git a/e2e/relayer/relayer.go b/e2e/relayer/relayer.go index 4b05f4801c8..b299cf5e5f0 100644 --- a/e2e/relayer/relayer.go +++ b/e2e/relayer/relayer.go @@ -189,7 +189,7 @@ func (r Map) AddRelayer(testName string, ibcrelayer ibc.Wallet) { r[testName][ibcrelayer] = true } -// containsRelayer returns true if the given relayer is in the relayer set for the given test name. +// ContainsRelayer returns true if the given relayer is in the relayer set for the given test name. func (r Map) ContainsRelayer(testName string, wallet ibc.Wallet) bool { if relayerSet, ok := r[testName]; ok { return relayerSet[wallet] diff --git a/e2e/sample.config.extended.yaml b/e2e/sample.config.extended.yaml index 034dc396c43..f14db4912dd 100644 --- a/e2e/sample.config.extended.yaml +++ b/e2e/sample.config.extended.yaml @@ -34,16 +34,20 @@ chains: binary: simd # override with CHAIN_BINARY activeRelayer: hermes # override with RELAYER_ID + +# relayers provides a list all possible relayers that will be usable within a test +# NOTE: the activeRelayer field, must match the id specified in one of the relayers in this list. +# if that is not the case, validation will fail. relayers: - id: hermes image: ghcr.io/informalsystems/hermes - tag: "1.10.0" + tag: "1.10.0" # override with RELAYER_TAG - id: rly image: ghcr.io/cosmos/relayer - tag: "latest" + tag: "latest" # override with RELAYER_TAG - id: hyperspace image: ghcr.io/misko9/hyperspace - tag: "20231122v39" + tag: "20231122v39" # override with RELAYER_TAG cometbft: logLevel: info diff --git a/e2e/sample.config.yaml b/e2e/sample.config.yaml index 5078409239b..0ba94f405d6 100644 --- a/e2e/sample.config.yaml +++ b/e2e/sample.config.yaml @@ -1,17 +1,5 @@ # This file contains a bare minimum configuration for running e2e tests. - -# | Environment Variable | Description | Default Value | -# |----------------------|-------------------------------------------|------------------------------| -# | CHAIN_IMAGE | The image that will be used for the chain | ghcr.io/cosmos/ibc-go-simd | -# | CHAIN_A_TAG | The tag used for chain A | N/A | -# | CHAIN_B_TAG | The tag used for chain B | N/A | -# | CHAIN_BINARY | The binary used in the container | simd | -# | RELAYER_TAG | The tag used for the relayer | 1.10.0 | -# | RELAYER_ID | The type of relayer to use (rly/hermes) | hermes | - -# see sample.config.extended.yaml for a fully configured sample. -# set env E2E_CONFIG_PATH to point to this file to use it. - +# for a more detailed configuration, see sample.config.extended.yaml. --- chains: - tag: main # override with CHAIN_A_TAG diff --git a/e2e/scripts/run-compatibility-tests.sh b/e2e/scripts/run-compatibility-tests.sh deleted file mode 100755 index 76ef12a5e5d..00000000000 --- a/e2e/scripts/run-compatibility-tests.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -Eeou pipefail - -function run_full_compatibility_suite(){ - local release_branch="${1}" - gh workflow run e2e-compatibility.yaml -f release-branch=${release_branch} - sleep 5 # can take some time for the workflow to appear - run_id="$(gh run list "--workflow=e2e-compatibility.yaml" | grep workflow_dispatch | grep -Eo "[0-9]{9,11}" | head -n 1)" - gh run view ${run_id} --web -} - -RELEASE_BRANCH="${1}" -run_full_compatibility_suite "${RELEASE_BRANCH}" diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index a9fea76d06c..3c5af5cd44a 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -430,12 +430,12 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop }) } -// compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal:skip +// compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal:skip:true func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulSubmitGovProposal() { s.testMsgSendTxSuccessfulGovProposal(channeltypes.ORDERED) } -// compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal_UnorderedChannel:skip +// compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal_UnorderedChannel:skip:true func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulSubmitGovProposal_UnorderedChannel() { s.testMsgSendTxSuccessfulGovProposal(channeltypes.UNORDERED) } diff --git a/e2e/testsuite/codec.go b/e2e/testsuite/codec.go index c65c9a0c8c0..97dec64d47c 100644 --- a/e2e/testsuite/codec.go +++ b/e2e/testsuite/codec.go @@ -55,6 +55,8 @@ func SDKEncodingConfig() *testutil.TestEncodingConfig { } } +// codecAndEncodingConfig returns the codec and encoding config used in the E2E tests. +// Note: any new types added to the codec must be added here. func codecAndEncodingConfig() (*codec.ProtoCodec, testutil.TestEncodingConfig) { cfg := testutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}) diff --git a/e2e/testsuite/testconfig.go b/e2e/testsuite/testconfig.go index b44ccc30363..d232a8773d3 100644 --- a/e2e/testsuite/testconfig.go +++ b/e2e/testsuite/testconfig.go @@ -634,7 +634,7 @@ func newDefaultSimappConfig(cc ChainConfig, name, chainID, denom string, cometCf configFileOverrides := make(map[string]any) tmTomlOverrides := make(interchaintestutil.Toml) - tmTomlOverrides["log_level"] = cometCfg.LogLevel // change to debug in ~/.ibc-go-e2e-config.json to increase cometbft logging. + tmTomlOverrides["log_level"] = cometCfg.LogLevel // change to debug in the e2e test config to increase cometbft logging. configFileOverrides["config/config.toml"] = tmTomlOverrides return ibc.ChainConfig{ diff --git a/e2e/testsuite/tx.go b/e2e/testsuite/tx.go index 6642c210e29..4feeeb47f86 100644 --- a/e2e/testsuite/tx.go +++ b/e2e/testsuite/tx.go @@ -37,7 +37,7 @@ import ( ) // BroadcastMessages broadcasts the provided messages to the given chain and signs them on behalf of the provided user. -// Once the broadcast response is returned, we wait for a few blocks to be created on both chain A and chain B. +// Once the broadcast response is returned, we wait for a few blocks to be created on the chain the message was broadcast to. func (s *E2ETestSuite) BroadcastMessages(ctx context.Context, chain ibc.Chain, user ibc.Wallet, msgs ...sdk.Msg) sdk.TxResponse { cosmosChain, ok := chain.(*cosmos.CosmosChain) if !ok { diff --git a/modules/apps/callbacks/go.mod b/modules/apps/callbacks/go.mod index 80042021b10..15a24c408c3 100644 --- a/modules/apps/callbacks/go.mod +++ b/modules/apps/callbacks/go.mod @@ -17,7 +17,6 @@ require ( cosmossdk.io/log v1.5.0 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1 - cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/accounts v0.0.0-20240913065641-0064ccbce64e cosmossdk.io/x/accounts/defaults/base v0.0.0-20241108095921-406f977be0b9 cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 @@ -47,8 +46,6 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/spf13/cast v1.7.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 ) @@ -71,7 +68,6 @@ require ( github.com/DataDog/zstd v1.5.6 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/aws/aws-sdk-go v1.54.6 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect @@ -99,8 +95,6 @@ require ( github.com/cosmos/iavl v1.3.1 // indirect github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/creachadair/atomicfile v0.3.1 // indirect - github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect @@ -163,19 +157,15 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/linxGnu/grocksdb v1.9.3 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/mdp/qrterminal/v3 v3.2.0 // indirect github.com/minio/highwayhash v1.0.3 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/muesli/termenv v0.15.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect @@ -188,7 +178,6 @@ require ( github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect @@ -197,7 +186,9 @@ require ( github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.13 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -238,7 +229,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect pgregory.net/rapid v1.1.0 // indirect - rsc.io/qr v0.2.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/modules/apps/callbacks/go.sum b/modules/apps/callbacks/go.sum index 558104fe679..09fb4867814 100644 --- a/modules/apps/callbacks/go.sum +++ b/modules/apps/callbacks/go.sum @@ -214,8 +214,6 @@ cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ6 cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/store v1.0.0-rc.0.0.20240906090851-36d9b25e8981 h1:O510vQpVdyZgSlLm4NG2aQltDkKfoWcKrVCPPWQlNHs= cosmossdk.io/store v1.0.0-rc.0.0.20240906090851-36d9b25e8981/go.mod h1:5lnCUSlWPWQYrUcNjpqBLTnlykyz1NeGQpMmZq1DCOg= -cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= -cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= cosmossdk.io/x/accounts v0.0.0-20241108061010-a0458127fccf h1:iDymYoV4/JayuquNG5niu4JR0/ylaX+bmXk8wGlqG74= cosmossdk.io/x/accounts v0.0.0-20241108061010-a0458127fccf/go.mod h1:NhLpCB056huDyXxcLDbCgm4deO293HO9b6/Xl1Ha2nQ= cosmossdk.io/x/accounts/defaults/base v0.0.0-20241108095921-406f977be0b9 h1:bCBkUT3caCwOf5U9Os96dUETHPs6Cdv9oF5LCjt1tJs= @@ -293,8 +291,6 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.54.6 h1:HEYUib3yTt8E6vxjMWM3yAq5b+qjj/6aKA62mkgux9g= github.com/aws/aws-sdk-go v1.54.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -401,10 +397,6 @@ github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIG github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= -github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= -github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= -github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= @@ -701,8 +693,6 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= @@ -720,11 +710,7 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mdp/qrterminal/v3 v3.2.0 h1:qteQMXO3oyTK4IHwj2mWsKYYRBOp1Pj2WRYFYYNTCdk= -github.com/mdp/qrterminal/v3 v3.2.0/go.mod h1:XGGuua4Lefrl7TLEsSONiD+UEjQXJZ4mPzF+gWYIJkk= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -739,8 +725,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= -github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -808,8 +792,6 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -1505,8 +1487,6 @@ nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYm pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= -rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= diff --git a/modules/apps/callbacks/testing/simapp/ante_handler.go b/modules/apps/callbacks/testing/simapp/ante_handler.go index c938378a2c2..a32cf8b4141 100644 --- a/modules/apps/callbacks/testing/simapp/ante_handler.go +++ b/modules/apps/callbacks/testing/simapp/ante_handler.go @@ -3,8 +3,6 @@ package simapp import ( "errors" - circuitante "cosmossdk.io/x/circuit/ante" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -15,8 +13,7 @@ import ( // HandlerOptions are the options required for constructing a default SDK AnteHandler. type HandlerOptions struct { ante.HandlerOptions - CircuitKeeper circuitante.CircuitBreaker - IBCKeeper *keeper.Keeper + IBCKeeper *keeper.Keeper } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -37,7 +34,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(options.Environment, options.ConsensusKeeper), // outermost AnteDecorator. SetUpContext must be called first - circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(options.Environment), ante.NewTxTimeoutHeightDecorator(options.Environment), diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index 00a1148747c..818ec035426 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -720,7 +720,6 @@ func NewSimApp( distrtypes.ModuleName, pooltypes.ModuleName, slashingtypes.ModuleName, - evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, @@ -737,7 +736,6 @@ func NewSimApp( ibcexported.ModuleName, ibctransfertypes.ModuleName, genutiltypes.ModuleName, - feegrant.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, @@ -895,8 +893,7 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { SigGasConsumer: ante.DefaultSigVerificationGasConsumer, UnorderedTxManager: app.UnorderedTxManager, }, - CircuitKeeper: &app.CircuitKeeper, - IBCKeeper: app.IBCKeeper, + IBCKeeper: app.IBCKeeper, }, ) if err != nil { diff --git a/modules/apps/callbacks/testing/simapp/export.go b/modules/apps/callbacks/testing/simapp/export.go index bbdcf491ea0..45642fa1064 100644 --- a/modules/apps/callbacks/testing/simapp/export.go +++ b/modules/apps/callbacks/testing/simapp/export.go @@ -10,12 +10,10 @@ import ( "cosmossdk.io/x/staking" stakingtypes "cosmossdk.io/x/staking/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - cmttypes "github.com/cometbft/cometbft/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis @@ -43,24 +41,10 @@ func (app *SimApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAd } validators, err := staking.WriteValidators(ctx, app.StakingKeeper) - cmtValidators := []cmttypes.GenesisValidator{} - for _, val := range validators { - cmtPk, err := cryptocodec.ToCmtPubKeyInterface(val.PubKey) - if err != nil { - return servertypes.ExportedApp{}, err - } - cmtVal := cmttypes.GenesisValidator{ - Address: val.Address.Bytes(), - PubKey: cmtPk, - Power: val.Power, - Name: val.Name, - } - cmtValidators = append(cmtValidators, cmtVal) - } return servertypes.ExportedApp{ AppState: appState, - Validators: cmtValidators, + Validators: validators, Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), }, err diff --git a/modules/apps/callbacks/testing/simapp/simd/cmd/root.go b/modules/apps/callbacks/testing/simapp/simd/cmd/root.go deleted file mode 100644 index 8dd01aeba79..00000000000 --- a/modules/apps/callbacks/testing/simapp/simd/cmd/root.go +++ /dev/null @@ -1,341 +0,0 @@ -package cmd - -import ( - "errors" - "io" - "os" - - dbm "github.com/cosmos/cosmos-db" - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "cosmossdk.io/client/v2/offchain" - corestore "cosmossdk.io/core/store" - "cosmossdk.io/log" - confixcmd "cosmossdk.io/tools/confix/cmd" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/debug" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/pruning" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/client/snapshot" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - - cmtcfg "github.com/cometbft/cometbft/config" - - "github.com/cosmos/ibc-go/modules/apps/callbacks/testing/simapp" - "github.com/cosmos/ibc-go/modules/apps/callbacks/testing/simapp/params" -) - -// NewRootCmd creates a new root command for simd. It is called once in the -// main function. -func NewRootCmd() *cobra.Command { - // we "pre"-instantiate the application for getting the injected/configured encoding configuration - // note, this is not necessary when using app wiring, as depinject can be directly used (see root_v2.go) - tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(tempDir())) - encodingConfig := params.EncodingConfig{ - InterfaceRegistry: tempApp.InterfaceRegistry(), - Codec: tempApp.AppCodec(), - TxConfig: tempApp.TxConfig(), - Amino: tempApp.LegacyAmino(), - } - - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(simapp.DefaultNodeHome). - WithViper("") // In simapp, we don't use any prefix for env variables. - - rootCmd := &cobra.Command{ - Use: "simd", - Short: "simulation app", - SilenceErrors: true, - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - - initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - // This needs to go after ReadFromClientConfig, as that function - // sets the RPC client needed for SIGN_MODE_TEXTUAL. - enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) //nolint:gocritic // we know we aren't appending to the same slice - txConfigOpts := tx.ConfigOptions{ - EnabledSignModes: enabledSignModes, - TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), - } - txConfigWithTextual, err := tx.NewTxConfigWithOptions( - codec.NewProtoCodec(encodingConfig.InterfaceRegistry), - txConfigOpts, - ) - if err != nil { - return err - } - initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - customAppTemplate, customAppConfig := initAppConfig() - customCMTConfig := initCometBFTConfig() - - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) - }, - } - - initRootCmd(rootCmd, tempApp.ModuleManager) - - if err := tempApp.AutoCliOpts().EnhanceRootCommand(rootCmd); err != nil { - panic(err) - } - - return rootCmd -} - -// initCometBFTConfig helps to override default CometBFT Config values. -// return cmtcfg.DefaultConfig if no custom configuration is required for the application. -func initCometBFTConfig() *cmtcfg.Config { - cfg := cmtcfg.DefaultConfig() - - // these values put a higher strain on node memory - // cfg.P2P.MaxNumInboundPeers = 100 - // cfg.P2P.MaxNumOutboundPeers = 40 - - return cfg -} - -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - // WASMConfig defines configuration for the wasm module. - type WASMConfig struct { - // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries - QueryGasLimit uint64 `mapstructure:"query_gas_limit"` - - // Address defines the gRPC-web server to listen on - LruSize uint64 `mapstructure:"lru_size"` - } - - type CustomAppConfig struct { - serverconfig.Config - - WASM WASMConfig `mapstructure:"wasm"` - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0stake" - // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, - WASM: WASMConfig{ - LruSize: 1, - QueryGasLimit: 300000, - }, - } - - customAppTemplate := serverconfig.DefaultConfigTemplate + ` -[wasm] -# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries -query_gas_limit = 300000 -# This is the number of wasm vm instances we keep cached in memory for speed-up -# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally -lru_size = 0` - - return customAppTemplate, customAppConfig -} - -func initRootCmd(rootCmd *cobra.Command, moduleManager *module.Manager) { - cfg := sdk.GetConfig() - cfg.Seal() - - rootCmd.AddCommand( - genutilcli.InitCmd(moduleManager), - debug.Cmd(), - confixcmd.ConfigCommand(), - pruning.Cmd(newApp), - snapshot.Cmd(newApp), - server.QueryBlockResultsCmd(), - ) - - server.AddCommands(rootCmd, newApp, server.StartCmdOptions[servertypes.Application]{}) - - // add keybase, auxiliary RPC, query, genesis, and tx child commands - rootCmd.AddCommand( - server.StatusCommand(), - genesisCommand(moduleManager, appExport), - queryCommand(), - txCommand(), - keys.Commands(), - offchain.OffChain(), - ) -} - -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - rpc.WaitTxCmd(), - server.QueryBlockCmd(), - authcmd.QueryTxsByEventsCmd(), - server.QueryBlocksCmd(), - authcmd.QueryTxCmd(), - authcmd.GetSimulateCmd(), - ) - - return cmd -} - -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetMultiSignBatchCmd(), - authcmd.GetValidateSignaturesCommand(), - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - authcmd.GetSimulateCmd(), - ) - - return cmd -} - -// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(moduleManager *module.Manager, appExport servertypes.AppExporter, cmds ...*cobra.Command) *cobra.Command { - cmd := genutilcli.Commands(moduleManager.Modules[genutiltypes.ModuleName].(genutil.AppModule), moduleManager, appExport) - for _, subCmd := range cmds { - cmd.AddCommand(subCmd) - } - return cmd -} - -// newApp creates the application -func newApp( - logger log.Logger, - db corestore.KVStoreWithBatch, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - baseappOptions := server.DefaultBaseappOptions(appOpts) - - return simapp.NewSimApp( - logger, db, traceStore, true, - appOpts, - baseappOptions..., - ) -} - -// appExport creates a new simapp (optionally at a given height) and exports state. -func appExport( - logger log.Logger, - db corestore.KVStoreWithBatch, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - var simApp *simapp.SimApp - - // this check is necessary as we use the flag in x/upgrade. - // we can exit more gracefully by checking the flag here. - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home not set") - } - - viperAppOpts, ok := appOpts.(*viper.Viper) - if !ok { - return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") - } - - // overwrite the FlagInvCheckPeriod - viperAppOpts.Set(server.FlagInvCheckPeriod, 1) - appOpts = viperAppOpts - - if height != -1 { - simApp = simapp.NewSimApp(logger, db, traceStore, false, appOpts) - - if err := simApp.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } else { - simApp = simapp.NewSimApp(logger, db, traceStore, true, appOpts) - } - - return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) -} - -var tempDir = func() string { - dir, err := os.MkdirTemp("", "simapp") - if err != nil { - dir = simapp.DefaultNodeHome - } - defer os.RemoveAll(dir) - - return dir -} diff --git a/modules/core/23-commitment/types/bench_test.go b/modules/core/23-commitment/types/bench_test.go deleted file mode 100644 index 83794fc6f6e..00000000000 --- a/modules/core/23-commitment/types/bench_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import ( - "testing" -) - -func BenchmarkMerkleProofEmpty(b *testing.B) { - b.ReportAllocs() - var mk MerkleProof - for i := 0; i < b.N; i++ { - if !mk.Empty() { - b.Fatal("supposed to be empty") - } - } -} diff --git a/modules/core/23-commitment/types/merkle.go b/modules/core/23-commitment/types/merkle.go index 80b867fb89f..9b6e4b0d073 100644 --- a/modules/core/23-commitment/types/merkle.go +++ b/modules/core/23-commitment/types/merkle.go @@ -3,14 +3,11 @@ package types import ( "bytes" - "github.com/cosmos/gogoproto/proto" ics23 "github.com/cosmos/ics23/go" errorsmod "cosmossdk.io/errors" - cmtprotocrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" - - v2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" + "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -86,19 +83,16 @@ func ApplyPrefix(prefix exported.Prefix, path v2.MerklePath) (v2.MerklePath, err // VerifyMembership verifies the membership of a merkle proof against the given root, path, and value. // Note that the path is expected as []string{, }. func (proof MerkleProof) VerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, value []byte) error { - if err := proof.validateVerificationArgs(specs, root); err != nil { - return err - } - - // VerifyMembership specific argument validation mpath, ok := path.(v2.MerklePath) if !ok { return errorsmod.Wrapf(ErrInvalidProof, "path %v is not of type MerklePath", path) } - if len(mpath.KeyPath) != len(specs) { - return errorsmod.Wrapf(ErrInvalidProof, "path length %d not same as proof %d", - len(mpath.KeyPath), len(specs)) + + if err := validateVerificationArgs(proof, mpath, specs, root); err != nil { + return err } + + // VerifyMembership specific argument validation if len(value) == 0 { return errorsmod.Wrap(ErrInvalidProof, "empty value in membership proof") } @@ -112,17 +106,13 @@ func (proof MerkleProof) VerifyMembership(specs []*ics23.ProofSpec, root exporte // VerifyNonMembership verifies a chained proof where the absence of a given path is proven // at the lowest subtree and then each subtree's inclusion is proved up to the final root. func (proof MerkleProof) VerifyNonMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path) error { - if err := proof.validateVerificationArgs(specs, root); err != nil { - return err - } - - // VerifyNonMembership specific argument validation mpath, ok := path.(v2.MerklePath) if !ok { return errorsmod.Wrapf(ErrInvalidProof, "path %v is not of type MerkleProof", path) } - if len(mpath.KeyPath) != len(specs) { - return errorsmod.Wrapf(ErrInvalidProof, "path length %d not same as proof %d", len(mpath.KeyPath), len(specs)) + + if err := validateVerificationArgs(proof, mpath, specs, root); err != nil { + return err } // VerifyNonMembership will verify the absence of key in lowest subtree, and then chain inclusion proofs @@ -198,30 +188,13 @@ func verifyChainedMembershipProof(root []byte, specs []*ics23.ProofSpec, proofs return nil } -// blankMerkleProof and blankProofOps will be used to compare against their zero values, -// and are declared as globals to avoid having to unnecessarily re-allocate on every comparison. -var ( - blankMerkleProof = &MerkleProof{} - blankProofOps = &cmtprotocrypto.ProofOps{} -) - -// Empty returns true if the root is empty -func (proof *MerkleProof) Empty() bool { - return proof == nil || proto.Equal(proof, blankMerkleProof) || proto.Equal(proof, blankProofOps) -} - -// ValidateBasic checks if the proof is empty. -func (proof MerkleProof) ValidateBasic() error { - if proof.Empty() { - return ErrInvalidProof - } - return nil -} - -// validateVerificationArgs verifies the proof arguments are valid -func (proof MerkleProof) validateVerificationArgs(specs []*ics23.ProofSpec, root exported.Root) error { - if proof.Empty() { - return errorsmod.Wrap(ErrInvalidMerkleProof, "proof cannot be empty") +// validateVerificationArgs verifies the proof arguments are valid. +// The merkle path and merkle proof contain a list of keys and their proofs +// which correspond to individual trees. The length of these keys and their proofs +// must equal the length of the given specs. All arguments must be non-empty. +func validateVerificationArgs(proof MerkleProof, path v2.MerklePath, specs []*ics23.ProofSpec, root exported.Root) error { + if proof.GetProofs() == nil { + return errorsmod.Wrap(ErrInvalidMerkleProof, "proof must not be empty") } if root == nil || root.Empty() { @@ -229,9 +202,11 @@ func (proof MerkleProof) validateVerificationArgs(specs []*ics23.ProofSpec, root } if len(specs) != len(proof.Proofs) { - return errorsmod.Wrapf(ErrInvalidMerkleProof, - "length of specs: %d not equal to length of proof: %d", - len(specs), len(proof.Proofs)) + return errorsmod.Wrapf(ErrInvalidMerkleProof, "length of specs: %d not equal to length of proof: %d", len(specs), len(proof.Proofs)) + } + + if len(path.KeyPath) != len(specs) { + return errorsmod.Wrapf(ErrInvalidProof, "path length %d not same as proof %d", len(path.KeyPath), len(specs)) } for i, spec := range specs { diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index dd1ec4e6172..9c8657cc237 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -27,9 +27,6 @@ func (suite *MerkleTestSuite) TestVerifyMembership() { proof, err := types.ConvertProofs(res.ProofOps) require.NoError(suite.T(), err) - suite.Require().NoError(proof.ValidateBasic()) - suite.Require().Error(types.MerkleProof{}.ValidateBasic()) - cases := []struct { name string root []byte @@ -93,8 +90,6 @@ func (suite *MerkleTestSuite) TestVerifyNonMembership() { proof, err := types.ConvertProofs(res.ProofOps) require.NoError(suite.T(), err) - suite.Require().NoError(proof.ValidateBasic()) - cases := []struct { name string root []byte diff --git a/scripts/compatibility.md b/scripts/compatibility.md index c65638794d0..a93aa2d178c 100644 --- a/scripts/compatibility.md +++ b/scripts/compatibility.md @@ -35,6 +35,6 @@ The following annotations are supported: |-------------------------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| | from_version | v7.4.0 | Tests should only run if a semver comparison is greater than or equal to this version. Generally this will just be the minimum supported version of ibc-go | // compatibility:from_version:v7.4.0 | | TEST_NAME:from_versions | v8.4.0,v8.5.0,v9.0.0 | For some tests, they should only be run against a specific release line. This annotation is test case specific, and ensures the test case is run based on the major and minor versions specified. If a version is provided to the tool, and a matching major minor version is not listed, the test will be skipped. | // compatibility:TestScheduleIBCUpgrade_Succeeds:from_versions: v8.4.0,v8.5.0,v9.0.0 | -| TEST_NAME:skip | skip | A flag to ensure that this test is not included in the compatibility tests at all. | // compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal:skip | +| TEST_NAME:skip | true | A flag to ensure that this test is not included in the compatibility tests at all. | // compatibility:TestMsgSendTx_SuccessfulSubmitGovProposal:skip:true | > Note: if additional control is required, the script can be modified to support additional annotations. diff --git a/scripts/generate-compatibility-json.py b/scripts/generate-compatibility-json.py index b5ba15391c9..3ca6e0d56b9 100755 --- a/scripts/generate-compatibility-json.py +++ b/scripts/generate-compatibility-json.py @@ -206,7 +206,7 @@ def _test_should_be_run(test_name: str, version: str, file_fields: Dict) -> bool """ # the test has been explicitly marked to be skipped for compatibility tests. - if file_fields.get(f"{test_name}:{SKIP}") is not None: + if file_fields.get(f"{test_name}:{SKIP}") == "true": return False test_semver_version = parse_version(version)