diff --git a/.circleci/config.yml b/.circleci/config.yml index 45fb8d2bda..fbe4754bf7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ orbs: executors: golang: docker: - - image: cimg/go:1.20 + - image: cimg/go:1.21 commands: make: @@ -97,11 +97,11 @@ jobs: - "profiles/*" - store_artifacts: path: /tmp/logs - + test-system: executor: golang parallelism: 1 - resource_class: large + resource_class: xlarge steps: - attach_workspace: at: /tmp/workspace @@ -112,6 +112,13 @@ jobs: - run: name: Build and run system tests command: make test-system + - run: + command: | + mkdir -p /tmp/system-test-workspace + mv /home/circleci/project/tests/system/testnet /tmp/system-test-workspace + when: on_fail + - store_artifacts: + path: /tmp/system-test-workspace benchmark: executor: golang @@ -135,7 +142,7 @@ jobs: simulations: executor: golang parallelism: 1 - resource_class: large + resource_class: xlarge steps: - checkout - run: @@ -182,7 +189,7 @@ jobs: command: | IN_DOCKER=$(docker run --rm "cosmwasm/wasmd:${CIRCLE_SHA1}" /usr/bin/wasmd query wasm libwasmvm-version) echo "Runtime libwasmvm-version in docker: $IN_DOCKER" - IN_GOMOD=$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2) + IN_GOMOD=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d" " -f2 | cut -d"v" -f2) echo "wasmvm version in go.mod: $IN_GOMOD" if [[ "$IN_DOCKER" != "$IN_GOMOD" ]]; then echo "Mismatch of wasmvm versions detected" @@ -190,7 +197,7 @@ jobs: fi - when: condition: - equal: [ main, << pipeline.git.branch >> ] + equal: [main, << pipeline.git.branch >>] steps: - run: name: Push application Docker image to docker hub diff --git a/.codecov.yml b/.codecov.yml index 02822ff766..ee13027e9f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -45,7 +45,6 @@ flags: ignore: - "cmd/" - - "contrib/" - "docs/" - "docker/" - "scripts/" diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..0300f70514 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[{Makefile,*.go}] +indent_style = tab +indent_size = 4 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 0cafc186e0..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,5 +0,0 @@ -# CODEOWNERS: https://help.github.com/articles/about-codeowners/ - -# Primary repo maintainers -* @ethanfrey -* @alpe diff --git a/.github/workflows/codeql-analizer.yml b/.github/workflows/codeql-analizer.yml index 7595b36a08..571fe8a0d0 100644 --- a/.github/workflows/codeql-analizer.yml +++ b/.github/workflows/codeql-analizer.yml @@ -19,17 +19,17 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4.0.0 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: 'go' queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/proto-buf-publisher.yml b/.github/workflows/proto-buf-publisher.yml index 48c3194228..2e718b37fd 100644 --- a/.github/workflows/proto-buf-publisher.yml +++ b/.github/workflows/proto-buf-publisher.yml @@ -16,8 +16,8 @@ jobs: push: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.0.0 - - uses: bufbuild/buf-setup-action@v1.26.1 + - uses: actions/checkout@v4 + - uses: bufbuild/buf-setup-action@v1.30.1 # lint checks - uses: bufbuild/buf-lint-action@v1 diff --git a/.github/workflows/staticmajor.yml b/.github/workflows/staticmajor.yml new file mode 100644 index 0000000000..bc1b28fa58 --- /dev/null +++ b/.github/workflows/staticmajor.yml @@ -0,0 +1,25 @@ +# Staticmajor: Static analyzer to catch leaking resources & other bad code patterns +name: Detect leaking resources and bad code patterns +on: + pull_request: + paths: + - "**.go" + push: + branches: [ main ] + paths: + - "**.go" + +jobs: + run_staticmajor: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Staticmajor action + id: staticmajor + uses: orijtech/staticmajor-action@main + with: + packages: ./... + resleak: true + structslop: false + tests: false diff --git a/.gitignore b/.gitignore index f5f5405d3a..c876483219 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,3 @@ dependency-graph.png *.aux *.out *.synctex.gz -contract_tests/* diff --git a/.mergify.yml b/.mergify.yml index 59bc41bdd0..32ea628b42 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -6,7 +6,7 @@ queue_rules: pull_request_rules: - name: backport patches to main branch conditions: - - base=releases/v0.40.x + - base=releases/v0.4x - label=backport/main actions: backport: @@ -20,11 +20,11 @@ pull_request_rules: backport: branches: - releases/v0.3x - - name: backport patches to v0.40.x release branch + - name: backport patches to sdk47 release branch conditions: - base=main - - label=backport/v0.40.x + - label=backport/v0.4x actions: backport: branches: - - releases/v0.40.x + - releases/v0.4x diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f8efbb9c..6999d6fa21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,34 +2,62 @@ ## [Unreleased](https://github.com/CosmWasm/wasmd/tree/HEAD) -[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.40.2...HEAD) - -## [v0.40.2](https://github.com/CosmWasm/wasmd/tree/v0.40.2) (2023-06-09) - -[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.40.1...v0.40.2) - -This patch release includes only the cosmos-sdk upgrade to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3). -It solves [barberry](https://forum.cosmos.network/t/cosmos-sdk-security-advisory-barberry/10825) security vulnerability. +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.51.0...HEAD) + +# [v0.51.0](https://github.com/CosmWasm/wasmd/tree/v0.51.0) (2024-04-22) + +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.50.0...v0.51.0) + +- Bump cosmos-sdk to v0.50.6 [#1865](https://github.com/CosmWasm/wasmd/pull/1865) +- Bump tx module to v0.13.3 [#1864](https://github.com/CosmWasm/wasmd/pull/1864) +- Fix Amino JSON representation [\#1844](https://github.com/CosmWasm/wasmd/pull/1844) +- Add BuiltInCapabilities() to x/wasm/keeper and deprecate AllCapabilities() [#1855](https://github.com/CosmWasm/wasmd/pull/1855) +- Move contrib/ in scripts/ [\#1848](https://github.com/CosmWasm/wasmd/pull/1848) +- Remove contract_tests [\#1847](https://github.com/CosmWasm/wasmd/pull/1847) +- Upgrade Alpine in Dockerfile to 3.18 [\#1837](https://github.com/CosmWasm/wasmd/pull/1837) +- Bump wasmvm to 2.0.0 [\#1832](https://github.com/CosmWasm/wasmd/pull/1832) +- Rename gas to gasLeft [\#1820](https://github.com/CosmWasm/wasmd/pull/1820) +- Fix misleading error message for duplicate address on instantiate2 [\#1816](https://github.com/CosmWasm/wasmd/pull/1816) +- Rewrite compatibility section in README [\#1805](https://github.com/CosmWasm/wasmd/pull/1805) +- Generalize "pinned" to "discount" for cases where contract is in memory [\#1799](https://github.com/CosmWasm/wasmd/pull/1799) +- Rename InstantiateContractCosts -> SetupContractCost; Remove NewContractInstanceCosts [\#1797](https://github.com/CosmWasm/wasmd/pull/1797) +- Bump cosmos-sdk proto to v0.50.0 [\#1795](https://github.com/CosmWasm/wasmd/pull/1795) +- Fix grant contract cli command description [\#1778](https://github.com/CosmWasm/wasmd/issues/1778) +- Add Build Address gRPC Query [\#1753](https://github.com/CosmWasm/wasmd/pull/1753) ### Notable changes: -- Upgrade cosmos-sdk to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3) +- Upgrade to [CosmWasm 2.0.0](https://github.com/CosmWasm/wasmvm/releases/tag/v2.0.0) +- Upgrade to [SDK v0.50.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.6) patch release of Cosmos SDK Eden ### Migration notes: -- This release does not include any state migrations or breaking changes, therefore a coordinated chain upgrade is not required. +- This release does not include any state migrations but breaking changes that require a coordinated chain upgrade. -## [v0.40.1](https://github.com/CosmWasm/wasmd/tree/v0.40.1) (2023-06-06) +## [v0.50.0](https://github.com/CosmWasm/wasmd/tree/v0.50.0) (2023-11-23) -[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.40.0...v0.40.1) +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.45.0...v0.50.0) -This patch release includes only the wasmvm upgrade to [v1.2.4](https://github.com/CosmWasm/wasmvm/releases/tag/v1.2.4). -It solves some incompatibility problems by improving cache invalidation. See [\#426](https://github.com/CosmWasm/wasmvm/issues/426) +- Fix module migration fails when code upload access is set to `OnlyAddress` [\#1725](https://github.com/CosmWasm/wasmd/issues/1725) +- Upgrade to SDK v0.50.1 [\#1696](https://github.com/CosmWasm/wasmd/pull/1696) +- Bump bufbuild/buf-setup-action from 1.27.1 to 1.27.2 [\#1684](https://github.com/CosmWasm/wasmd/pull/1684) +- Bump google.golang.org/grpc from 1.58.1 to 1.58.3 in /tests/system [\#1682](https://github.com/CosmWasm/wasmd/pull/1682) +- Rename some more "features" to "capabilities" [\#1679](https://github.com/CosmWasm/wasmd/pull/1679) +- Bump actions/checkout from 4.1.0 to 4.1.1 [\#1678](https://github.com/CosmWasm/wasmd/pull/1678) +- Bump bufbuild/buf-setup-action from 1.27.0 to 1.27.1 [\#1677](https://github.com/CosmWasm/wasmd/pull/1677) +- Upgrade to SDK v0.50 + IBC v8.0 [\#1611](https://github.com/CosmWasm/wasmd/pull/1611) ### Notable changes: -- Upgrade wasmvm to v1.2.4. [\#1430](https://github.com/CosmWasm/wasmd/issues/1430) +- Upgrade to [SDK v0.50.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.1) Eden release +- Upgrade to [IBC v8.0.0](https://github.com/cosmos/ibc-go/releases/tag/v8.0.0) release ### Migration notes: -- This release does not include any state migrations or breaking changes, therefore a coordinated chain upgrade is not required. -[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.45.0...HEAD) +- This release includes state migrations! Please pay careful attention to the doc provided by the [SDK](https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/UPGRADING.md#v050x) team + and the [IBC](https://github.com/cosmos/ibc-go/releases/tag/v8.0.0) team with their releases +- We have some example upgrade code in the `app/upgrade/v0.50` dir, assuming that you come from a wasmd v0.4x version. +- We also tested a chain upgrade with wasmd v0.33 to v0.50 directly with a fix to [app.go](https://github.com/CosmWasm/wasmd/blame/b02a4723618629b5bb9603d8298621f6ef449f92/app/app.go#L927) + to work around an issue. +- Disclaimer: the upgrade codes are examples and may require more customization for your chain. Please do proper tests before applying on mainnets +- Please share your experience and success stories on CosmWasm [discord](https://discord.com/invite/cPjEnPd) + ## [v0.45.0](https://github.com/CosmWasm/wasmd/tree/v0.45.0) (2023-11-15) diff --git a/Dockerfile b/Dockerfile index 711ac86d91..5286e109ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ # docker build . -t cosmwasm/wasmd:latest # docker run --rm -it cosmwasm/wasmd:latest /bin/sh -FROM golang:1.19-alpine3.15 AS go-builder -ARG arch=x86_64 + +# Using Alpine 3.19+ as the build system is currently broken, +# see https://github.com/CosmWasm/wasmvm/issues/523 +FROM golang:1.21-alpine3.18 AS go-builder # this comes from standard alpine nightly file # https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile @@ -15,13 +17,10 @@ RUN apk add git WORKDIR /code COPY . /code/ # See https://github.com/CosmWasm/wasmvm/releases -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 2687afbdae1bc6c7c8b05ae20dfb8ffc7ddc5b4e056697d0f37853dfe294e913 -RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 465e3a088e96fd009a11bfd234c69fb8a0556967677e54511c084f815cf9ce63 - -# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc` -RUN cp /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a +ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a +ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a +RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 3b478b3e51d31e53ce9324a8895d2cd7278af5179b9a02ea55d8627958e42afa +RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ca08bb7b73b49b483611d9755bb8455620bb8c0faf3014400908ed49bf3b19a5 # force it to use static lib (from above) not standard libgo_cosmwasm.so file RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build @@ -29,7 +28,7 @@ RUN echo "Ensuring binary is statically linked ..." \ && (file /code/build/wasmd | grep "statically linked") # -------------------------------------------------------- -FROM alpine:3.16 +FROM alpine:3.18 COPY --from=go-builder /code/build/wasmd /usr/bin/wasmd @@ -45,4 +44,4 @@ EXPOSE 26656 # tendermint rpc EXPOSE 26657 -CMD ["/usr/bin/wasmd", "version"] \ No newline at end of file +CMD ["/usr/bin/wasmd", "version"] diff --git a/INTEGRATION.md b/INTEGRATION.md index 2ce4a33515..211331ea9e 100644 --- a/INTEGRATION.md +++ b/INTEGRATION.md @@ -19,6 +19,12 @@ hardware it runs on. | wasmd | Cosmos SDK | |:-----:|:----------:| +| v0.50 | v0.50.1 | +| v0.45 | v0.47.5 | +| v0.44 | v0.47.5 | +| v0.43 | v0.47.5 | +| v0.42 | v0.47.5 | +| v0.41 | v0.47.4 | | v0.40 | v0.47.1 | | v0.31 | v0.45.14 | | v0.30 | v0.45.11 | diff --git a/Makefile b/Makefile index 0ef07eca21..90814a3c65 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ ldflags := $(strip $(ldflags)) BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath # The below include contains the tools and runsim targets. -include contrib/devtools/Makefile +include scripts/contrib/devtools/Makefile all: install lint test @@ -89,13 +89,6 @@ endif build-windows-client: go.sum GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd.exe ./cmd/wasmd -build-contract-tests-hooks: -ifeq ($(OS),Windows_NT) - go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests -else - go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests -endif - install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd @@ -161,7 +154,7 @@ test-system: install format-tools: go install mvdan.cc/gofumpt@v0.4.0 go install github.com/client9/misspell/cmd/misspell@v0.3.4 - go install golang.org/x/tools/cmd/goimports@latest + go install github.com/daixiang0/gci@v0.11.2 lint: format-tools golangci-lint run --tests=false @@ -170,13 +163,13 @@ lint: format-tools format: format-tools find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/CosmWasm/wasmd + find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gci write --skip-generated -s standard -s default -s "prefix(cosmossdk.io)" -s "prefix(github.com/cosmos/cosmos-sdk)" -s "prefix(github.com/CosmWasm/wasmd)" --custom-order ############################################################################### ### Protobuf ### ############################################################################### -protoVer=0.13.1 +protoVer=0.14.0 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) diff --git a/README.md b/README.md index f9972b3db6..9a0dfe6f71 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # Wasm Zone [![CircleCI](https://circleci.com/gh/CosmWasm/wasmd/tree/main.svg?style=shield)](https://circleci.com/gh/CosmWasm/wasmd/tree/main) @@ -6,66 +5,71 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/CosmWasm/wasmd)](https://goreportcard.com/report/github.com/CosmWasm/wasmd) [![license](https://img.shields.io/github/license/CosmWasm/wasmd.svg)](https://github.com/CosmWasm/wasmd/blob/main/LICENSE) [![LoC](https://tokei.rs/b1/github/CosmWasm/wasmd)](https://github.com/CosmWasm/wasmd) + This repository hosts `Wasmd`, the first implementation of a cosmos zone with wasm smart contracts enabled. -This code was forked from the `cosmos/gaia` repository as a basis and then we added `x/wasm` and cleaned up +This code was forked from the `cosmos/gaia` repository as a basis and then we added `x/wasm` and cleaned up many gaia-specific files. However, the `wasmd` binary should function just like `gaiad` except for the addition of the `x/wasm` module. -**Note**: Requires [Go 1.19+](https://golang.org/dl/) +**Note**: Requires [Go 1.21+](https://golang.org/dl/) For critical security issues & disclosure, see [SECURITY.md](SECURITY.md). -## Compatibility with CosmWasm contracts ## Compatibility -A VM can support one or more contract-VM interface versions. The interface -version is communicated by the contract via a Wasm export. This is the current -compatibility list: - -| wasmd | wasmvm | cosmwasm-vm | cosmwasm-std | -|-------|--------------|-------------|--------------| -| 0.44 | v1.5.0 | | 1.0-1.5 | -| 0.43 | v1.4.1 | | 1.0-1.4 | -| 0.42 | v1.4.0 | | 1.0-1.4 | -| 0.41 | v1.3.0 | | 1.0-1.3 | -| 0.40 | v1.2.3 | | 1.0-1.2 | -| 0.31 | v1.2.0 | | 1.0-1.2 | -| 0.30 | v1.1.0 | | 1.0-1.1 | -| 0.29 | v1.1.0 | | 1.0-1.1 | -| 0.28 | v1.0.0 | | 1.0-1.1 | -| 0.27 | v1.0.0 | | 1.0 | -| 0.26 | 1.0.0-beta10 | | 1.0 | -| 0.25 | 1.0.0-beta10 | | 1.0 | -| 0.24 | 1.0.0-beta7 | 1.0.0-beta6 | 1.0 | -| 0.23 | | 1.0.0-beta5 | 1.0 | -| 0.22 | | 1.0.0-beta5 | 1.0 | -| 0.21 | | 1.0.0-beta2 | 1.0 | -| 0.20 | | 1.0.0-beta | 1.0 | -| 0.19 | | 0.16 | 0.16 | -| 0.18 | | 0.16 | 0.16 | -| 0.17 | | 0.14 | 0.14 | -| 0.16 | | 0.14 | 0.14 | -| 0.15 | | 0.13 | 0.11-0.13 | -| 0.14 | | 0.13 | 0.11-0.13 | -| 0.13 | | 0.12 | 0.11-0.13 | -| 0.12 | | 0.12 | 0.11-0.13 | -| 0.11 | | 0.11 | 0.11-0.13 | -| 0.10 | | 0.10 | 0.10 | -| 0.9 | | 0.9 | 0.9 | -| 0.8 | | 0.8 | 0.8 | - -Note: `cosmwasm_std v1.0` means it supports contracts compiled by any `v1.0.0-betaX` or `1.0.x`. -It will also run contracts compiled with 1.x assuming they don't opt into any newer features. -The 1.x cosmwasm_vm will support all contracts with 1.0 <= version <= 1.x. - -Note that `cosmwasm-std` version defines which contracts are compatible with this system. The wasm code uploaded must -have been compiled with one of the supported `cosmwasm-std` versions, or will be rejected upon upload (with some error -message about "contract too old?" or "contract too new?"). `cosmwasm-vm` version defines the runtime used. It is a -breaking change to switch runtimes (you will need to organize a chain upgrade). As of `cosmwasm-vm 0.13` we are -using [wasmer](https://github.com/wasmerio/wasmer/) 1.0, which is significantly more performant than the older versions. +### For contract developers + +Since CosmWasm 1.0 the contract-host interface has not changed in a breaking way. +Also CosmWasm 2.0 contracts remain compatible at the Wasm interface level. + +To extend the feature set over time, contracts can specify required [capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES.md) through cargo features in cosmwasm-std. +The following table shows which of the [latest capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md) are supported by certain wasmd versions. + +| capability | >= 0.51 | >= 0.42 | >= 0.41 | >= 0.31 | >= 0.29 | 0.28 | +| ------------ | ------- | ------- | ------- | ------- | ------- | ---- | +| iterator | x | x | x | x | x | x | +| stargate | x | x | x | x | x | x | +| staking | x | x | x | x | x | x | +| cosmwasm_1_1 | x | x | x | x | x | | +| cosmwasm_1_2 | x | x | x | x | | | +| cosmwasm_1_3 | x | x | x | | | | +| cosmwasm_1_4 | x | x | | | | | +| cosmwasm_2_0 | x | | | | | | + +### For node developers + +The [wasmvm](https://github.com/CosmWasm/wasmvm) dependency works in most aspects like any other Go dependency. When embedding wasmd as a module into your chain, wasmvm becomes a transitive (or "indirect") dependency of the final binary project. You can specify which wasmvm version you want in your node by adding it explicitly to go.mod or using a [`replace` directive](https://go.dev/ref/mod#go-mod-file-replace). + +Please note that all minor version bumps of wasmvm are expected to be consensus breaking. +For patch releases this should not be the case but there are many exceptions and corner cases. + +The following table shows + +- **Specified wasmvm version:** the wasmvm dependency that wasmd specifies in its own go.mod +- **Compatible wasmvm version:** the versions you can use by setting it in your project's go.mod + +| wasmd | compatible | specified | +| ------ | ---------- | ----------------------------------------------------------------- | +| 0.51.0 | 1.5.x | 1.5.2 | +| 0.50.0 | 1.5.x | [1.5.0](https://github.com/CosmWasm/wasmd/blob/v0.50.0/go.mod#L6) | +| 0.45.0 | 1.5.x | [1.5.0](https://github.com/CosmWasm/wasmd/blob/v0.45.0/go.mod#L6) | +| 0.44.0 | 1.5.x | [1.5.0](https://github.com/CosmWasm/wasmd/blob/v0.44.0/go.mod#L6) | +| 0.43.0 | 1.4.x | [1.4.1](https://github.com/CosmWasm/wasmd/blob/v0.43.0/go.mod#L6) | +| 0.42.0 | 1.4.x | [1.4.1](https://github.com/CosmWasm/wasmd/blob/v0.42.0/go.mod#L6) | +| 0.41.0 | 1.3.x | [1.3.0](https://github.com/CosmWasm/wasmd/blob/v0.41.0/go.mod#L6) | + +Dependency resolution in Go is not obvious. In case of doubt, please use +`go list -m github.com/CosmWasm/wasmvm` to get the dynamically calculated version of the wasmvm dependency. Also check + +```sh +# Replace with you binary name + query wasm libwasmvm-version +``` + +for getting the libwasmvm version loaded at runtime. ## Supported Systems @@ -73,7 +77,7 @@ The supported systems are limited by the dlls created in [`wasmvm`](https://gith However, **M1 macs are not fully supported.** (Experimental support was merged with wasmd 0.24) For linux, the default is to build for glibc, and we cross-compile with CentOS 7 to provide backwards compatibility for `glibc 2.12+`. This includes all known supported distributions -using glibc (CentOS 7 uses 2.12, obsolete Debian Jessy uses 2.19). +using glibc (CentOS 7 uses 2.12, obsolete Debian Jessy uses 2.19). As of `0.9.0` we support `muslc` Linux systems, in particular **Alpine linux**, which is popular in docker distributions. Note that we do **not** store the @@ -81,7 +85,6 @@ static `muslc` build in the repo, so you must compile this yourself, and pass `- Please look at the [`Dockerfile`](./Dockerfile) for an example of how we build a static Go binary for `muslc`. (Or just use this Dockerfile for your production setup). - ## Stability **This is beta software** It is run in some production systems, but we cannot yet provide a stability guarantee @@ -89,7 +92,7 @@ and have not yet gone through and audit of this codebase. Note that the [CosmWasm smart contract framework](https://github.com/CosmWasm/cosmwasm) used by `wasmd` is in a 1.0 release candidate as of March 2022, with stability guarantee and addressing audit results. -As of `wasmd` 0.22, we will work to provide upgrade paths *for this module* for projects running a non-forked +As of `wasmd` 0.22, we will work to provide upgrade paths _for this module_ for projects running a non-forked version on their live networks. If there are Cosmos SDK upgrades, you will have to run their migration code for their modules. If we change the internal storage of `x/wasm` we will provide a function to migrate state that can be called by an `x/upgrade` handler. @@ -101,13 +104,14 @@ Thank you to all projects who have run this code in your mainnets and testnets a given feedback to improve stability. ## Encoding + The used cosmos-sdk version is in transition migrating from amino encoding to protobuf for state. So are we now. -We use standard cosmos-sdk encoding (amino) for all sdk Messages. However, the message body sent to all contracts, -as well as the internal state is encoded using JSON. Cosmwasm allows arbitrary bytes with the contract itself +We use standard cosmos-sdk encoding (amino) for all sdk Messages. However, the message body sent to all contracts, +as well as the internal state is encoded using JSON. Cosmwasm allows arbitrary bytes with the contract itself responsible for decoding. For better UX, we often use `json.RawMessage` to contain these bytes, which enforces that it is -valid json, but also give a much more readable interface. If you want to use another encoding in the contracts, that is -a relatively minor change to wasmd but would currently require a fork. Please open an issue if this is important for +valid json, but also give a much more readable interface. If you want to use another encoding in the contracts, that is +a relatively minor change to wasmd but would currently require a fork. Please open an issue if this is important for your use case. ## Quick Start @@ -116,28 +120,32 @@ your use case. make install make test ``` + if you are using a linux without X or headless linux, look at [this article](https://ahelpme.com/linux/dbusexception-could-not-get-owner-of-name-org-freedesktop-secrets-no-such-name) or [#31](https://github.com/CosmWasm/wasmd/issues/31#issuecomment-577058321). ## Protobuf + The protobuf files for this project are published automatically to the [buf repository](https://buf.build/) to make integration easier: | wasmd version | buf tag | -|---------------|---------------------------------------------------------------------------------------------------------------------------------------------| -| 0.31.x | [e0e5a6fa433449e695af692478c86fb5](https://buf.build/cosmwasm/wasmd/tree/e0e5a6fa433449e695af692478c86fb5:cosmwasm/wasm/v1) | -| 0.30.x | [6508ee062011440c907de6f5c40398ea](https://buf.build/cosmwasm/wasmd/tree/6508ee062011440c907de6f5c40398ea:cosmwasm/wasm/v1) | -| 0.29.x | [51931206dbe09529c1819a8a2863d291035a2549](https://buf.build/cosmwasm/wasmd/tree/51931206dbe09529c1819a8a2863d291035a2549:cosmwasm/wasm/v1) | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.31.x | [e0e5a6fa433449e695af692478c86fb5](https://buf.build/cosmwasm/wasmd/tree/e0e5a6fa433449e695af692478c86fb5:cosmwasm/wasm/v1) | +| 0.30.x | [6508ee062011440c907de6f5c40398ea](https://buf.build/cosmwasm/wasmd/tree/6508ee062011440c907de6f5c40398ea:cosmwasm/wasm/v1) | +| 0.29.x | [51931206dbe09529c1819a8a2863d291035a2549](https://buf.build/cosmwasm/wasmd/tree/51931206dbe09529c1819a8a2863d291035a2549:cosmwasm/wasm/v1) | Generate protobuf + ```shell script make proto-gen ``` -The generators are executed within a Docker [container](./contrib/prototools-docker), now. + +The generators are executed within a Docker [container](./scripts/contrib/prototools-docker), now. ## Dockerized We provide a docker image to help with test setups. There are two modes to use it -Build: `docker build -t cosmwasm/wasmd:latest .` or pull from dockerhub +Build: `docker build -t cosmwasm/wasmd:latest .` or pull from dockerhub ### Dev server @@ -195,16 +203,16 @@ docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ We provide a number of variables in `app/app.go` that are intended to be set via `-ldflags -X ...` compile-time flags. This enables us to avoid copying a new binary directory over for each small change -to the configuration. +to the configuration. Available flags: - -* `-X github.com/CosmWasm/wasmd/app.NodeDir=.corald` - set the config/data directory for the node (default `~/.wasmd`) -* `-X github.com/CosmWasm/wasmd/app.Bech32Prefix=coral` - set the bech32 prefix for all accounts (default `wasm`) + +- `-X github.com/CosmWasm/wasmd/app.NodeDir=.corald` - set the config/data directory for the node (default `~/.wasmd`) +- `-X github.com/CosmWasm/wasmd/app.Bech32Prefix=coral` - set the bech32 prefix for all accounts (default `wasm`) Examples: -* [`wasmd`](./Makefile#L50-L55) is a generic, permissionless version using the `cosmos` bech32 prefix +- [`wasmd`](./Makefile#L50-L55) is a generic, permissionless version using the `cosmos` bech32 prefix ## Compile Time Parameters @@ -214,16 +222,18 @@ you can adjust a few items via module parameters, but a few others did not fit i used by stateless `ValidateBasic()`. Thus, we made them public `var` and these can be overridden in the `app.go` file of your custom chain. -* `wasmtypes.MaxLabelSize = 64` to set the maximum label size on instantiation (default 128) -* `wasmtypes.MaxWasmSize=777000` to set the max size of compiled wasm to be accepted (default 819200) -* `wasmtypes.MaxProposalWasmSize=888000` to set the max size of gov proposal compiled wasm to be accepted (default 3145728) +- `wasmtypes.MaxLabelSize = 64` to set the maximum label size on instantiation (default 128) +- `wasmtypes.MaxWasmSize=777000` to set the max size of compiled wasm to be accepted (default 819200) +- `wasmtypes.MaxProposalWasmSize=888000` to set the max size of gov proposal compiled wasm to be accepted (default 3145728) ## Genesis Configuration + We strongly suggest **to limit the max block gas in the genesis** and not use the default value (`-1` for infinite). + ```json "consensus_params": { "block": { - "max_gas": "SET_YOUR_MAX_VALUE", + "max_gas": "SET_YOUR_MAX_VALUE", ``` Tip: if you want to lock this down to a permisisoned network, the following script can edit the genesis file @@ -236,22 +246,22 @@ to only allow permissioned use of code upload or instantiating: Much thanks to all who have contributed to this project, from this app, to the `cosmwasm` framework, to example contracts and documentation. Or even testing the app and bringing up critical issues. The following have helped bring this project to life: -* Ethan Frey [ethanfrey](https://github.com/ethanfrey) -* Simon Warta [webmaster128](https://github.com/webmaster128) -* Alex Peters [alpe](https://github.com/alpe) -* Aaron Craelius [aaronc](https://github.com/aaronc) -* Sunny Aggarwal [sunnya97](https://github.com/sunnya97) -* Cory Levinson [clevinson](https://github.com/clevinson) -* Sahith Narahari [sahith-narahari](https://github.com/sahith-narahari) -* Jehan Tremback [jtremback](https://github.com/jtremback) -* Shane Vitarana [shanev](https://github.com/shanev) -* Billy Rennekamp [okwme](https://github.com/okwme) -* Westaking [westaking](https://github.com/westaking) -* Marko [marbar3778](https://github.com/marbar3778) -* JayB [kogisin](https://github.com/kogisin) -* Rick Dudley [AFDudley](https://github.com/AFDudley) -* KamiD [KamiD](https://github.com/KamiD) -* Valery Litvin [litvintech](https://github.com/litvintech) -* Leonardo Bragagnolo [bragaz](https://github.com/bragaz) +- Ethan Frey [ethanfrey](https://github.com/ethanfrey) +- Simon Warta [webmaster128](https://github.com/webmaster128) +- Alex Peters [alpe](https://github.com/alpe) +- Aaron Craelius [aaronc](https://github.com/aaronc) +- Sunny Aggarwal [sunnya97](https://github.com/sunnya97) +- Cory Levinson [clevinson](https://github.com/clevinson) +- Sahith Narahari [sahith-narahari](https://github.com/sahith-narahari) +- Jehan Tremback [jtremback](https://github.com/jtremback) +- Shane Vitarana [shanev](https://github.com/shanev) +- Billy Rennekamp [okwme](https://github.com/okwme) +- Westaking [westaking](https://github.com/westaking) +- Marko [marbar3778](https://github.com/marbar3778) +- JayB [kogisin](https://github.com/kogisin) +- Rick Dudley [AFDudley](https://github.com/AFDudley) +- KamiD [KamiD](https://github.com/KamiD) +- Valery Litvin [litvintech](https://github.com/litvintech) +- Leonardo Bragagnolo [bragaz](https://github.com/bragaz) Sorry if I forgot you from this list, just contact me or add yourself in a PR :) diff --git a/app/ante.go b/app/ante.go index 79a73822fa..7a8f17e511 100644 --- a/app/ante.go +++ b/app/ante.go @@ -1,14 +1,16 @@ package app import ( - ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" - "github.com/cosmos/ibc-go/v7/modules/core/keeper" + "errors" - errorsmod "cosmossdk.io/errors" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + "github.com/cosmos/ibc-go/v8/modules/core/keeper" + + corestoretypes "cosmossdk.io/core/store" + circuitante "cosmossdk.io/x/circuit/ante" + circuitkeeper "cosmossdk.io/x/circuit/keeper" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -20,34 +22,40 @@ import ( type HandlerOptions struct { ante.HandlerOptions - IBCKeeper *keeper.Keeper - WasmKeeper *wasmkeeper.Keeper - WasmConfig *wasmTypes.WasmConfig - TXCounterStoreKey storetypes.StoreKey + IBCKeeper *keeper.Keeper + WasmConfig *wasmTypes.WasmConfig + WasmKeeper *wasmkeeper.Keeper + TXCounterStoreService corestoretypes.KVStoreService + CircuitKeeper *circuitkeeper.Keeper } +// NewAnteHandler constructor func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") + return nil, errors.New("account keeper is required for ante builder") } if options.BankKeeper == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") + return nil, errors.New("bank keeper is required for ante builder") } if options.SignModeHandler == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + return nil, errors.New("sign mode handler is required for ante builder") } if options.WasmConfig == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder") + return nil, errors.New("wasm config is required for ante builder") + } + if options.TXCounterStoreService == nil { + return nil, errors.New("wasm store service is required for ante builder") } - if options.TXCounterStoreKey == nil { - return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder") + if options.CircuitKeeper == nil { + return nil, errors.New("circuit keeper is required for ante builder") } anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early - wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey), + wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService), wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()), + circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), diff --git a/app/app.go b/app/app.go index 093dce11ee..2fe7fcb504 100644 --- a/app/app.go +++ b/app/app.go @@ -6,46 +6,68 @@ import ( "io" "os" "path/filepath" - "strings" + "sort" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/circuit" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + circuittypes "cosmossdk.io/x/circuit/types" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/nft" + nftkeeper "cosmossdk.io/x/nft/keeper" + nftmodule "cosmossdk.io/x/nft/module" + "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" @@ -53,13 +75,14 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/store/streaming" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/std" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/msgservice" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" @@ -73,9 +96,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -85,12 +105,6 @@ import ( distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" @@ -104,9 +118,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/nft" - nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" - nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" @@ -118,10 +129,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -157,62 +164,21 @@ var ( Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic ) -var ( - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic( - []govclient.ProposalHandler{ - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - }, - ), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - vesting.AppModuleBasic{}, - nftmodule.AppModuleBasic{}, - consensus.AppModuleBasic{}, - // non sdk modules - wasm.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - transfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - ibcfee.AppModuleBasic{}, - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - nft.ModuleName: nil, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibcfeetypes.ModuleName: nil, - icatypes.ModuleName: nil, - wasmtypes.ModuleName: {authtypes.Burner}, - } -) +// module account permissions +var maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + nft.ModuleName: nil, + // non sdk modules + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + wasmtypes.ModuleName: {authtypes.Burner}, +} var ( _ runtime.AppI = (*WasmApp)(nil) @@ -234,7 +200,7 @@ type WasmApp struct { // keepers AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.Keeper + BankKeeper bankkeeper.BaseKeeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper @@ -250,6 +216,7 @@ type WasmApp struct { GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper + CircuitKeeper circuitkeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly IBCFeeKeeper ibcfeekeeper.Keeper @@ -266,7 +233,8 @@ type WasmApp struct { ScopedWasmKeeper capabilitykeeper.ScopedKeeper // the module manager - ModuleManager *module.Manager + ModuleManager *module.Manager + BasicModuleManager module.BasicManager // simulation manager sm *module.SimulationManager @@ -285,11 +253,59 @@ func NewWasmApp( wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *WasmApp { - encodingConfig := MakeEncodingConfig() + interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } + appCodec := codec.NewProtoCodec(interfaceRegistry) + legacyAmino := codec.NewLegacyAmino() + txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes) + + std.RegisterLegacyAminoCodec(legacyAmino) + std.RegisterInterfaces(interfaceRegistry) - appCodec, legacyAmino := encodingConfig.Codec, encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - txConfig := encodingConfig.TxConfig + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. + // + // Example: + // + // bApp := baseapp.NewBaseApp(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp) + // + // bApp.SetMempool(nonceMempool) + // bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to NewBaseApp. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + + // create and set dummy vote extension handler + // voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtHandler := NewVoteExtensionHandler() + // voteExtHandler.SetHandlers(bApp) + // } + // baseAppOptions = append(baseAppOptions, voteExtOp) bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) @@ -297,25 +313,24 @@ func NewWasmApp( bApp.SetInterfaceRegistry(interfaceRegistry) bApp.SetTxEncoder(txConfig.TxEncoder()) - keys := sdk.NewKVStoreKeys( + keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, circuittypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, // non sdk store keys - ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, + capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - // load state streaming if enabled - if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { - logger.Error("failed to load state streaming", "err", err) - os.Exit(1) + // register streaming services + if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil { + panic(err) } app := &WasmApp{ @@ -337,8 +352,13 @@ func NewWasmApp( ) // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) - bApp.SetParamStore(&app.ConsensusParamsKeeper) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + runtime.EventService{}, + ) + bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper( @@ -355,41 +375,62 @@ func NewWasmApp( app.CapabilityKeeper.Seal() // add keepers + app.AccountKeeper = authkeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], + runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, - Bech32Prefix, + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + runtime.NewKVStoreService(keys[banktypes.StoreKey]), app.AccountKeeper, BlockedAddresses(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), + logger, ) + + // optional: enable sign mode textual by overwriting the default tx config (after setting the bank keeper) + // enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) + // txConfigOpts := tx.ConfigOptions{ + // EnabledSignModes: enabledSignModes, + // TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), + // } + // txConfig, err := tx.NewTxConfigWithOptions( + // appCodec, + // txConfigOpts, + // ) + // if err != nil { + // panic(err) + // } + // app.txConfig = txConfig + app.StakingKeeper = stakingkeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), ) - app.MintKeeper = mintkeeper.NewKeeper( appCodec, - keys[minttypes.StoreKey], + runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.DistrKeeper = distrkeeper.NewKeeper( appCodec, - keys[distrtypes.StoreKey], + runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, @@ -400,7 +441,7 @@ func NewWasmApp( app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, legacyAmino, - keys[slashingtypes.StoreKey], + runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -408,14 +449,15 @@ func NewWasmApp( invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) app.CrisisKeeper = crisiskeeper.NewKeeper( appCodec, - keys[crisistypes.StoreKey], + runtime.NewKVStoreService(keys[crisistypes.StoreKey]), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.AccountKeeper.AddressCodec(), ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AccountKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks @@ -423,14 +465,34 @@ func NewWasmApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper) + app.CircuitKeeper = circuitkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[circuittypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.AccountKeeper.AddressCodec(), + ) + app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) + + app.AuthzKeeper = authzkeeper.NewKeeper( + runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), + appCodec, + app.MsgServiceRouter(), + app.AccountKeeper, + ) groupConfig := group.DefaultConfig() /* Example of setting group params: groupConfig.MaxMetadataLen = 1000 */ - app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) + app.GroupKeeper = groupkeeper.NewKeeper( + keys[group.StoreKey], + // runtime.NewKVStoreService(keys[group.StoreKey]), + appCodec, + app.MsgServiceRouter(), + app.AccountKeeper, + groupConfig, + ) // get skipUpgradeHeights from the app options skipUpgradeHeights := map[int64]bool{} @@ -441,7 +503,7 @@ func NewWasmApp( // set the governance module account as the authority for conducting upgrades app.UpgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, - keys[upgradetypes.StoreKey], + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, @@ -455,6 +517,7 @@ func NewWasmApp( app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Register the proposal types @@ -463,10 +526,7 @@ func NewWasmApp( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). // This should be removed. It is still in place to avoid failures of modules that have not yet been upgraded. - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -474,15 +534,19 @@ func NewWasmApp( */ govKeeper := govkeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], + runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, + app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + // Set legacy router for backwards compatibility with gov v1beta1 + govKeeper.SetLegacyRouter(govRouter) + app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks @@ -490,7 +554,7 @@ func NewWasmApp( ) app.NFTKeeper = nftkeeper.NewKeeper( - keys[nftkeeper.StoreKey], + runtime.NewKVStoreService(keys[nftkeeper.StoreKey]), appCodec, app.AccountKeeper, app.BankKeeper, @@ -499,9 +563,11 @@ func NewWasmApp( // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, - keys[evidencetypes.StoreKey], + runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, + app.AccountKeeper.AddressCodec(), + runtime.ProvideCometInfoService(), ) // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper @@ -511,7 +577,7 @@ func NewWasmApp( appCodec, keys[ibcfeetypes.StoreKey], app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, ) // Create Transfer Keepers @@ -521,10 +587,11 @@ func NewWasmApp( app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.ICAHostKeeper = icahostkeeper.NewKeeper( @@ -533,10 +600,11 @@ func NewWasmApp( app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, @@ -544,9 +612,10 @@ func NewWasmApp( app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, scopedICAControllerKeeper, app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) wasmDir := filepath.Join(homePath, "wasm") @@ -557,31 +626,27 @@ func NewWasmApp( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - availableCapabilities := strings.Join(AllCapabilities(), ",") app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, - keys[wasmtypes.StoreKey], + runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, distrkeeper.NewQuerier(app.DistrKeeper), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, scopedWasmKeeper, app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), wasmDir, wasmConfig, - availableCapabilities, + wasmkeeper.BuiltInCapabilities(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmOpts..., ) - // Set legacy router for backwards compatibility with gov v1beta1 - app.GovKeeper.SetLegacyRouter(govRouter) - // Create Transfer Stack var transferStack porttypes.IBCModule transferStack = transfer.NewIBCModule(app.TransferKeeper) @@ -628,46 +693,74 @@ func NewWasmApp( genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, + app, + txConfig, ), auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - upgrade.NewAppModule(app.UpgradeKeeper), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), params.NewAppModule(app.ParamsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), + circuit.NewAppModule(appCodec, app.CircuitKeeper), + // non sdk modules + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), wasm.NewAppModule(appCodec, &app.WasmKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), ibc.NewAppModule(app.IBCKeeper), transfer.NewAppModule(app.TransferKeeper), ibcfee.NewAppModule(app.IBCFeeKeeper), ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + ibctm.AppModule{}, + // sdk crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them ) + // BasicModuleManager defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration and genesis verification. + // By default it is composed of all the module from the module manager. + // Additionally, app module basics can be overwritten by passing them as argument. + app.BasicModuleManager = module.NewBasicManagerFromManager( + app.ModuleManager, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), + }) + app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // NOTE: upgrade module is required to be prioritized + app.ModuleManager.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, - evidencetypes.ModuleName, stakingtypes.ModuleName, - authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, - authz.ModuleName, feegrant.ModuleName, nft.ModuleName, group.ModuleName, - paramstypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + genutiltypes.ModuleName, + authz.ModuleName, // additional non simd modules + capabilitytypes.ModuleName, ibctransfertypes.ModuleName, ibcexported.ModuleName, icatypes.ModuleName, @@ -676,13 +769,14 @@ func NewWasmApp( ) app.ModuleManager.SetOrderEndBlockers( - crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, - slashingtypes.ModuleName, minttypes.ModuleName, - genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, - feegrant.ModuleName, nft.ModuleName, group.ModuleName, - paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName, + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + genutiltypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, // additional non simd modules + capabilitytypes.ModuleName, ibctransfertypes.ModuleName, ibcexported.ModuleName, icatypes.ModuleName, @@ -699,11 +793,13 @@ func NewWasmApp( // NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during // genesis phase. For example bank transfer, auth account check, staking, ... genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, + capabilitytypes.ModuleName, + // simd modules + authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, nft.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, consensusparamtypes.ModuleName, + vestingtypes.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, // additional non simd modules ibctransfertypes.ModuleName, ibcexported.ModuleName, @@ -720,7 +816,10 @@ func NewWasmApp( app.ModuleManager.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.ModuleManager.RegisterServices(app.configurator) + err = app.ModuleManager.RegisterServices(app.configurator) + if err != nil { + panic(err) + } // RegisterUpgradeHandlers is used for registering any on-chain upgrades. // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. @@ -755,9 +854,10 @@ func NewWasmApp( // initialize BaseApp app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(encodingConfig.TxConfig, wasmConfig, keys[wasmtypes.StoreKey]) + app.setAnteHandler(txConfig, wasmConfig, keys[wasmtypes.StoreKey]) // must be before Loading version // requires the snapshot store to be created and registered as a BaseAppOption @@ -785,35 +885,42 @@ func NewWasmApp( // meaning that both `runMsgs` and `postHandler` state will be committed if // both are successful, and both will be reverted if any of the two fails. // - // The SDK exposes a default postHandlers chain, which comprises of only - // one decorator: the Transaction Tips decorator. However, some chains do - // not need it by default, so feel free to comment the next line if you do - // not need tips. - // To read more about tips: - // https://docs.cosmos.network/main/core/tips.html + // The SDK exposes a default postHandlers chain // // Please note that changing any of the anteHandler or postHandler chain is // likely to be a state-machine breaking change, which needs a coordinated // upgrade. app.setPostHandler() + // At startup, after all modules have been registered, check that all proto + // annotations are correct. + protoFiles, err := proto.MergedRegistry() + if err != nil { + panic(err) + } + err = msgservice.ValidateProtoAnnotations(protoFiles) + if err != nil { + // Once we switch to using protoreflect-based antehandlers, we might + // want to panic here instead of logging a warning. + _, _ = fmt.Fprintln(os.Stderr, err.Error()) + } + if loadLatest { if err := app.LoadLatestVersion(); err != nil { - logger.Error("error on loading last version", "err", err) - os.Exit(1) + panic(fmt.Errorf("error loading last version: %w", err)) } ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) // Initialize pinned codes in wasmvm as they are not persisted there if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { - tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) + panic(fmt.Sprintf("failed initialize pinned codes %s", err)) } } return app } -func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) { +func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey *storetypes.KVStoreKey) { anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ @@ -823,15 +930,18 @@ func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtype FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCKeeper: app.IBCKeeper, - WasmConfig: &wasmConfig, - TXCounterStoreKey: txCounterStoreKey, - WasmKeeper: &app.WasmKeeper, + IBCKeeper: app.IBCKeeper, + WasmConfig: &wasmConfig, + WasmKeeper: &app.WasmKeeper, + TXCounterStoreService: runtime.NewKVStoreService(txCounterStoreKey), + CircuitKeeper: &app.CircuitKeeper, }, ) if err != nil { panic(fmt.Errorf("failed to create AnteHandler: %s", err)) } + + // Set the AnteHandler for the app app.SetAnteHandler(anteHandler) } @@ -849,28 +959,37 @@ func (app *WasmApp) setPostHandler() { // Name returns the name of the App func (app *WasmApp) Name() string { return app.BaseApp.Name() } +// PreBlocker application updates every pre block +func (app *WasmApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.ModuleManager.PreBlock(ctx) +} + // BeginBlocker application updates every begin block -func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.ModuleManager.BeginBlock(ctx, req) +func (app *WasmApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.ModuleManager.BeginBlock(ctx) } // EndBlocker application updates every end block -func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.ModuleManager.EndBlock(ctx, req) +func (app *WasmApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.ModuleManager.EndBlock(ctx) } -func (app *WasmApp) Configurator() module.Configurator { - return app.configurator +func (a *WasmApp) Configurator() module.Configurator { + return a.configurator } // InitChainer application update at chain initialization -func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +func (app *WasmApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { var genesisState GenesisState if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) - return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) + err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + if err != nil { + panic(err) + } + response, err := app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) + return response, err } // LoadHeight loads a particular height @@ -904,9 +1023,30 @@ func (app *WasmApp) TxConfig() client.TxConfig { return app.txConfig } +// AutoCliOpts returns the autocli options for the app. +func (app *WasmApp) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.ModuleManager.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + } +} + // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (app *WasmApp) DefaultGenesis() map[string]json.RawMessage { - return ModuleBasics.DefaultGenesis(app.appCodec) +func (a *WasmApp) DefaultGenesis() map[string]json.RawMessage { + return a.BasicModuleManager.DefaultGenesis(a.appCodec) } // GetKey returns the KVStoreKey for the provided store key. @@ -916,6 +1056,18 @@ func (app *WasmApp) GetKey(storeKey string) *storetypes.KVStoreKey { return app.keys[storeKey] } +// GetStoreKeys returns all the stored store keys. +func (app *WasmApp) GetStoreKeys() []storetypes.StoreKey { + keys := make([]storetypes.StoreKey, 0, len(app.keys)) + for _, key := range app.keys { + keys = append(keys, key) + } + sort.Slice(keys, func(i, j int) bool { + return keys[i].Name() < keys[j].Name() + }) + return keys +} + // GetTKey returns the TransientStoreKey for the provided store key. // // NOTE: This is solely to be used for testing purposes. @@ -950,14 +1102,14 @@ func (app *WasmApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICo // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new CometBFT queries routes from grpc-gateway. + cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register node gRPC service for grpc-gateway. nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { @@ -972,16 +1124,17 @@ func (app *WasmApp) RegisterTxService(clientCtx client.Context) { // RegisterTendermintService implements the Application.RegisterTendermintService method. func (app *WasmApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService( + cmtApp := server.NewCometABCIWrapper(app) + cmtservice.RegisterTendermintService( clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, - app.Query, + cmtApp.Query, ) } -func (app *WasmApp) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) +func (app *WasmApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) } // GetMaccPerms returns a copy of the module account permissions @@ -1021,11 +1174,15 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName) paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(wasmtypes.ModuleName) + // register the IBC key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + + paramsKeeper.Subspace(wasmtypes.ModuleName) return paramsKeeper } diff --git a/app/app_test.go b/app/app_test.go index 6dfc76942d..c363a847f8 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -1,15 +1,18 @@ package app import ( - "os" "testing" - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" + abci "github.com/cometbft/cometbft/abci/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) @@ -18,16 +21,25 @@ var emptyWasmOpts []wasmkeeper.Option func TestWasmdExport(t *testing.T) { db := dbm.NewMemDB() + logger := log.NewTestLogger(t) gapp := NewWasmAppWithCustomOptions(t, false, SetupOptions{ - Logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + Logger: logger.With("instance", "first"), DB: db, AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), }) - gapp.Commit() + + // finalize block so we have CheckTx state set + _, err := gapp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: 1, + }) + require.NoError(t, err) + + _, err = gapp.Commit() + require.NoError(t, err) // Making a new app object with the db, so that initchain hasn't been called - newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), emptyWasmOpts) - _, err := newGapp.ExportAppStateAndValidators(false, []string{}, nil) + newGapp := NewWasmApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), emptyWasmOpts) + _, err = newGapp.ExportAppStateAndValidators(false, []string{}, nil) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } @@ -52,3 +64,18 @@ func TestGetMaccPerms(t *testing.T) { dup := GetMaccPerms() require.Equal(t, maccPerms, dup, "duplicated module account permissions differed from actual module account permissions") } + +// TestMergedRegistry tests that fetching the gogo/protov2 merged registry +// doesn't fail after loading all file descriptors. +func TestMergedRegistry(t *testing.T) { + r, err := proto.MergedRegistry() + require.NoError(t, err) + require.Greater(t, r.NumFiles(), 0) +} + +func TestProtoAnnotations(t *testing.T) { + r, err := proto.MergedRegistry() + require.NoError(t, err) + err = msgservice.ValidateProtoAnnotations(r) + require.NoError(t, err) +} diff --git a/app/encoding.go b/app/encoding.go index 5416f77a97..3bf0c656c0 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -1,17 +1,33 @@ package app import ( - "github.com/cosmos/cosmos-sdk/std" + "testing" + + dbm "github.com/cosmos/cosmos-db" + + "cosmossdk.io/log" + + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/CosmWasm/wasmd/app/params" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) -// MakeEncodingConfig creates a new EncodingConfig with all modules registered -func MakeEncodingConfig() params.EncodingConfig { - encodingConfig := params.MakeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) +// MakeEncodingConfig creates a new EncodingConfig with all modules registered. For testing only +func MakeEncodingConfig(t testing.TB) params.EncodingConfig { + t.Helper() + // 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 := NewWasmApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), []wasmkeeper.Option{}) + return makeEncodingConfig(tempApp) +} + +func makeEncodingConfig(tempApp *WasmApp) params.EncodingConfig { + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: tempApp.InterfaceRegistry(), + Codec: tempApp.AppCodec(), + TxConfig: tempApp.TxConfig(), + Amino: tempApp.LegacyAmino(), + } return encodingConfig } diff --git a/app/export.go b/app/export.go index f7232cc2bd..8209597c8c 100644 --- a/app/export.go +++ b/app/export.go @@ -5,7 +5,9 @@ import ( "fmt" "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + + storetypes "cosmossdk.io/store/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,17 +20,21 @@ import ( // file. func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which - // Tendermint will start InitChain. + // CometBFT will start InitChain. height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -71,13 +77,24 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) return false }) + if err != nil { + panic(err) + } // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -102,18 +119,33 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { panic(err) } return false }) + if err != nil { + panic(err) + } // reinitialize all delegations for _, del := range dels { @@ -140,33 +172,44 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle staking state. */ // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetRedelegation(ctx, red) + err = app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } return false }) + if err != nil { + panic(err) + } // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + if err != nil { + panic(err) + } return false }) + if err != nil { + panic(err) + } // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) - counter := int16(0) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -175,8 +218,10 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ validator.Jailed = true } - app.StakingKeeper.SetValidator(ctx, validator) - counter++ + err = app.StakingKeeper.SetValidator(ctx, validator) + if err != nil { + panic(err) + } } if err := iter.Close(); err != nil { @@ -184,7 +229,7 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ return } - _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } @@ -192,12 +237,17 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle slashing state. */ // reset start height on signing infos - app.SlashingKeeper.IterateValidatorSigningInfos( + err = app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + if err := app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info); err != nil { + panic(err) + } return false }, ) + if err != nil { + panic(err) + } } diff --git a/app/genesis.go b/app/genesis.go index 2900679c12..e4e849fc27 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,8 +2,6 @@ package app import ( "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" ) // GenesisState of the blockchain is represented here as a map of raw json @@ -14,8 +12,3 @@ import ( // the ModuleBasicManager which populates json from each BasicModule // object provided to it during init. type GenesisState map[string]json.RawMessage - -// NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) -} diff --git a/app/params/proto.go b/app/params/proto.go index 1855c43538..b7045084b8 100644 --- a/app/params/proto.go +++ b/app/params/proto.go @@ -1,21 +1,41 @@ package params import ( + "github.com/cosmos/gogoproto/proto" + + "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/tx" ) // MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. func MakeEncodingConfig() EncodingConfig { amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) + interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { + panic(err) + } + + marshaler := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) return EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Codec: codec, + Codec: marshaler, TxConfig: txCfg, Amino: amino, } diff --git a/app/sim_test.go b/app/sim_test.go index 259bef1481..c4e1cebdc0 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -2,35 +2,31 @@ package app import ( "encoding/json" + "flag" "fmt" "os" "runtime/debug" "strings" "testing" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/spf13/viper" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/feegrant" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -42,15 +38,12 @@ import ( // SimAppChainID hardcoded chainID for simulation const SimAppChainID = "simulation-app" +var FlagEnableStreamingValue bool + // Get flags every time the simulator is run func init() { simcli.GetSimulatorFlags() -} - -type StoreKeysPrefixes struct { - A storetypes.StoreKey - B storetypes.StoreKey - Prefixes [][]byte + flag.BoolVar(&FlagEnableStreamingValue, "EnableStreaming", false, "Enable streaming service") } // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of @@ -130,61 +123,75 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() + appOptions[flags.FlagHome] = t.TempDir() // ensure a unique folder for the new app + newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "WasmApp", newApp.Name()) - var genesisState GenesisState - err = json.Unmarshal(exported.AppState, &genesisState) - require.NoError(t, err) + initReq := &abci.RequestInitChain{ + AppStateBytes: exported.AppState, + } - defer func() { - if r := recover(); r != nil { - err := fmt.Sprintf("%v", r) - if !strings.Contains(err, "validator set is empty after InitGenesis") { - panic(r) - } + ctxA := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) + ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) + _, err = newApp.InitChainer(ctxB, initReq) + + if err != nil { + if strings.Contains(err.Error(), "validator set is empty after InitGenesis") { t.Log("Skipping simulation as all validators have been unbonded") t.Logf("err: %s stacktrace: %s\n", err, string(debug.Stack())) + return } - }() + } - ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) + err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) t.Log("comparing stores...") - storeKeysPrefixes := []StoreKeysPrefixes{ - {app.GetKey(wasmtypes.StoreKey), newApp.GetKey(wasmtypes.StoreKey), [][]byte{wasmtypes.TXCounterPrefix}}, - {app.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, - { - app.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, - }, - }, // ordering may change but it doesn't matter - {app.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, - {app.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}}, - {app.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}}, - {app.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}}, - {app.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}}, - {app.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, - {app.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {app.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {app.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, + // skip certain prefixes + skipPrefixes := map[string][][]byte{ + stakingtypes.StoreKey: { + stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, + stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, + }, + authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix}, + feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix}, + slashingtypes.StoreKey: {slashingtypes.ValidatorMissedBlockBitmapKeyPrefix}, + wasmtypes.StoreKey: {wasmtypes.TXCounterPrefix}, } - for _, skp := range storeKeysPrefixes { - storeA := ctxA.KVStore(skp.A) - storeB := ctxB.KVStore(skp.B) - require.NotNil(t, storeA) - require.NotNil(t, storeB) - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) - require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") + storeKeys := app.GetStoreKeys() + require.NotEmpty(t, storeKeys) + + for _, appKeyA := range storeKeys { + // only compare kvstores + if _, ok := appKeyA.(*storetypes.KVStoreKey); !ok { + continue + } - t.Logf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + keyName := appKeyA.Name() + appKeyB := newApp.GetKey(keyName) + + storeA := ctxA.KVStore(appKeyA) + storeB := ctxB.KVStore(appKeyB) + + failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skipPrefixes[keyName]) + if !assert.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare in %q", keyName) { + for _, v := range failedKVBs { + t.Logf("store missmatch: %q\n", v) + } + t.FailNow() + } + + t.Logf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), appKeyA, appKeyB) + if !assert.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(keyName, app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) { + for _, v := range failedKVAs { + t.Logf("store missmatch: %q\n", v) + } + t.FailNow() + } } } @@ -236,10 +243,11 @@ func TestAppSimulationAfterImport(t *testing.T) { newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) require.Equal(t, "WasmApp", newApp.Name()) - newApp.InitChain(abci.RequestInitChain{ + _, err = newApp.InitChain(&abci.RequestInitChain{ ChainId: SimAppChainID, AppStateBytes: exported.AppState, }) + require.NoError(t, err) _, _, err = simulation.SimulateFromSeed( t, @@ -256,7 +264,6 @@ func TestAppSimulationAfterImport(t *testing.T) { } func setupSimulationApp(t *testing.T, msg string) (simtypes.Config, dbm.DB, simtestutil.AppOptionsMap, *WasmApp) { - t.Helper() config := simcli.NewConfigFromFlags() config.ChainID = SimAppChainID @@ -295,24 +302,38 @@ func TestAppStateDeterminism(t *testing.T) { config.ChainID = SimAppChainID numSeeds := 3 - numTimesToRunPerSeed := 5 + numTimesToRunPerSeed := 3 // This used to be set to 5, but we've temporarily reduced it to 3 for the sake of faster CI. appHashList := make([]json.RawMessage, numTimesToRunPerSeed) - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = t.TempDir() // ensure a unique folder - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + // We will be overriding the random seed and just run a single simulation on the provided seed value + if config.Seed != simcli.DefaultSeedValue { + numSeeds = 1 + } + + appOptions := viper.New() + if FlagEnableStreamingValue { + m := make(map[string]interface{}) + m["streaming.abci.keys"] = []string{"*"} + m["streaming.abci.plugin"] = "abci_v1" + m["streaming.abci.stop-node-on-err"] = true + for key, value := range m { + appOptions.SetDefault(key, value) + } + } + appOptions.SetDefault(server.FlagInvCheckPeriod, simcli.FlagPeriodValue) for i := 0; i < numSeeds; i++ { config.Seed += int64(i) - for j := 0; j < numTimesToRunPerSeed; j++ { var logger log.Logger if simcli.FlagVerboseValue { - logger = log.TestingLogger() + logger = log.NewTestLogger(t) } else { logger = log.NewNopLogger() } + appOptions.SetDefault(flags.FlagHome, t.TempDir()) // ensure a unique folder per run + db := dbm.NewMemDB() app := NewWasmApp(logger, db, nil, true, appOptions, emptyWasmOpts, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) diff --git a/app/test_helpers.go b/app/test_helpers.go index 5963ee378d..5a6972e726 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -9,15 +9,17 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - tmjson "github.com/cometbft/cometbft/libs/json" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" + cmtjson "github.com/cometbft/cometbft/libs/json" + cmttypes "github.com/cometbft/cometbft/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - "cosmossdk.io/math" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + pruningtypes "cosmossdk.io/store/pruning/types" + "cosmossdk.io/store/snapshots" + snapshottypes "cosmossdk.io/store/snapshots/types" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -29,9 +31,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "github.com/cosmos/cosmos-sdk/testutil/mock" "github.com/cosmos/cosmos-sdk/testutil/network" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -54,24 +53,23 @@ type SetupOptions struct { WasmOpts []wasmkeeper.Option } -func setup(tb testing.TB, chainID string, withGenesis bool, invCheckPeriod uint, opts ...wasmkeeper.Option) (*WasmApp, GenesisState) { - tb.Helper() +func setup(t testing.TB, chainID string, withGenesis bool, invCheckPeriod uint, opts ...wasmkeeper.Option) (*WasmApp, GenesisState) { db := dbm.NewMemDB() - nodeHome := tb.TempDir() + nodeHome := t.TempDir() snapshotDir := filepath.Join(nodeHome, "data", "snapshots") snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) - require.NoError(tb, err) - tb.Cleanup(func() { snapshotDB.Close() }) + require.NoError(t, err) + t.Cleanup(func() { snapshotDB.Close() }) snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) - require.NoError(tb, err) + require.NoError(t, err) appOptions := make(simtestutil.AppOptionsMap, 0) appOptions[flags.FlagHome] = nodeHome // ensure unique folder appOptions[server.FlagInvCheckPeriod] = invCheckPeriod app := NewWasmApp(log.NewNopLogger(), db, nil, true, appOptions, opts, bam.SetChainID(chainID), bam.SetSnapshot(snapshotStore, snapshottypes.SnapshotOptions{KeepRecent: 2})) if withGenesis { - return app, NewDefaultGenesisState(app.AppCodec()) + return app, app.DefaultGenesis() } return app, GenesisState{} } @@ -84,35 +82,35 @@ func NewWasmAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOpti pubKey, err := privVal.GetPubKey() require.NoError(t, err) // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + validator := cmttypes.NewValidator(pubKey, 1) + valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } app := NewWasmApp(options.Logger, options.DB, nil, true, options.AppOpts, options.WasmOpts) - genesisState := NewDefaultGenesisState(app.appCodec) + genesisState := app.DefaultGenesis() genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) require.NoError(t, err) if !isCheckTx { // init chain must be called to stop deliverState from being nil - stateBytes, err := tmjson.MarshalIndent(genesisState, "", " ") + stateBytes, err := cmtjson.MarshalIndent(genesisState, "", " ") require.NoError(t, err) // Initialize the chain - app.InitChain( - abci.RequestInitChain{ + _, err = app.InitChain( + &abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, ConsensusParams: simtestutil.DefaultConsensusParams, AppStateBytes: stateBytes, - }, - ) + }) + require.NoError(t, err) } return app @@ -127,15 +125,15 @@ func Setup(t *testing.T, opts ...wasmkeeper.Option) *WasmApp { require.NoError(t, err) // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + validator := cmttypes.NewValidator(pubKey, 1) + valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } chainID := "testing" app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, chainID, opts, balance) @@ -147,7 +145,14 @@ func Setup(t *testing.T, opts ...wasmkeeper.Option) *WasmApp { // that also act as delegators. For simplicity, each validator is bonded with a delegation // of one consensus engine unit in the default token of the WasmApp from first genesis // account. A Nop logger is set in WasmApp. -func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) *WasmApp { +func SetupWithGenesisValSet( + t *testing.T, + valSet *cmttypes.ValidatorSet, + genAccs []authtypes.GenesisAccount, + chainID string, + opts []wasmkeeper.Option, + balances ...banktypes.Balance, +) *WasmApp { t.Helper() app, genesisState := setup(t, chainID, true, 5, opts...) @@ -160,47 +165,29 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs // init chain will set the validator set and initialize the genesis accounts consensusParams := simtestutil.DefaultConsensusParams consensusParams.Block.MaxGas = 100 * simtestutil.DefaultGenTxGas - app.InitChain( - abci.RequestInitChain{ - ChainId: chainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: consensusParams, - AppStateBytes: stateBytes, - }, - ) - // commit genesis changes - app.Commit() - - votes := make([]abci.VoteInfo, len(valSet.Validators)) - for i, v := range valSet.Validators { - votes[i] = abci.VoteInfo{ - Validator: abci.Validator{Address: v.Address, Power: v.VotingPower}, - SignedLastBlock: true, - } - } + _, err = app.InitChain(&abci.RequestInitChain{ + ChainId: chainID, + Time: time.Now().UTC(), + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: consensusParams, + InitialHeight: app.LastBlockHeight() + 1, + AppStateBytes: stateBytes, + }) + require.NoError(t, err) - app.BeginBlock(abci.RequestBeginBlock{ - Header: tmproto.Header{ - ChainID: chainID, - Height: app.LastBlockHeight() + 1, - AppHash: app.LastCommitID().Hash, - Time: time.Now().UTC(), - ValidatorsHash: valSet.Hash(), - NextValidatorsHash: valSet.Hash(), - }, - LastCommitInfo: abci.CommitInfo{ - Votes: votes, - }, + _, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: app.LastBlockHeight() + 1, + Hash: app.LastCommitID().Hash, + NextValidatorsHash: valSet.Hash(), }) + require.NoError(t, err) return app } // SetupWithEmptyStore set up a wasmd app instance with empty DB -func SetupWithEmptyStore(tb testing.TB) *WasmApp { - tb.Helper() - - app, _ := setup(tb, "testing", false, 0) +func SetupWithEmptyStore(t testing.TB) *WasmApp { + app, _ := setup(t, "testing", false, 0) return app } @@ -214,8 +201,8 @@ func GenesisStateWithSingleValidator(t *testing.T, app *WasmApp) GenesisState { require.NoError(t, err) // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + validator := cmttypes.NewValidator(pubKey, 1) + valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) // generate genesis account senderPrivKey := secp256k1.GenPrivKey() @@ -223,11 +210,11 @@ func GenesisStateWithSingleValidator(t *testing.T, app *WasmApp) GenesisState { balances := []banktypes.Balance{ { Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), }, } - genesisState := NewDefaultGenesisState(app.appCodec) + genesisState := app.DefaultGenesis() genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) require.NoError(t, err) @@ -236,14 +223,18 @@ func GenesisStateWithSingleValidator(t *testing.T, app *WasmApp) GenesisState { // AddTestAddrsIncremental constructs and returns accNum amount of accounts with an // initial balance of accAmt in random order -func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress { +func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdkmath.Int) []sdk.AccAddress { return addTestAddrs(app, ctx, accNum, accAmt, simtestutil.CreateIncrementalAccounts) } -func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int, strategy simtestutil.GenerateAccountStrategy) []sdk.AccAddress { +func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdkmath.Int, strategy simtestutil.GenerateAccountStrategy) []sdk.AccAddress { testAddrs := strategy(accNum) + bondDenom, err := app.StakingKeeper.BondDenom(ctx) + if err != nil { + panic(err) + } - initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) + initCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, accAmt)) for _, addr := range testAddrs { initAccountWithCoins(app, ctx, addr, initCoins) @@ -264,13 +255,6 @@ func initAccountWithCoins(app *WasmApp, ctx sdk.Context, addr sdk.AccAddress, co } } -// ModuleAccountAddrs provides a list of blocked module accounts from configuration in AppConfig -// -// Ported from WasmApp -func ModuleAccountAddrs() map[string]bool { - return BlockedAddresses() -} - var emptyWasmOptions []wasmkeeper.Option // NewTestNetworkFixture returns a new WasmApp AppConstructor for network simulation tests @@ -295,7 +279,7 @@ func NewTestNetworkFixture() network.TestFixture { return network.TestFixture{ AppConstructor: appCtr, - GenesisState: NewDefaultGenesisState(app.AppCodec()), + GenesisState: app.DefaultGenesis(), EncodingConfig: testutil.TestEncodingConfig{ InterfaceRegistry: app.InterfaceRegistry(), Codec: app.AppCodec(), @@ -306,11 +290,7 @@ func NewTestNetworkFixture() network.TestFixture { } // SignAndDeliverWithoutCommit signs and delivers a transaction. No commit -func SignAndDeliverWithoutCommit( - t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, fees sdk.Coins, - chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey, -) (sdk.GasInfo, *sdk.Result, error) { - t.Helper() +func SignAndDeliverWithoutCommit(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, fees sdk.Coins, chainID string, accNums, accSeqs []uint64, blockTime time.Time, priv ...cryptotypes.PrivKey) (*abci.ResponseFinalizeBlock, error) { tx, err := simtestutil.GenSignedMockTx( rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, @@ -324,13 +304,14 @@ func SignAndDeliverWithoutCommit( ) require.NoError(t, err) - // Simulate a sending a transaction and committing a block - // app.BeginBlock(abci.RequestBeginBlock{Header: header}) - gInfo, res, err := app.SimDeliver(txCfg.TxEncoder(), tx) - // app.EndBlock(abci.RequestEndBlock{}) - // app.Commit() + bz, err := txCfg.TxEncoder()(tx) + require.NoError(t, err) - return gInfo, res, err + return app.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: app.LastBlockHeight() + 1, + Time: blockTime, + Txs: [][]byte{bz}, + }) } // GenesisStateWithValSet returns a new genesis state with the validator set @@ -338,7 +319,7 @@ func SignAndDeliverWithoutCommit( func GenesisStateWithValSet( codec codec.Codec, genesisState map[string]json.RawMessage, - valSet *tmtypes.ValidatorSet, + valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance, ) (map[string]json.RawMessage, error) { @@ -352,7 +333,7 @@ func GenesisStateWithValSet( bondAmt := sdk.DefaultPowerReduction for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) if err != nil { return nil, fmt.Errorf("failed to convert pubkey: %w", err) } @@ -368,15 +349,16 @@ func GenesisStateWithValSet( Jailed: false, Status: stakingtypes.Bonded, Tokens: bondAmt, - DelegatorShares: math.LegacyOneDec(), + DelegatorShares: sdkmath.LegacyOneDec(), Description: stakingtypes.Description{}, UnbondingHeight: int64(0), UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), - MinSelfDelegation: math.ZeroInt(), + Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), + MinSelfDelegation: sdkmath.ZeroInt(), } validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), math.LegacyOneDec())) + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) + } // set validators and delegations diff --git a/app/test_support.go b/app/test_support.go index ac9cd2865b..33bbffadc2 100644 --- a/app/test_support.go +++ b/app/test_support.go @@ -1,12 +1,12 @@ package app import ( - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" "github.com/cosmos/cosmos-sdk/baseapp" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" diff --git a/app/upgrades.go b/app/upgrades.go index 775e28bf45..2ffaa17b70 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,41 +1,83 @@ package app import ( - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + "fmt" + + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/CosmWasm/wasmd/app/upgrades" + "github.com/CosmWasm/wasmd/app/upgrades/noop" + v050 "github.com/CosmWasm/wasmd/app/upgrades/v050" + v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ) -// UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade -// from v046 to v047. -// -// NOTE: This upgrade defines a reference implementation of what an upgrade -// could look like when an application is migrating from Cosmos SDK version -// v0.46.x to v0.47.x. -const UpgradeName = "v046-to-v047" +// Upgrades list of chain upgrades +var Upgrades = []upgrades.Upgrade{v050.Upgrade} + +// RegisterUpgradeHandlers registers the chain upgrade handlers +func (app *WasmApp) RegisterUpgradeHandlers() { + setupLegacyKeyTables(&app.ParamsKeeper) + if len(Upgrades) == 0 { + // always have a unique upgrade registered for the current version to test in system tests + Upgrades = append(Upgrades, noop.NewUpgrade(app.Version())) + } + + keepers := upgrades.AppKeepers{ + AccountKeeper: &app.AccountKeeper, + ParamsKeeper: &app.ParamsKeeper, + ConsensusParamsKeeper: &app.ConsensusParamsKeeper, + CapabilityKeeper: app.CapabilityKeeper, + IBCKeeper: app.IBCKeeper, + Codec: app.appCodec, + GetStoreKey: app.GetKey, + } + app.GetStoreKeys() + // register all upgrade handlers + for _, upgrade := range Upgrades { + app.UpgradeKeeper.SetUpgradeHandler( + upgrade.UpgradeName, + upgrade.CreateUpgradeHandler( + app.ModuleManager, + app.configurator, + &keepers, + ), + ) + } + + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) + } + + if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + return + } + + // register store loader for current upgrade + for _, upgrade := range Upgrades { + if upgradeInfo.Name == upgrade.UpgradeName { + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) // nolint:gosec + break + } + } +} -func (app WasmApp) RegisterUpgradeHandlers() { - // Set param key table for params module migration - for _, subspace := range app.ParamsKeeper.GetSubspaces() { +func setupLegacyKeyTables(k *paramskeeper.Keeper) { + for _, subspace := range k.GetSubspaces() { subspace := subspace var keyTable paramstypes.KeyTable @@ -45,7 +87,7 @@ func (app WasmApp) RegisterUpgradeHandlers() { case banktypes.ModuleName: keyTable = banktypes.ParamKeyTable() //nolint:staticcheck case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() + keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck case minttypes.ModuleName: keyTable = minttypes.ParamKeyTable() //nolint:staticcheck case distrtypes.ModuleName: @@ -56,16 +98,9 @@ func (app WasmApp) RegisterUpgradeHandlers() { keyTable = govv1.ParamKeyTable() //nolint:staticcheck case crisistypes.ModuleName: keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - // ibc types - case ibctransfertypes.ModuleName: - keyTable = ibctransfertypes.ParamKeyTable() - case icahosttypes.SubModuleName: - keyTable = icahosttypes.ParamKeyTable() - case icacontrollertypes.SubModuleName: - keyTable = icacontrollertypes.ParamKeyTable() // wasm case wasmtypes.ModuleName: - keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck + keyTable = v2.ParamKeyTable() //nolint:staticcheck default: continue } @@ -74,36 +109,7 @@ func (app WasmApp) RegisterUpgradeHandlers() { subspace.WithKeyTable(keyTable) } } - - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - - app.UpgradeKeeper.SetUpgradeHandler( - UpgradeName, - func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module. - baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) - - // Note: this migration is optional, - // You can include x/gov proposal migration documented in [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md) - - return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) - }, - ) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{ - consensustypes.ModuleName, - crisistypes.ModuleName, - }, - } - - // configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } + // sdk 47 + k.Subspace(baseapp.Paramspace). + WithKeyTable(paramstypes.ConsensusParamsKeyTable()) } diff --git a/app/upgrades/noop/upgrades.go b/app/upgrades/noop/upgrades.go new file mode 100644 index 0000000000..e1ac64da01 --- /dev/null +++ b/app/upgrades/noop/upgrades.go @@ -0,0 +1,34 @@ +package noop + +import ( + "context" + + storetypes "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/CosmWasm/wasmd/app/upgrades" +) + +// NewUpgrade constructor +func NewUpgrade(semver string) upgrades.Upgrade { + return upgrades.Upgrade{ + UpgradeName: semver, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: storetypes.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, + } +} + +func CreateUpgradeHandler( + mm upgrades.ModuleManager, + configurator module.Configurator, + ak *upgrades.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/app/upgrades/types.go b/app/upgrades/types.go new file mode 100644 index 0000000000..2ff71ce631 --- /dev/null +++ b/app/upgrades/types.go @@ -0,0 +1,44 @@ +package upgrades + +import ( + "context" + + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + + storetypes "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" +) + +type AppKeepers struct { + AccountKeeper *authkeeper.AccountKeeper + ParamsKeeper *paramskeeper.Keeper + ConsensusParamsKeeper *consensusparamkeeper.Keeper + Codec codec.Codec + GetStoreKey func(storeKey string) *storetypes.KVStoreKey + CapabilityKeeper *capabilitykeeper.Keeper + IBCKeeper *ibckeeper.Keeper +} +type ModuleManager interface { + RunMigrations(ctx context.Context, cfg module.Configurator, fromVM module.VersionMap) (module.VersionMap, error) + GetVersionMap() module.VersionMap +} + +// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal +// must have written, in order for the state migration to go smoothly. +// An upgrade must implement this struct, and then set it in the app.go. +// The app.go will then define the handler. +type Upgrade struct { + // Upgrade version name, for the upgrade handler, e.g. `v7` + UpgradeName string + + // CreateUpgradeHandler defines the function that creates an upgrade handler + CreateUpgradeHandler func(ModuleManager, module.Configurator, *AppKeepers) upgradetypes.UpgradeHandler + StoreUpgrades storetypes.StoreUpgrades +} diff --git a/app/upgrades/v050/upgrades.go b/app/upgrades/v050/upgrades.go new file mode 100644 index 0000000000..091cfe9be8 --- /dev/null +++ b/app/upgrades/v050/upgrades.go @@ -0,0 +1,38 @@ +package v050 + +import ( + "context" + + storetypes "cosmossdk.io/store/types" + circuittypes "cosmossdk.io/x/circuit/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/CosmWasm/wasmd/app/upgrades" +) + +// UpgradeName defines the on-chain upgrade name +const UpgradeName = "v0.50" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: storetypes.StoreUpgrades{ + Added: []string{ + circuittypes.ModuleName, + }, + Deleted: []string{}, + }, +} + +func CreateUpgradeHandler( + mm upgrades.ModuleManager, + configurator module.Configurator, + ak *upgrades.AppKeepers, +) upgradetypes.UpgradeHandler { + // sdk 47 to sdk 50 + return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/app/upgrades/v050/upgrades.go_wasmd_33_example.txt b/app/upgrades/v050/upgrades.go_wasmd_33_example.txt new file mode 100644 index 0000000000..5aa3bdff93 --- /dev/null +++ b/app/upgrades/v050/upgrades.go_wasmd_33_example.txt @@ -0,0 +1,70 @@ +package v050 + +import ( + "context" + + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + v6 "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/migrations/v6" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations" + + storetypes "cosmossdk.io/store/types" + circuittypes "cosmossdk.io/x/circuit/types" + "cosmossdk.io/x/nft" + upgradetypes "cosmossdk.io/x/upgrade/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + "github.com/cosmos/cosmos-sdk/x/group" + + "github.com/CosmWasm/wasmd/app/upgrades" +) + +// UpgradeName defines the on-chain upgrade name +const UpgradeName = "v0.50" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: storetypes.StoreUpgrades{ + Added: []string{ + // SDK 46 + group.ModuleName, + nft.ModuleName, + // SDK 47 + crisistypes.ModuleName, + consensusparamtypes.ModuleName, + // SDK 50 + circuittypes.ModuleName, + }, + Deleted: []string{}, + }, +} + +func CreateUpgradeHandler( + mm upgrades.ModuleManager, + configurator module.Configurator, + ak *upgrades.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + // ibc v6 + // NOTE: The moduleName arg of v6.CreateUpgradeHandler refers to the auth module ScopedKeeper name to which the channel capability should be migrated from. + // This should be the same string value provided upon instantiation of the ScopedKeeper with app.CapabilityKeeper.ScopeToModule() + const moduleName = icacontrollertypes.SubModuleName + if err := v6.MigrateICS27ChannelCapability(sdkCtx, ak.Codec, ak.GetStoreKey(capabilitytypes.ModuleName), + ak.CapabilityKeeper, moduleName); err != nil { + return nil, err + } + + // ibc v7 + if _, err := ibctmmigrations.PruneExpiredConsensusStates(sdkCtx, ak.Codec, ak.IBCKeeper.ClientKeeper); err != nil { + return nil, err + } + + // sdk 50 + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/app/wasm.go b/app/wasm.go index 70f811bc18..97b0544b06 100644 --- a/app/wasm.go +++ b/app/wasm.go @@ -1,16 +1,10 @@ package app -// AllCapabilities returns all capabilities available with the current wasmvm -// See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md -// This functionality is going to be moved upstream: https://github.com/CosmWasm/wasmvm/issues/425 +import ( + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" +) + +// Deprecated: Use BuiltInCapabilities from github.com/CosmWasm/wasmd/x/wasm/keeper func AllCapabilities() []string { - return []string{ - "iterator", - "staking", - "stargate", - "cosmwasm_1_1", - "cosmwasm_1_2", - "cosmwasm_1_3", - "cosmwasm_1_4", - } + return wasmkeeper.BuiltInCapabilities() } diff --git a/benchmarks/app_test.go b/benchmarks/app_test.go index 4d3e2b87df..a5bb6ac557 100644 --- a/benchmarks/app_test.go +++ b/benchmarks/app_test.go @@ -7,13 +7,15 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtypes "github.com/cometbft/cometbft/types" + cmtypes "github.com/cometbft/cometbft/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -32,31 +34,32 @@ import ( ) func setup(db dbm.DB, withGenesis bool, invCheckPeriod uint, opts ...wasmkeeper.Option) (*app.WasmApp, app.GenesisState) { //nolint:unparam - wasmApp := app.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, simtestutil.EmptyAppOptions{}, nil) + + logLevel := log.LevelOption(zerolog.InfoLevel) + + wasmApp := app.NewWasmApp(log.NewLogger(os.Stdout, logLevel), db, nil, true, simtestutil.EmptyAppOptions{}, nil) if withGenesis { - return wasmApp, app.NewDefaultGenesisState(wasmApp.AppCodec()) + return wasmApp, wasmApp.DefaultGenesis() } return wasmApp, app.GenesisState{} } // SetupWithGenesisAccountsAndValSet initializes a new WasmApp with the provided genesis // accounts and possible balances. -func SetupWithGenesisAccountsAndValSet(tb testing.TB, db dbm.DB, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.WasmApp { - tb.Helper() - +func SetupWithGenesisAccountsAndValSet(b testing.TB, db dbm.DB, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.WasmApp { wasmApp, genesisState := setup(db, true, 0) authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) appCodec := wasmApp.AppCodec() privVal := mock.NewPV() pubKey, err := privVal.GetPubKey() - require.NoError(tb, err) + require.NoError(b, err) genesisState[authtypes.ModuleName] = appCodec.MustMarshalJSON(authGenesis) - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + validator := cmtypes.NewValidator(pubKey, 1) + valSet := cmtypes.NewValidatorSet([]*cmtypes.Validator{validator}) validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) @@ -64,7 +67,7 @@ func SetupWithGenesisAccountsAndValSet(tb testing.TB, db dbm.DB, genAccs []autht bondAmt := sdk.DefaultPowerReduction for _, val := range valSet.Validators { - pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, _ := cryptocodec.FromCmtPubKeyInterface(val.PubKey) pkAny, _ := codectypes.NewAnyWithValue(pk) validator := stakingtypes.Validator{ OperatorAddress: sdk.ValAddress(val.Address).String(), @@ -72,17 +75,17 @@ func SetupWithGenesisAccountsAndValSet(tb testing.TB, db dbm.DB, genAccs []autht Jailed: false, Status: stakingtypes.Bonded, Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), + DelegatorShares: sdkmath.LegacyOneDec(), Description: stakingtypes.Description{}, UnbondingHeight: int64(0), UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), + Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), + MinSelfDelegation: sdkmath.ZeroInt(), } validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) } + // set validators and delegations stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) genesisState[stakingtypes.ModuleName] = appCodec.MustMarshalJSON(stakingGenesis) @@ -110,16 +113,16 @@ func SetupWithGenesisAccountsAndValSet(tb testing.TB, db dbm.DB, genAccs []autht consensusParams := simtestutil.DefaultConsensusParams consensusParams.Block.MaxGas = 100 * simtestutil.DefaultGenTxGas - wasmApp.InitChain( - abci.RequestInitChain{ + _, err = wasmApp.InitChain( + &abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, ConsensusParams: consensusParams, AppStateBytes: stateBytes, }, ) - - wasmApp.Commit() - wasmApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: wasmApp.LastBlockHeight() + 1}}) + require.NoError(b, err) + _, err = wasmApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: wasmApp.LastBlockHeight() + 1}) + require.NoError(b, err) return wasmApp } @@ -135,9 +138,7 @@ type AppInfo struct { TxConfig client.TxConfig } -func InitializeWasmApp(tb testing.TB, db dbm.DB, numAccounts int) AppInfo { - tb.Helper() - +func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { // constants minter := secp256k1.GenPrivKey() addr := sdk.AccAddress(minter.PubKey().Address()) @@ -166,25 +167,26 @@ func InitializeWasmApp(tb testing.TB, db dbm.DB, numAccounts int) AppInfo { Coins: sdk.NewCoins(sdk.NewInt64Coin(denom, 100000000000)), } } - wasmApp := SetupWithGenesisAccountsAndValSet(tb, db, genAccs, bals...) + wasmApp := SetupWithGenesisAccountsAndValSet(b, db, genAccs, bals...) // add wasm contract - height := int64(2) + height := int64(1) txGen := moduletestutil.MakeTestEncodingConfig().TxConfig - wasmApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height, Time: time.Now()}}) + _, err := wasmApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: height, Time: time.Now()}) + require.NoError(b, err) // upload the code cw20Code, err := os.ReadFile("./testdata/cw20_base.wasm") - require.NoError(tb, err) + require.NoError(b, err) storeMsg := wasmtypes.MsgStoreCode{ Sender: addr.String(), WASMByteCode: cw20Code, } r := rand.New(rand.NewSource(time.Now().UnixNano())) storeTx, err := simtestutil.GenSignedMockTx(r, txGen, []sdk.Msg{&storeMsg}, nil, 55123123, "", []uint64{0}, []uint64{0}, minter) - require.NoError(tb, err) + require.NoError(b, err) _, _, err = wasmApp.SimDeliver(txGen.TxEncoder(), storeTx) - require.NoError(tb, err) + require.NoError(b, err) codeID := uint64(1) // instantiate the contract @@ -206,7 +208,7 @@ func InitializeWasmApp(tb testing.TB, db dbm.DB, numAccounts int) AppInfo { InitialBalances: initialBalances, } initBz, err := json.Marshal(init) - require.NoError(tb, err) + require.NoError(b, err) initMsg := wasmtypes.MsgInstantiateContract{ Sender: addr.String(), Admin: addr.String(), @@ -216,17 +218,18 @@ func InitializeWasmApp(tb testing.TB, db dbm.DB, numAccounts int) AppInfo { } gasWanted := 500000 + 10000*uint64(numAccounts) initTx, err := simtestutil.GenSignedMockTx(r, txGen, []sdk.Msg{&initMsg}, nil, gasWanted, "", []uint64{0}, []uint64{1}, minter) - require.NoError(tb, err) + require.NoError(b, err) _, res, err := wasmApp.SimDeliver(txGen.TxEncoder(), initTx) - require.NoError(tb, err) + require.NoError(b, err) // TODO: parse contract address better evt := res.Events[len(res.Events)-1] attr := evt.Attributes[0] contractAddr := attr.Value - - wasmApp.EndBlock(abci.RequestEndBlock{Height: height}) - wasmApp.Commit() + _, err = wasmApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: height}) + require.NoError(b, err) + _, err = wasmApp.Commit() + require.NoError(b, err) return AppInfo{ App: wasmApp, @@ -240,16 +243,14 @@ func InitializeWasmApp(tb testing.TB, db dbm.DB, numAccounts int) AppInfo { } } -func GenSequenceOfTxs(tb testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk.Msg, error), numToGenerate int) []sdk.Tx { - tb.Helper() - +func GenSequenceOfTxs(b testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk.Msg, error), numToGenerate int) []sdk.Tx { fees := sdk.Coins{sdk.NewInt64Coin(info.Denom, 0)} txs := make([]sdk.Tx, numToGenerate) r := rand.New(rand.NewSource(time.Now().UnixNano())) for i := 0; i < numToGenerate; i++ { msgs, err := msgGen(info) - require.NoError(tb, err) + require.NoError(b, err) txs[i], err = simtestutil.GenSignedMockTx( r, info.TxConfig, @@ -261,7 +262,7 @@ func GenSequenceOfTxs(tb testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk []uint64{info.SeqNum}, info.MinterKey, ) - require.NoError(tb, err) + require.NoError(b, err) info.SeqNum++ } diff --git a/benchmarks/bench_test.go b/benchmarks/bench_test.go index 003fd11bdd..49aec11da7 100644 --- a/benchmarks/bench_test.go +++ b/benchmarks/bench_test.go @@ -5,9 +5,8 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" "github.com/syndtr/goleveldb/leveldb/opt" @@ -96,28 +95,24 @@ func BenchmarkTxSending(b *testing.B) { // number of Tx per block for the benchmarks blockSize := tc.blockSize - height := int64(3) + height := int64(2) txEncoder := appInfo.TxConfig.TxEncoder() b.ResetTimer() for i := 0; i < b.N/blockSize; i++ { - appInfo.App.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height, Time: time.Now()}}) - + xxx := make([][]byte, blockSize) for j := 0; j < blockSize; j++ { idx := i*blockSize + j bz, err := txEncoder(txs[idx]) require.NoError(b, err) - rsp := appInfo.App.CheckTx(abci.RequestCheckTx{ - Tx: bz, - Type: abci.CheckTxType_New, - }) - require.True(b, rsp.IsOK()) - dRsp := appInfo.App.DeliverTx(abci.RequestDeliverTx{Tx: bz}) - require.True(b, dRsp.IsOK()) + xxx[j] = bz } - appInfo.App.EndBlock(abci.RequestEndBlock{Height: height}) - appInfo.App.Commit() + _, err := appInfo.App.FinalizeBlock(&abci.RequestFinalizeBlock{Txs: xxx, Height: height, Time: time.Now()}) + require.NoError(b, err) + + _, err = appInfo.App.Commit() + require.NoError(b, err) height++ } }) @@ -153,7 +148,6 @@ func cw20TransferMsg(info *AppInfo) ([]sdk.Msg, error) { func buildTxFromMsg(builder func(info *AppInfo) ([]sdk.Msg, error)) func(b *testing.B, info *AppInfo) []sdk.Tx { return func(b *testing.B, info *AppInfo) []sdk.Tx { - b.Helper() return GenSequenceOfTxs(b, info, builder, b.N) } } @@ -163,7 +157,6 @@ func buildMemDB(_ *testing.B) dbm.DB { } func buildLevelDB(b *testing.B) dbm.DB { - b.Helper() levelDB, err := dbm.NewGoLevelDBWithOpts("testing", b.TempDir(), &opt.Options{BlockCacher: opt.NoCacher}) require.NoError(b, err) return levelDB diff --git a/cmd/contract_tests/main.go b/cmd/contract_tests/main.go deleted file mode 100644 index 4f27b03387..0000000000 --- a/cmd/contract_tests/main.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/snikch/goodman/hooks" - "github.com/snikch/goodman/transaction" -) - -func main() { - // This must be compiled beforehand and given to dredd as parameter, in the meantime the server should be running - h := hooks.NewHooks() - server := hooks.NewServer(hooks.NewHooksRunner(h)) - h.BeforeAll(func(t []*transaction.Transaction) { - fmt.Println("Sleep 5 seconds before all modification") - }) - h.BeforeEach(func(t *transaction.Transaction) { - fmt.Println("before each modification") - }) - h.Before("/version > GET", func(t *transaction.Transaction) { - fmt.Println("before version TEST") - }) - h.Before("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("before node_version TEST") - }) - h.BeforeEachValidation(func(t *transaction.Transaction) { - fmt.Println("before each validation modification") - }) - h.BeforeValidation("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("before validation node_version TEST") - }) - h.After("/node_version > GET", func(t *transaction.Transaction) { - fmt.Println("after node_version TEST") - }) - h.AfterEach(func(t *transaction.Transaction) { - fmt.Println("after each modification") - }) - h.AfterAll(func(t []*transaction.Transaction) { - fmt.Println("after all modification") - }) - server.Serve() - defer server.Listener.Close() - fmt.Print(h) -} diff --git a/cmd/wasmd/commands.go b/cmd/wasmd/commands.go new file mode 100644 index 0000000000..ba97b85db1 --- /dev/null +++ b/cmd/wasmd/commands.go @@ -0,0 +1,266 @@ +package main + +import ( + "errors" + "io" + "os" + + cmtcfg "github.com/cometbft/cometbft/config" + dbm "github.com/cosmos/cosmos-db" + "github.com/prometheus/client_golang/prometheus" + "github.com/spf13/cast" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + + "github.com/cosmos/cosmos-sdk/client" + "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" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + + "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/x/wasm" + wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" +) + +// 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. + + type CustomAppConfig struct { + serverconfig.Config + + Wasm wasmtypes.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: wasmtypes.DefaultWasmConfig(), + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + + wasmtypes.DefaultConfigTemplate() + + return customAppTemplate, customAppConfig +} + +func initRootCmd( + rootCmd *cobra.Command, + txConfig client.TxConfig, + interfaceRegistry codectypes.InterfaceRegistry, + appCodec codec.Codec, + basicManager module.BasicManager, +) { + cfg := sdk.GetConfig() + cfg.Seal() + + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, app.DefaultNodeHome), + NewTestnetCmd(basicManager, banktypes.GenesisBalancesIterator{}), + debug.Cmd(), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), + ) + + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + wasmcli.ExtendUnsafeResetAllCmd(rootCmd) + + // add keybase, auxiliary RPC, query, genesis, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(txConfig, basicManager), + queryCommand(), + txCommand(), + keys.Commands(), + ) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) + wasm.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +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.QueryEventForTxCmd(), + server.QueryBlockCmd(), + authcmd.QueryTxsByEventsCmd(), + server.QueryBlocksCmd(), + authcmd.QueryTxCmd(), + server.QueryBlockResultsCmd(), + ) + + 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 +} + +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) + + var wasmOpts []wasmkeeper.Option + if cast.ToBool(appOpts.Get("telemetry.enabled")) { + wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + } + + return app.NewWasmApp( + logger, db, traceStore, true, + appOpts, + wasmOpts, + baseappOptions..., + ) +} + +// appExport creates a new wasm app (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var wasmApp *app.WasmApp + // 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 is 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 + + var emptyWasmOpts []wasmkeeper.Option + wasmApp = app.NewWasmApp( + logger, + db, + traceStore, + height == -1, + appOpts, + emptyWasmOpts, + ) + + if height != -1 { + if err := wasmApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } + + return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} + +var tempDir = func() string { + dir, err := os.MkdirTemp("", "wasmd") + if err != nil { + panic("failed to create temp dir: " + err.Error()) + } + defer os.RemoveAll(dir) + + return dir +} diff --git a/cmd/wasmd/genwasm.go b/cmd/wasmd/genwasm.go index fba3d503d2..a659869f5d 100644 --- a/cmd/wasmd/genwasm.go +++ b/cmd/wasmd/genwasm.go @@ -1,9 +1,10 @@ package main import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" + wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" ) diff --git a/cmd/wasmd/main.go b/cmd/wasmd/main.go index 3a7719e6cf..af4366beda 100644 --- a/cmd/wasmd/main.go +++ b/cmd/wasmd/main.go @@ -3,22 +3,18 @@ package main import ( "os" - "github.com/cosmos/cosmos-sdk/server" + "cosmossdk.io/log" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/CosmWasm/wasmd/app" ) func main() { - rootCmd, _ := NewRootCmd() + rootCmd := NewRootCmd() if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } + log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err) + os.Exit(1) } } diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go index 7ecdf63e06..6f6022336b 100644 --- a/cmd/wasmd/root.go +++ b/cmd/wasmd/root.go @@ -1,62 +1,49 @@ package main import ( - "errors" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "io" "os" - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" - "github.com/prometheus/client_golang/prometheus" - "github.com/spf13/cast" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cobra" - "github.com/spf13/viper" - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + "cosmossdk.io/log" "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/crypto/keyring" "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/tx/signing" "github.com/cosmos/cosmos-sdk/version" - 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" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/app/params" - "github.com/CosmWasm/wasmd/x/wasm" - wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ) // NewRootCmd creates a new root command for wasmd. It is called once in the // main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() - +func NewRootCmd() *cobra.Command { cfg := sdk.GetConfig() cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) cfg.Seal() + // 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 := app.NewWasmApp(log.NewNopLogger(), dbm.NewMemDB(), nil, false, simtestutil.NewAppOptionsWithFlagHome(tempDir()), []wasmkeeper.Option{}) + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: tempApp.InterfaceRegistry(), + Codec: tempApp.AppCodec(), + TxConfig: tempApp.TxConfig(), + Amino: tempApp.LegacyAmino(), + } initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). @@ -69,13 +56,15 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { WithViper("") // In wasmd, we don't use any prefix for env variables. rootCmd := &cobra.Command{ - Use: version.AppName, - Short: "Wasm Daemon (server)", + Use: version.AppName, + Short: "Wasm Daemon (server)", + 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 @@ -86,233 +75,48 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode + // is only available if the client is online. + if !initClientCtx.Offline { + enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: enabledSignModes, + TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), + } + txConfig, err := tx.NewTxConfigWithOptions( + initClientCtx.Codec, + txConfigOpts, + ) + if err != nil { + return err + } + + initClientCtx = initClientCtx.WithTxConfig(txConfig) + } + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { return err } customAppTemplate, customAppConfig := initAppConfig() - customTMConfig := initTendermintConfig() + customCMTConfig := initCometBFTConfig() - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig) + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) }, } - initRootCmd(rootCmd, app.ModuleBasics, encodingConfig) - - return rootCmd, encodingConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.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. - - type CustomAppConfig struct { - serverconfig.Config - - Wasm wasmtypes.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: wasmtypes.DefaultWasmConfig(), - } - - customAppTemplate := serverconfig.DefaultConfigTemplate + - wasmtypes.DefaultConfigTemplate() - - return customAppTemplate, customAppConfig -} - -func initRootCmd(rootCmd *cobra.Command, moduleBasics module.BasicManager, encodingConfig params.EncodingConfig) { - gentxModule := moduleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) - - rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), - genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), - genutilcli.ValidateGenesisCmd(app.ModuleBasics), - genutilcli.AddGenesisAccountCmd(app.DefaultNodeHome), - AddGenesisWasmMsgCmd(app.DefaultNodeHome), - tmcli.NewCompletionCmd(rootCmd, true), - // testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), - NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), - debug.Cmd(), - config.Cmd(), - pruning.PruningCmd(newApp), - ) - - server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) - wasmcli.ExtendUnsafeResetAllCmd(rootCmd) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - rpc.StatusCommand(), - genesisCommand(encodingConfig), - queryCommand(), - txCommand(), - keys.Commands(app.DefaultNodeHome), - ) - // add rosetta - rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) - wasm.AddModuleInitFlags(startCmd) -} - -// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { - cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome) - - for _, subCmd := range cmds { - cmd.AddCommand(subCmd) - } - return cmd -} - -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - ) - - app.ModuleBasics.AddQueryCommands(cmd) - - 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.GetAuxToFeeCommand(), - ) - - app.ModuleBasics.AddTxCommands(cmd) - - return cmd -} - -// newApp creates the application -func newApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - baseappOptions := server.DefaultBaseappOptions(appOpts) - - var wasmOpts []wasmkeeper.Option - if cast.ToBool(appOpts.Get("telemetry.enabled")) { - wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) - } - - return app.NewWasmApp( - logger, db, traceStore, true, - appOpts, - wasmOpts, - baseappOptions..., - ) -} - -// appExport creates a new wasm app (optionally at a given height) and exports state. -func appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - var wasmApp *app.WasmApp - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home is 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 + initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager) - var emptyWasmOpts []wasmkeeper.Option - wasmApp = app.NewWasmApp( - logger, - db, - traceStore, - height == -1, - appOpts, - emptyWasmOpts, - ) + // add keyring to autocli opts + autoCliOpts := tempApp.AutoCliOpts() + initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) + autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + autoCliOpts.ClientCtx = initClientCtx - if height != -1 { - if err := wasmApp.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) } - return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return rootCmd } diff --git a/cmd/wasmd/testnet.go b/cmd/wasmd/testnet.go index c1d8dfd0fc..60b9cc1b4f 100644 --- a/cmd/wasmd/testnet.go +++ b/cmd/wasmd/testnet.go @@ -11,14 +11,13 @@ import ( "path/filepath" "time" - tmconfig "github.com/cometbft/cometbft/config" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cometbft/cometbft/types" - tmtime "github.com/cometbft/cometbft/types/time" + cmtconfig "github.com/cometbft/cometbft/config" + cmttime "github.com/cometbft/cometbft/types/time" "github.com/spf13/cobra" "github.com/spf13/pflag" "cosmossdk.io/math" + "cosmossdk.io/math/unsafe" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -26,6 +25,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" "github.com/cosmos/cosmos-sdk/testutil" @@ -82,6 +82,7 @@ type startArgs struct { outputDir string printMnemonic bool rpcAddress string + timeoutCommit time.Duration } func addTestnetFlagsToCmd(cmd *cobra.Command) { @@ -93,7 +94,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { // support old flags name for backwards compatibility cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { - if name == "algo" { + if name == flags.FlagKeyAlgorithm { name = flags.FlagKeyType } @@ -118,7 +119,7 @@ func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBala return testnetCmd } -// testnetInitFilesCmd returns a cmd to initialize all files for tendermint testnet and application +// testnetInitFilesCmd returns a cmd to initialize all files for CometBFT testnet and application func testnetInitFilesCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { cmd := &cobra.Command{ Use: "init-files", @@ -159,14 +160,13 @@ Example: if err != nil { return err } - - return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, args) + return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, clientCtx.TxConfig.SigningContext().ValidatorAddressCodec(), args) }, } addTestnetFlagsToCmd(cmd) cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") - cmd.Flags().String(flagNodeDaemonHome, "wasmd", "Home directory of the node's daemon configuration") + cmd.Flags().String(flagNodeDaemonHome, version.AppName, "Home directory of the node's daemon configuration") cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") cmd.Flags().Duration(flagCommitTimeout, 5*time.Second, "Time to wait after a block commit before starting on the new height") @@ -205,7 +205,7 @@ Example: } addTestnetFlagsToCmd(cmd) - cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of tendermint validator nodes") + cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of CometBFT validator nodes") cmd.Flags().String(flagRPCAddress, "tcp://0.0.0.0:26657", "the RPC address to listen on") cmd.Flags().String(flagAPIAddress, "tcp://0.0.0.0:1317", "the address to listen on for REST API") cmd.Flags().String(flagGRPCAddress, "0.0.0.0:9090", "the gRPC server address to listen on") @@ -219,13 +219,14 @@ const nodeDirPerm = 0o755 func initTestnetFiles( clientCtx client.Context, cmd *cobra.Command, - nodeConfig *tmconfig.Config, + nodeConfig *cmtconfig.Config, mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator, + valAddrCodec runtime.ValidatorAddressCodec, args initArgs, ) error { if args.chainID == "" { - args.chainID = "chain-" + tmrand.Str(6) + args.chainID = "chain-" + unsafe.Str(6) } nodeIDs := make([]string, args.numValidators) valPubKeys := make([]cryptotypes.PubKey, args.numValidators) @@ -244,10 +245,9 @@ func initTestnetFiles( genFiles []string ) const ( - rpcPort = 26657 - apiPort = 1317 - grpcPort = 9090 - grpcWebPort = 8090 + rpcPort = 26657 + apiPort = 1317 + grpcPort = 9090 ) p2pPortStart := 26656 @@ -273,7 +273,7 @@ func initTestnetFiles( appConfig.API.Address = fmt.Sprintf("tcp://0.0.0.0:%d", apiPort+portOffset) appConfig.GRPC.Address = fmt.Sprintf("0.0.0.0:%d", grpcPort+portOffset) - appConfig.GRPCWeb.Address = fmt.Sprintf("0.0.0.0:%d", grpcWebPort+portOffset) + appConfig.GRPCWeb.Enable = true if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { _ = os.RemoveAll(args.outputDir) @@ -334,9 +334,13 @@ func initTestnetFiles( genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) + valStr, err := valAddrCodec.BytesToString(sdk.ValAddress(addr)) + if err != nil { + return err + } valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) createValMsg, err := stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(addr), + valStr, valPubKeys[i], sdk.NewCoin(sdk.DefaultBondDenom, valTokens), stakingtypes.NewDescription(nodeDirName, "", "", "", ""), @@ -361,7 +365,7 @@ func initTestnetFiles( WithKeybase(kb). WithTxConfig(clientCtx.TxConfig) - if err := tx.Sign(txFactory, nodeDirName, txBuilder, true); err != nil { + if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil { return err } @@ -374,6 +378,7 @@ func initTestnetFiles( return err } + srvconfig.SetConfigTemplate(srvconfig.DefaultConfigTemplate) srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) } @@ -383,7 +388,7 @@ func initTestnetFiles( err := collectGenFiles( clientCtx, nodeConfig, args.chainID, nodeIDs, valPubKeys, args.numValidators, - args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator, + args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator, valAddrCodec, rpcPort, p2pPortStart, args.singleMachine, ) if err != nil { @@ -428,15 +433,10 @@ func initGenFiles( return err } - genDoc := types.GenesisDoc{ - ChainID: chainID, - AppState: appGenStateJSON, - Validators: nil, - } - + appGenesis := genutiltypes.NewAppGenesisWithVersion(chainID, appGenStateJSON) // generate empty genesis files for each validator and save for i := 0; i < numValidators; i++ { - if err := genDoc.SaveAs(genFiles[i]); err != nil { + if err := appGenesis.SaveAs(genFiles[i]); err != nil { return err } } @@ -444,14 +444,14 @@ func initGenFiles( } func collectGenFiles( - clientCtx client.Context, nodeConfig *tmconfig.Config, chainID string, + clientCtx client.Context, nodeConfig *cmtconfig.Config, chainID string, nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int, - outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, + outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, valAddrCodec runtime.ValidatorAddressCodec, rpcPortStart, p2pPortStart int, singleMachine bool, ) error { var appState json.RawMessage - genTime := tmtime.Now() + genTime := cmttime.Now() for i := 0; i < numValidators; i++ { var portOffset int @@ -471,12 +471,13 @@ func collectGenFiles( nodeID, valPubKey := nodeIDs[i], valPubKeys[i] initCfg := genutiltypes.NewInitConfig(chainID, gentxsDir, nodeID, valPubKey) - genDoc, err := types.GenesisDocFromFile(nodeConfig.GenesisFile()) + appGenesis, err := genutiltypes.AppGenesisFromFile(nodeConfig.GenesisFile()) if err != nil { return err } - nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutiltypes.DefaultMessageValidator) + nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, appGenesis, genBalIterator, genutiltypes.DefaultMessageValidator, + valAddrCodec) if err != nil { return err } @@ -528,7 +529,7 @@ func writeFile(name, dir string, contents []byte) error { return fmt.Errorf("could not create directory %q: %w", dir, err) } - if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec + if err := os.WriteFile(file, contents, 0o600); err != nil { return err } @@ -547,11 +548,12 @@ func startTestnet(cmd *cobra.Command, args startArgs) error { networkConfig.SigningAlgo = args.algo networkConfig.MinGasPrices = args.minGasPrices networkConfig.NumValidators = args.numValidators - networkConfig.EnableTMLogging = args.enableLogging + networkConfig.EnableLogging = args.enableLogging networkConfig.RPCAddress = args.rpcAddress networkConfig.APIAddress = args.apiAddress networkConfig.GRPCAddress = args.grpcAddress networkConfig.PrintMnemonic = args.printMnemonic + networkConfig.TimeoutCommit = args.timeoutCommit networkLogger := network.NewCLILogger(cmd) baseDir := fmt.Sprintf("%s/%s", args.outputDir, networkConfig.ChainID) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index c3de180ca7..3d0be4af3f 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -30,10 +30,49 @@ - [MaxFundsLimit](#cosmwasm.wasm.v1.MaxFundsLimit) - [StoreCodeAuthorization](#cosmwasm.wasm.v1.StoreCodeAuthorization) +- [cosmwasm/wasm/v1/tx.proto](#cosmwasm/wasm/v1/tx.proto) + - [MsgAddCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses) + - [MsgAddCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse) + - [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) + - [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) + - [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) + - [MsgExecuteContractResponse](#cosmwasm.wasm.v1.MsgExecuteContractResponse) + - [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) + - [MsgInstantiateContract2](#cosmwasm.wasm.v1.MsgInstantiateContract2) + - [MsgInstantiateContract2Response](#cosmwasm.wasm.v1.MsgInstantiateContract2Response) + - [MsgInstantiateContractResponse](#cosmwasm.wasm.v1.MsgInstantiateContractResponse) + - [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) + - [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) + - [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) + - [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) + - [MsgRemoveCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses) + - [MsgRemoveCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse) + - [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) + - [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) + - [MsgStoreAndMigrateContract](#cosmwasm.wasm.v1.MsgStoreAndMigrateContract) + - [MsgStoreAndMigrateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse) + - [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) + - [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse) + - [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) + - [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) + - [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) + - [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) + - [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) + - [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) + - [MsgUpdateContractLabel](#cosmwasm.wasm.v1.MsgUpdateContractLabel) + - [MsgUpdateContractLabelResponse](#cosmwasm.wasm.v1.MsgUpdateContractLabelResponse) + - [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) + - [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) + - [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) + - [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) + + - [Msg](#cosmwasm.wasm.v1.Msg) + - [cosmwasm/wasm/v1/genesis.proto](#cosmwasm/wasm/v1/genesis.proto) - [Code](#cosmwasm.wasm.v1.Code) - [Contract](#cosmwasm.wasm.v1.Contract) - [GenesisState](#cosmwasm.wasm.v1.GenesisState) + - [GenesisState.GenMsgs](#cosmwasm.wasm.v1.GenesisState.GenMsgs) - [Sequence](#cosmwasm.wasm.v1.Sequence) - [cosmwasm/wasm/v1/ibc.proto](#cosmwasm/wasm/v1/ibc.proto) @@ -60,6 +99,8 @@ - [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse) - [QueryAllContractStateRequest](#cosmwasm.wasm.v1.QueryAllContractStateRequest) - [QueryAllContractStateResponse](#cosmwasm.wasm.v1.QueryAllContractStateResponse) + - [QueryBuildAddressRequest](#cosmwasm.wasm.v1.QueryBuildAddressRequest) + - [QueryBuildAddressResponse](#cosmwasm.wasm.v1.QueryBuildAddressResponse) - [QueryCodeRequest](#cosmwasm.wasm.v1.QueryCodeRequest) - [QueryCodeResponse](#cosmwasm.wasm.v1.QueryCodeResponse) - [QueryCodesRequest](#cosmwasm.wasm.v1.QueryCodesRequest) @@ -83,44 +124,6 @@ - [Query](#cosmwasm.wasm.v1.Query) -- [cosmwasm/wasm/v1/tx.proto](#cosmwasm/wasm/v1/tx.proto) - - [MsgAddCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses) - - [MsgAddCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse) - - [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) - - [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) - - [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) - - [MsgExecuteContractResponse](#cosmwasm.wasm.v1.MsgExecuteContractResponse) - - [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) - - [MsgInstantiateContract2](#cosmwasm.wasm.v1.MsgInstantiateContract2) - - [MsgInstantiateContract2Response](#cosmwasm.wasm.v1.MsgInstantiateContract2Response) - - [MsgInstantiateContractResponse](#cosmwasm.wasm.v1.MsgInstantiateContractResponse) - - [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) - - [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) - - [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) - - [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) - - [MsgRemoveCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses) - - [MsgRemoveCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse) - - [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) - - [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) - - [MsgStoreAndMigrateContract](#cosmwasm.wasm.v1.MsgStoreAndMigrateContract) - - [MsgStoreAndMigrateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse) - - [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) - - [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse) - - [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) - - [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) - - [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) - - [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) - - [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) - - [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) - - [MsgUpdateContractLabel](#cosmwasm.wasm.v1.MsgUpdateContractLabel) - - [MsgUpdateContractLabelResponse](#cosmwasm.wasm.v1.MsgUpdateContractLabelResponse) - - [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) - - [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) - - [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) - - [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) - - - [Msg](#cosmwasm.wasm.v1.Msg) - - [Scalar Value Types](#scalar-value-types) @@ -499,340 +502,287 @@ Since: wasmd 0.42 - +

Top

-## cosmwasm/wasm/v1/genesis.proto +## cosmwasm/wasm/v1/tx.proto - + -### Code -Code struct encompasses CodeInfo and CodeBytes +### MsgAddCodeUploadParamsAddresses +MsgAddCodeUploadParamsAddresses is the +MsgAddCodeUploadParamsAddresses request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | | -| `code_info` | [CodeInfo](#cosmwasm.wasm.v1.CodeInfo) | | | -| `code_bytes` | [bytes](#bytes) | | | -| `pinned` | [bool](#bool) | | Pinned to wasmvm cache | - - +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `addresses` | [string](#string) | repeated | | - -### Contract -Contract struct encompasses ContractAddress, ContractInfo, and ContractState + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `contract_address` | [string](#string) | | | -| `contract_info` | [ContractInfo](#cosmwasm.wasm.v1.ContractInfo) | | | -| `contract_state` | [Model](#cosmwasm.wasm.v1.Model) | repeated | | -| `contract_code_history` | [ContractCodeHistoryEntry](#cosmwasm.wasm.v1.ContractCodeHistoryEntry) | repeated | | +### MsgAddCodeUploadParamsAddressesResponse +MsgAddCodeUploadParamsAddressesResponse defines the response +structure for executing a MsgAddCodeUploadParamsAddresses message. - + -### GenesisState -GenesisState - genesis state of x/wasm +### MsgClearAdmin +MsgClearAdmin removes any admin stored for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `params` | [Params](#cosmwasm.wasm.v1.Params) | | | -| `codes` | [Code](#cosmwasm.wasm.v1.Code) | repeated | | -| `contracts` | [Contract](#cosmwasm.wasm.v1.Contract) | repeated | | -| `sequences` | [Sequence](#cosmwasm.wasm.v1.Sequence) | repeated | | - - +| `sender` | [string](#string) | | Sender is the actor that signed the messages | +| `contract` | [string](#string) | | Contract is the address of the smart contract | - -### Sequence -Sequence key and value of an id generation counter + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id_key` | [bytes](#bytes) | | | -| `value` | [uint64](#uint64) | | | +### MsgClearAdminResponse +MsgClearAdminResponse returns empty data - - + - +### MsgExecuteContract +MsgExecuteContract submits the given message data to a smart contract - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on execution | - -

Top

-## cosmwasm/wasm/v1/ibc.proto - + -### MsgIBCCloseChannel -MsgIBCCloseChannel port and channel need to be owned by the contract +### MsgExecuteContractResponse +MsgExecuteContractResponse returns execution result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `channel` | [string](#string) | | | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - + -### MsgIBCSend -MsgIBCSend +### MsgInstantiateContract +MsgInstantiateContract create a new smart contract instance for the given +code id. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `channel` | [string](#string) | | the channel by which the packet will be sent | -| `timeout_height` | [uint64](#uint64) | | Timeout height relative to the current block height. The timeout is disabled when set to 0. | -| `timeout_timestamp` | [uint64](#uint64) | | Timeout timestamp (in nanoseconds) relative to the current block timestamp. The timeout is disabled when set to 0. | -| `data` | [bytes](#bytes) | | Data is the payload to transfer. We must not make assumption what format or content is in here. | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | - + -### MsgIBCSendResponse -MsgIBCSendResponse +### MsgInstantiateContract2 +MsgInstantiateContract2 create a new smart contract instance for the given +code id with a predicable address. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sequence` | [uint64](#uint64) | | Sequence number of the IBC packet sent | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `salt` | [bytes](#bytes) | | Salt is an arbitrary value provided by the sender. Size can be 1 to 64. | +| `fix_msg` | [bool](#bool) | | FixMsg include the msg value into the hash for the predictable address. Default is false | - - + - +### MsgInstantiateContract2Response +MsgInstantiateContract2Response return instantiation result data - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - -

Top

-## cosmwasm/wasm/v1/proposal_legacy.proto - + -### AccessConfigUpdate -AccessConfigUpdate contains the code id and the access config to be -applied. +### MsgInstantiateContractResponse +MsgInstantiateContractResponse return instantiation result data | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code to be updated | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply to the set of code ids | +| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - + -### ClearAdminProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit ClearAdminProposal. To clear the admin of a contract, -a simple MsgClearAdmin can be invoked from the x/gov module via -a v1 governance proposal. +### MsgMigrateContract +MsgMigrateContract runs a code upgrade/ downgrade for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | | `contract` | [string](#string) | | Contract is the address of the smart contract | +| `code_id` | [uint64](#uint64) | | CodeID references the new WASM code | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | - + -### ExecuteContractProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit ExecuteContractProposal. To call execute on a contract, -a simple MsgExecuteContract can be invoked from the x/gov module via -a v1 governance proposal. +### MsgMigrateContractResponse +MsgMigrateContractResponse returns contract migration result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| `contract` | [string](#string) | | Contract is the address of the smart contract | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as execute | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `data` | [bytes](#bytes) | | Data contains same raw bytes returned as data from the wasm contract. (May be empty) | - + -### InstantiateContract2Proposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit InstantiateContract2Proposal. To instantiate contract 2, -a simple MsgInstantiateContract2 can be invoked from the x/gov module via -a v1 governance proposal. +### MsgPinCodes +MsgPinCodes is the MsgPinCodes request type. + +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's enviroment as sender | -| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | -| `msg` | [bytes](#bytes) | | Msg json encode message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | -| `salt` | [bytes](#bytes) | | Salt is an arbitrary value provided by the sender. Size can be 1 to 64. | -| `fix_msg` | [bool](#bool) | | FixMsg include the msg value into the hash for the predictable address. Default is false | - +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | - -### InstantiateContractProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit InstantiateContractProposal. To instantiate a contract, -a simple MsgInstantiateContract can be invoked from the x/gov module via -a v1 governance proposal. + +### MsgPinCodesResponse +MsgPinCodesResponse defines the response structure for executing a +MsgPinCodes message. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +Since: 0.40 - + -### MigrateContractProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit MigrateContractProposal. To migrate a contract, -a simple MsgMigrateContract can be invoked from the x/gov module via -a v1 governance proposal. +### MsgRemoveCodeUploadParamsAddresses +MsgRemoveCodeUploadParamsAddresses is the +MsgRemoveCodeUploadParamsAddresses request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `addresses` | [string](#string) | repeated | | -Note: skipping 3 as this was previously used for unneeded run_as | -| `contract` | [string](#string) | | Contract is the address of the smart contract | -| `code_id` | [uint64](#uint64) | | CodeID references the new WASM code | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | + - +### MsgRemoveCodeUploadParamsAddressesResponse +MsgRemoveCodeUploadParamsAddressesResponse defines the response +structure for executing a MsgRemoveCodeUploadParamsAddresses message. -### PinCodesProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit PinCodesProposal. To pin a set of code ids in the wasmvm -cache, a simple MsgPinCodes can be invoked from the x/gov module via -a v1 governance proposal. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | + - +### MsgStoreAndInstantiateContract +MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract +request type. -### StoreAndInstantiateContractProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit StoreAndInstantiateContractProposal. To store and instantiate -the contract, a simple MsgStoreAndInstantiateContract can be invoked from -the x/gov module via a v1 governance proposal. +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | +| `authority` | [string](#string) | | Authority is the address of the governance account. | | `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | -| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional. As default the uploaded contract is pinned to cache. | | `admin` | [string](#string) | | Admin is an optional address that can execute migrations | | `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | | `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred from the authority account to the contract on instantiation | | `source` | [string](#string) | | Source is the URL where the code is hosted | | `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | | `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | @@ -842,1092 +792,1219 @@ the x/gov module via a v1 governance proposal. - + -### StoreCodeProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit StoreCodeProposal. To submit WASM code to the system, -a simple MsgStoreCode can be invoked from the x/gov module via -a v1 governance proposal. +### MsgStoreAndInstantiateContractResponse +MsgStoreAndInstantiateContractResponse defines the response structure +for executing a MsgStoreAndInstantiateContract message. + +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | -| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | -| `source` | [string](#string) | | Source is the URL where the code is hosted | -| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | -| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | +| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - + -### SudoContractProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit SudoContractProposal. To call sudo on a contract, -a simple MsgSudoContract can be invoked from the x/gov module via -a v1 governance proposal. +### MsgStoreAndMigrateContract +MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract +request type. + +Since: 0.42 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | | `contract` | [string](#string) | | Contract is the address of the smart contract | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as sudo | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | - + -### UnpinCodesProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm -cache, a simple MsgUnpinCodes can be invoked from the x/gov module via -a v1 governance proposal. +### MsgStoreAndMigrateContractResponse +MsgStoreAndMigrateContractResponse defines the response structure +for executing a MsgStoreAndMigrateContract message. + +Since: 0.42 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `checksum` | [bytes](#bytes) | | Checksum is the sha256 hash of the stored code | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - + -### UpdateAdminProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit UpdateAdminProposal. To set an admin for a contract, -a simple MsgUpdateAdmin can be invoked from the x/gov module via -a v1 governance proposal. +### MsgStoreCode +MsgStoreCode submit Wasm code to the system | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `new_admin` | [string](#string) | | NewAdmin address to be set | -| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `sender` | [string](#string) | | Sender is the actor that signed the messages | +| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | - + -### UpdateInstantiateConfigProposal -Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -an explicit UpdateInstantiateConfigProposal. To update instantiate config -to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from -the x/gov module via a v1 governance proposal. +### MsgStoreCodeResponse +MsgStoreCodeResponse returns store result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `access_config_updates` | [AccessConfigUpdate](#cosmwasm.wasm.v1.AccessConfigUpdate) | repeated | AccessConfigUpdate contains the list of code ids and the access config to be applied. | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `checksum` | [bytes](#bytes) | | Checksum is the sha256 hash of the stored code | - - + - +### MsgSudoContract +MsgSudoContract is the MsgSudoContract request type. - +Since: 0.40 +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as sudo | - -

Top

-## cosmwasm/wasm/v1/query.proto - -### CodeInfoResponse -CodeInfoResponse contains code meta data from CodeInfo + + +### MsgSudoContractResponse +MsgSudoContractResponse defines the response structure for executing a +MsgSudoContract message. + +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | id for legacy support | -| `creator` | [string](#string) | | | -| `data_hash` | [bytes](#bytes) | | | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - + -### QueryAllContractStateRequest -QueryAllContractStateRequest is the request type for the -Query/AllContractState RPC method +### MsgUnpinCodes +MsgUnpinCodes is the MsgUnpinCodes request type. + +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | - + -### QueryAllContractStateResponse -QueryAllContractStateResponse is the response type for the -Query/AllContractState RPC method +### MsgUnpinCodesResponse +MsgUnpinCodesResponse defines the response structure for executing a +MsgUnpinCodes message. + +Since: 0.40 + + + + + + + + +### MsgUpdateAdmin +MsgUpdateAdmin sets a new admin for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `models` | [Model](#cosmwasm.wasm.v1.Model) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `new_admin` | [string](#string) | | NewAdmin address to be set | +| `contract` | [string](#string) | | Contract is the address of the smart contract | - + + +### MsgUpdateAdminResponse +MsgUpdateAdminResponse returns empty data + + + -### QueryCodeRequest -QueryCodeRequest is the request type for the Query/Code RPC method + + + + +### MsgUpdateContractLabel +MsgUpdateContractLabel sets a new label for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | grpc-gateway_out does not support Go style CodID | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `new_label` | [string](#string) | | NewLabel string to be set | +| `contract` | [string](#string) | | Contract is the address of the smart contract | - + -### QueryCodeResponse -QueryCodeResponse is the response type for the Query/Code RPC method +### MsgUpdateContractLabelResponse +MsgUpdateContractLabelResponse returns empty data + + + + + + + + +### MsgUpdateInstantiateConfig +MsgUpdateInstantiateConfig updates instantiate config for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_info` | [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse) | | | -| `data` | [bytes](#bytes) | | | +| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `code_id` | [uint64](#uint64) | | CodeID references the stored WASM code | +| `new_instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | NewInstantiatePermission is the new access control | - + -### QueryCodesRequest -QueryCodesRequest is the request type for the Query/Codes RPC method +### MsgUpdateInstantiateConfigResponse +MsgUpdateInstantiateConfigResponse returns empty data + + + + + + + + +### MsgUpdateParams +MsgUpdateParams is the MsgUpdateParams request type. + +Since: 0.40 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `authority` | [string](#string) | | Authority is the address of the governance account. | +| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the x/wasm parameters to update. +NOTE: All parameters must be supplied. | - -### QueryCodesResponse -QueryCodesResponse is the response type for the Query/Codes RPC method + +### MsgUpdateParamsResponse +MsgUpdateParamsResponse defines the response structure for executing a +MsgUpdateParams message. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `code_infos` | [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +Since: 0.40 + - + -### QueryContractHistoryRequest -QueryContractHistoryRequest is the request type for the Query/ContractHistory -RPC method + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract to query | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + +### Msg +Msg defines the wasm Msg service. + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `StoreCode` | [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) | [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse) | StoreCode to submit Wasm code to the system | | +| `InstantiateContract` | [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) | [MsgInstantiateContractResponse](#cosmwasm.wasm.v1.MsgInstantiateContractResponse) | InstantiateContract creates a new smart contract instance for the given code id. | | +| `InstantiateContract2` | [MsgInstantiateContract2](#cosmwasm.wasm.v1.MsgInstantiateContract2) | [MsgInstantiateContract2Response](#cosmwasm.wasm.v1.MsgInstantiateContract2Response) | InstantiateContract2 creates a new smart contract instance for the given code id with a predictable address | | +| `ExecuteContract` | [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) | [MsgExecuteContractResponse](#cosmwasm.wasm.v1.MsgExecuteContractResponse) | Execute submits the given message data to a smart contract | | +| `MigrateContract` | [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) | [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) | Migrate runs a code upgrade/ downgrade for a smart contract | | +| `UpdateAdmin` | [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | | +| `ClearAdmin` | [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | | +| `UpdateInstantiateConfig` | [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) | [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) | UpdateInstantiateConfig updates instantiate config for a smart contract | | +| `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper. +Since: 0.40 | | +| `SudoContract` | [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) | [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) | SudoContract defines a governance operation for calling sudo on a contract. The authority is defined in the keeper. +Since: 0.40 | | +| `PinCodes` | [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) | [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) | PinCodes defines a governance operation for pinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. +Since: 0.40 | | +| `UnpinCodes` | [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) | [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) | UnpinCodes defines a governance operation for unpinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. +Since: 0.40 | | +| `StoreAndInstantiateContract` | [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) | [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) | StoreAndInstantiateContract defines a governance operation for storing and instantiating the contract. The authority is defined in the keeper. +Since: 0.40 | | +| `RemoveCodeUploadParamsAddresses` | [MsgRemoveCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses) | [MsgRemoveCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse) | RemoveCodeUploadParamsAddresses defines a governance operation for removing addresses from code upload params. The authority is defined in the keeper. | | +| `AddCodeUploadParamsAddresses` | [MsgAddCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses) | [MsgAddCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse) | AddCodeUploadParamsAddresses defines a governance operation for adding addresses to code upload params. The authority is defined in the keeper. | | +| `StoreAndMigrateContract` | [MsgStoreAndMigrateContract](#cosmwasm.wasm.v1.MsgStoreAndMigrateContract) | [MsgStoreAndMigrateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse) | StoreAndMigrateContract defines a governance operation for storing and migrating the contract. The authority is defined in the keeper. - +Since: 0.42 | | +| `UpdateContractLabel` | [MsgUpdateContractLabel](#cosmwasm.wasm.v1.MsgUpdateContractLabel) | [MsgUpdateContractLabelResponse](#cosmwasm.wasm.v1.MsgUpdateContractLabelResponse) | UpdateContractLabel sets a new label for a smart contract -### QueryContractHistoryResponse -QueryContractHistoryResponse is the response type for the -Query/ContractHistory RPC method +Since: 0.43 | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `entries` | [ContractCodeHistoryEntry](#cosmwasm.wasm.v1.ContractCodeHistoryEntry) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + +

Top

+## cosmwasm/wasm/v1/genesis.proto - + -### QueryContractInfoRequest -QueryContractInfoRequest is the request type for the Query/ContractInfo RPC -method +### Code +Code struct encompasses CodeInfo and CodeBytes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract to query | +| `code_id` | [uint64](#uint64) | | | +| `code_info` | [CodeInfo](#cosmwasm.wasm.v1.CodeInfo) | | | +| `code_bytes` | [bytes](#bytes) | | | +| `pinned` | [bool](#bool) | | Pinned to wasmvm cache | - + -### QueryContractInfoResponse -QueryContractInfoResponse is the response type for the Query/ContractInfo RPC -method +### Contract +Contract struct encompasses ContractAddress, ContractInfo, and ContractState | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract | +| `contract_address` | [string](#string) | | | | `contract_info` | [ContractInfo](#cosmwasm.wasm.v1.ContractInfo) | | | +| `contract_state` | [Model](#cosmwasm.wasm.v1.Model) | repeated | | +| `contract_code_history` | [ContractCodeHistoryEntry](#cosmwasm.wasm.v1.ContractCodeHistoryEntry) | repeated | | - + -### QueryContractsByCodeRequest -QueryContractsByCodeRequest is the request type for the Query/ContractsByCode -RPC method +### GenesisState +GenesisState - genesis state of x/wasm | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | grpc-gateway_out does not support Go style CodID | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `params` | [Params](#cosmwasm.wasm.v1.Params) | | | +| `codes` | [Code](#cosmwasm.wasm.v1.Code) | repeated | | +| `contracts` | [Contract](#cosmwasm.wasm.v1.Contract) | repeated | | +| `sequences` | [Sequence](#cosmwasm.wasm.v1.Sequence) | repeated | | +| `gen_msgs` | [GenesisState.GenMsgs](#cosmwasm.wasm.v1.GenesisState.GenMsgs) | repeated | | - + -### QueryContractsByCodeResponse -QueryContractsByCodeResponse is the response type for the -Query/ContractsByCode RPC method +### GenesisState.GenMsgs +GenMsgs define the messages that can be executed during genesis phase in +order. The intention is to have more human readable data that is auditable. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `contracts` | [string](#string) | repeated | contracts are a set of contract addresses | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `store_code` | [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) | | | +| `instantiate_contract` | [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) | | | +| `execute_contract` | [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) | | MsgInstantiateContract2 intentionally not supported see https://github.com/CosmWasm/wasmd/issues/987 | - + -### QueryContractsByCreatorRequest -QueryContractsByCreatorRequest is the request type for the -Query/ContractsByCreator RPC method. +### Sequence +Sequence key and value of an id generation counter | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `creator_address` | [string](#string) | | CreatorAddress is the address of contract creator | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | Pagination defines an optional pagination for the request. | +| `id_key` | [bytes](#bytes) | | | +| `value` | [uint64](#uint64) | | | + - + -### QueryContractsByCreatorResponse -QueryContractsByCreatorResponse is the response type for the -Query/ContractsByCreator RPC method. + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `contract_addresses` | [string](#string) | repeated | ContractAddresses result set | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | Pagination defines the pagination in the response. | + +

Top

+ +## cosmwasm/wasm/v1/ibc.proto + + +### MsgIBCCloseChannel +MsgIBCCloseChannel port and channel need to be owned by the contract - -### QueryParamsRequest -QueryParamsRequest is the request type for the Query/Params RPC method. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `channel` | [string](#string) | | | - + -### QueryParamsResponse -QueryParamsResponse is the response type for the Query/Params RPC method. +### MsgIBCSend +MsgIBCSend | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the parameters of the module. | +| `channel` | [string](#string) | | the channel by which the packet will be sent | +| `timeout_height` | [uint64](#uint64) | | Timeout height relative to the current block height. The timeout is disabled when set to 0. | +| `timeout_timestamp` | [uint64](#uint64) | | Timeout timestamp (in nanoseconds) relative to the current block timestamp. The timeout is disabled when set to 0. | +| `data` | [bytes](#bytes) | | Data is the payload to transfer. We must not make assumption what format or content is in here. | - + -### QueryPinnedCodesRequest -QueryPinnedCodesRequest is the request type for the Query/PinnedCodes -RPC method +### MsgIBCSendResponse +MsgIBCSendResponse | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `sequence` | [uint64](#uint64) | | Sequence number of the IBC packet sent | + - + -### QueryPinnedCodesResponse -QueryPinnedCodesResponse is the response type for the -Query/PinnedCodes RPC method + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `code_ids` | [uint64](#uint64) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + +

Top

+## cosmwasm/wasm/v1/proposal_legacy.proto - + -### QueryRawContractStateRequest -QueryRawContractStateRequest is the request type for the -Query/RawContractState RPC method +### AccessConfigUpdate +AccessConfigUpdate contains the code id and the access config to be +applied. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract | -| `query_data` | [bytes](#bytes) | | | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code to be updated | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply to the set of code ids | - + -### QueryRawContractStateResponse -QueryRawContractStateResponse is the response type for the -Query/RawContractState RPC method +### ClearAdminProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit ClearAdminProposal. To clear the admin of a contract, +a simple MsgClearAdmin can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains the raw store data | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `contract` | [string](#string) | | Contract is the address of the smart contract | - + -### QuerySmartContractStateRequest -QuerySmartContractStateRequest is the request type for the -Query/SmartContractState RPC method +### ExecuteContractProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit ExecuteContractProposal. To call execute on a contract, +a simple MsgExecuteContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the address of the contract | -| `query_data` | [bytes](#bytes) | | QueryData contains the query data passed to the contract | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | +| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as execute | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | - + -### QuerySmartContractStateResponse -QuerySmartContractStateResponse is the response type for the -Query/SmartContractState RPC method +### InstantiateContract2Proposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit InstantiateContract2Proposal. To instantiate contract 2, +a simple MsgInstantiateContract2 can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains the json data returned from the smart contract | - - - - +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's enviroment as sender | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | +| `msg` | [bytes](#bytes) | | Msg json encode message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `salt` | [bytes](#bytes) | | Salt is an arbitrary value provided by the sender. Size can be 1 to 64. | +| `fix_msg` | [bool](#bool) | | FixMsg include the msg value into the hash for the predictable address. Default is false | - - - - -### Query -Query provides defines the gRPC querier service + -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `ContractInfo` | [QueryContractInfoRequest](#cosmwasm.wasm.v1.QueryContractInfoRequest) | [QueryContractInfoResponse](#cosmwasm.wasm.v1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | GET|/cosmwasm/wasm/v1/contract/{address}| -| `ContractHistory` | [QueryContractHistoryRequest](#cosmwasm.wasm.v1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#cosmwasm.wasm.v1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | GET|/cosmwasm/wasm/v1/contract/{address}/history| -| `ContractsByCode` | [QueryContractsByCodeRequest](#cosmwasm.wasm.v1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#cosmwasm.wasm.v1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | GET|/cosmwasm/wasm/v1/code/{code_id}/contracts| -| `AllContractState` | [QueryAllContractStateRequest](#cosmwasm.wasm.v1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#cosmwasm.wasm.v1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | GET|/cosmwasm/wasm/v1/contract/{address}/state| -| `RawContractState` | [QueryRawContractStateRequest](#cosmwasm.wasm.v1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#cosmwasm.wasm.v1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | GET|/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}| -| `SmartContractState` | [QuerySmartContractStateRequest](#cosmwasm.wasm.v1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#cosmwasm.wasm.v1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | GET|/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}| -| `Code` | [QueryCodeRequest](#cosmwasm.wasm.v1.QueryCodeRequest) | [QueryCodeResponse](#cosmwasm.wasm.v1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | GET|/cosmwasm/wasm/v1/code/{code_id}| -| `Codes` | [QueryCodesRequest](#cosmwasm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#cosmwasm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/cosmwasm/wasm/v1/code| -| `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned| -| `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params| -| `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}| +### InstantiateContractProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit InstantiateContractProposal. To instantiate a contract, +a simple MsgInstantiateContract can be invoked from the x/gov module via +a v1 governance proposal. - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | - -

Top

-## cosmwasm/wasm/v1/tx.proto - + -### MsgAddCodeUploadParamsAddresses -MsgAddCodeUploadParamsAddresses is the -MsgAddCodeUploadParamsAddresses request type. +### MigrateContractProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit MigrateContractProposal. To migrate a contract, +a simple MsgMigrateContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `addresses` | [string](#string) | repeated | | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text +Note: skipping 3 as this was previously used for unneeded run_as | +| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `code_id` | [uint64](#uint64) | | CodeID references the new WASM code | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | - -### MsgAddCodeUploadParamsAddressesResponse -MsgAddCodeUploadParamsAddressesResponse defines the response -structure for executing a MsgAddCodeUploadParamsAddresses message. + + +### PinCodesProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit PinCodesProposal. To pin a set of code ids in the wasmvm +cache, a simple MsgPinCodes can be invoked from the x/gov module via +a v1 governance proposal. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | - -### MsgClearAdmin -MsgClearAdmin removes any admin stored for a smart contract + + +### StoreAndInstantiateContractProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit StoreAndInstantiateContractProposal. To store and instantiate +the contract, a simple MsgStoreAndInstantiateContract can be invoked from +the x/gov module via a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the actor that signed the messages | -| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | +| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | +| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | +| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | +| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `source` | [string](#string) | | Source is the URL where the code is hosted | +| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | +| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | - + + +### StoreCodeProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit StoreCodeProposal. To submit WASM code to the system, +a simple MsgStoreCode can be invoked from the x/gov module via +a v1 governance proposal. -### MsgClearAdminResponse -MsgClearAdminResponse returns empty data +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `run_as` | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | +| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | +| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `source` | [string](#string) | | Source is the URL where the code is hosted | +| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | +| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | - -### MsgExecuteContract -MsgExecuteContract submits the given message data to a smart contract + + +### SudoContractProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit SudoContractProposal. To call sudo on a contract, +a simple MsgSudoContract can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | | `contract` | [string](#string) | | Contract is the address of the smart contract | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on execution | +| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as sudo | - + -### MsgExecuteContractResponse -MsgExecuteContractResponse returns execution result data. +### UnpinCodesProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm +cache, a simple MsgUnpinCodes can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | - + -### MsgInstantiateContract -MsgInstantiateContract create a new smart contract instance for the given -code id. +### UpdateAdminProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UpdateAdminProposal. To set an admin for a contract, +a simple MsgUpdateAdmin can be invoked from the x/gov module via +a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `new_admin` | [string](#string) | | NewAdmin address to be set | +| `contract` | [string](#string) | | Contract is the address of the smart contract | - + -### MsgInstantiateContract2 -MsgInstantiateContract2 create a new smart contract instance for the given -code id with a predicable address. +### UpdateInstantiateConfigProposal +Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for +an explicit UpdateInstantiateConfigProposal. To update instantiate config +to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from +the x/gov module via a v1 governance proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `label` | [string](#string) | | Label is optional metadata to be stored with a contract instance. | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred to the contract on instantiation | -| `salt` | [bytes](#bytes) | | Salt is an arbitrary value provided by the sender. Size can be 1 to 64. | -| `fix_msg` | [bool](#bool) | | FixMsg include the msg value into the hash for the predictable address. Default is false | +| `title` | [string](#string) | | Title is a short summary | +| `description` | [string](#string) | | Description is a human readable text | +| `access_config_updates` | [AccessConfigUpdate](#cosmwasm.wasm.v1.AccessConfigUpdate) | repeated | AccessConfigUpdate contains the list of code ids and the access config to be applied. | + - + -### MsgInstantiateContract2Response -MsgInstantiateContract2Response return instantiation result data + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | + +

Top

+## cosmwasm/wasm/v1/query.proto - + -### MsgInstantiateContractResponse -MsgInstantiateContractResponse return instantiation result data +### CodeInfoResponse +CodeInfoResponse contains code meta data from CodeInfo | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | +| `code_id` | [uint64](#uint64) | | id for legacy support | +| `creator` | [string](#string) | | | +| `data_hash` | [bytes](#bytes) | | | +| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | | - + -### MsgMigrateContract -MsgMigrateContract runs a code upgrade/ downgrade for a smart contract +### QueryAllContractStateRequest +QueryAllContractStateRequest is the request type for the +Query/AllContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `contract` | [string](#string) | | Contract is the address of the smart contract | -| `code_id` | [uint64](#uint64) | | CodeID references the new WASM code | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | +| `address` | [string](#string) | | address is the address of the contract | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - + -### MsgMigrateContractResponse -MsgMigrateContractResponse returns contract migration result data. +### QueryAllContractStateResponse +QueryAllContractStateResponse is the response type for the +Query/AllContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains same raw bytes returned as data from the wasm contract. (May be empty) | - +| `models` | [Model](#cosmwasm.wasm.v1.Model) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - -### MsgPinCodes -MsgPinCodes is the MsgPinCodes request type. + -Since: 0.40 +### QueryBuildAddressRequest +QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC +method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the new WASM codes | +| `code_hash` | [string](#string) | | CodeHash is the hash of the code | +| `creator_address` | [string](#string) | | CreatorAddress is the address of the contract instantiator | +| `salt` | [string](#string) | | Salt is a hex encoded salt | +| `init_args` | [bytes](#bytes) | | InitArgs are optional json encoded init args to be used in contract address building if provided | - + -### MsgPinCodesResponse -MsgPinCodesResponse defines the response structure for executing a -MsgPinCodes message. +### QueryBuildAddressResponse +QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC +method. -Since: 0.40 + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | Address is the contract address | - + -### MsgRemoveCodeUploadParamsAddresses -MsgRemoveCodeUploadParamsAddresses is the -MsgRemoveCodeUploadParamsAddresses request type. +### QueryCodeRequest +QueryCodeRequest is the request type for the Query/Code RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `addresses` | [string](#string) | repeated | | +| `code_id` | [uint64](#uint64) | | grpc-gateway_out does not support Go style CodID | - + -### MsgRemoveCodeUploadParamsAddressesResponse -MsgRemoveCodeUploadParamsAddressesResponse defines the response -structure for executing a MsgRemoveCodeUploadParamsAddresses message. +### QueryCodeResponse +QueryCodeResponse is the response type for the Query/Code RPC method +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `code_info` | [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse) | | | +| `data` | [bytes](#bytes) | | | - -### MsgStoreAndInstantiateContract -MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract -request type. -Since: 0.40 + + +### QueryCodesRequest +QueryCodesRequest is the request type for the Query/Codes RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | -| `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional. As default the uploaded contract is pinned to cache. | -| `admin` | [string](#string) | | Admin is an optional address that can execute migrations | -| `label` | [string](#string) | | Label is optional metadata to be stored with a constract instance. | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on instantiation | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Funds coins that are transferred from the authority account to the contract on instantiation | -| `source` | [string](#string) | | Source is the URL where the code is hosted | -| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | -| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | - +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - -### MsgStoreAndInstantiateContractResponse -MsgStoreAndInstantiateContractResponse defines the response structure -for executing a MsgStoreAndInstantiateContract message. + -Since: 0.40 +### QueryCodesResponse +QueryCodesResponse is the response type for the Query/Codes RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | Address is the bech32 address of the new contract instance. | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - +| `code_infos` | [CodeInfoResponse](#cosmwasm.wasm.v1.CodeInfoResponse) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - -### MsgStoreAndMigrateContract -MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract -request type. + -Since: 0.42 +### QueryContractHistoryRequest +QueryContractHistoryRequest is the request type for the Query/ContractHistory +RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | -| `contract` | [string](#string) | | Contract is the address of the smart contract | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract on migration | - +| `address` | [string](#string) | | address is the address of the contract to query | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - -### MsgStoreAndMigrateContractResponse -MsgStoreAndMigrateContractResponse defines the response structure -for executing a MsgStoreAndMigrateContract message. + -Since: 0.42 +### QueryContractHistoryResponse +QueryContractHistoryResponse is the response type for the +Query/ContractHistory RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `checksum` | [bytes](#bytes) | | Checksum is the sha256 hash of the stored code | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | +| `entries` | [ContractCodeHistoryEntry](#cosmwasm.wasm.v1.ContractCodeHistoryEntry) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - + -### MsgStoreCode -MsgStoreCode submit Wasm code to the system +### QueryContractInfoRequest +QueryContractInfoRequest is the request type for the Query/ContractInfo RPC +method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the actor that signed the messages | -| `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | -| `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | +| `address` | [string](#string) | | address is the address of the contract to query | - + -### MsgStoreCodeResponse -MsgStoreCodeResponse returns store result data. +### QueryContractInfoResponse +QueryContractInfoResponse is the response type for the Query/ContractInfo RPC +method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `code_id` | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| `checksum` | [bytes](#bytes) | | Checksum is the sha256 hash of the stored code | - +| `address` | [string](#string) | | address is the address of the contract | +| `contract_info` | [ContractInfo](#cosmwasm.wasm.v1.ContractInfo) | | | - -### MsgSudoContract -MsgSudoContract is the MsgSudoContract request type. + -Since: 0.40 +### QueryContractsByCodeRequest +QueryContractsByCodeRequest is the request type for the Query/ContractsByCode +RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `contract` | [string](#string) | | Contract is the address of the smart contract | -| `msg` | [bytes](#bytes) | | Msg json encoded message to be passed to the contract as sudo | - +| `code_id` | [uint64](#uint64) | | grpc-gateway_out does not support Go style CodID | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - -### MsgSudoContractResponse -MsgSudoContractResponse defines the response structure for executing a -MsgSudoContract message. + -Since: 0.40 +### QueryContractsByCodeResponse +QueryContractsByCodeResponse is the response type for the +Query/ContractsByCode RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | - +| `contracts` | [string](#string) | repeated | contracts are a set of contract addresses | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - -### MsgUnpinCodes -MsgUnpinCodes is the MsgUnpinCodes request type. + -Since: 0.40 +### QueryContractsByCreatorRequest +QueryContractsByCreatorRequest is the request type for the +Query/ContractsByCreator RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `code_ids` | [uint64](#uint64) | repeated | CodeIDs references the WASM codes | +| `creator_address` | [string](#string) | | CreatorAddress is the address of contract creator | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | Pagination defines an optional pagination for the request. | - + -### MsgUnpinCodesResponse -MsgUnpinCodesResponse defines the response structure for executing a -MsgUnpinCodes message. +### QueryContractsByCreatorResponse +QueryContractsByCreatorResponse is the response type for the +Query/ContractsByCreator RPC method. -Since: 0.40 +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `contract_addresses` | [string](#string) | repeated | ContractAddresses result set | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | Pagination defines the pagination in the response. | - -### MsgUpdateAdmin -MsgUpdateAdmin sets a new admin for a smart contract + +### QueryParamsRequest +QueryParamsRequest is the request type for the Query/Params RPC method. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `new_admin` | [string](#string) | | NewAdmin address to be set | -| `contract` | [string](#string) | | Contract is the address of the smart contract | + - +### QueryParamsResponse +QueryParamsResponse is the response type for the Query/Params RPC method. -### MsgUpdateAdminResponse -MsgUpdateAdminResponse returns empty data +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the parameters of the module. | - -### MsgUpdateContractLabel -MsgUpdateContractLabel sets a new label for a smart contract + + +### QueryPinnedCodesRequest +QueryPinnedCodesRequest is the request type for the Query/PinnedCodes +RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `new_label` | [string](#string) | | NewLabel string to be set | -| `contract` | [string](#string) | | Contract is the address of the smart contract | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - + -### MsgUpdateContractLabelResponse -MsgUpdateContractLabelResponse returns empty data +### QueryPinnedCodesResponse +QueryPinnedCodesResponse is the response type for the +Query/PinnedCodes RPC method +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `code_ids` | [uint64](#uint64) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - -### MsgUpdateInstantiateConfig -MsgUpdateInstantiateConfig updates instantiate config for a smart contract + + + +### QueryRawContractStateRequest +QueryRawContractStateRequest is the request type for the +Query/RawContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | Sender is the that actor that signed the messages | -| `code_id` | [uint64](#uint64) | | CodeID references the stored WASM code | -| `new_instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | NewInstantiatePermission is the new access control | +| `address` | [string](#string) | | address is the address of the contract | +| `query_data` | [bytes](#bytes) | | | - + -### MsgUpdateInstantiateConfigResponse -MsgUpdateInstantiateConfigResponse returns empty data +### QueryRawContractStateResponse +QueryRawContractStateResponse is the response type for the +Query/RawContractState RPC method +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [bytes](#bytes) | | Data contains the raw store data | - -### MsgUpdateParams -MsgUpdateParams is the MsgUpdateParams request type. -Since: 0.40 + + +### QuerySmartContractStateRequest +QuerySmartContractStateRequest is the request type for the +Query/SmartContractState RPC method | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | Authority is the address of the governance account. | -| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the x/wasm parameters to update. +| `address` | [string](#string) | | address is the address of the contract | +| `query_data` | [bytes](#bytes) | | QueryData contains the query data passed to the contract | -NOTE: All parameters must be supplied. | + - +### QuerySmartContractStateResponse +QuerySmartContractStateResponse is the response type for the +Query/SmartContractState RPC method -### MsgUpdateParamsResponse -MsgUpdateParamsResponse defines the response structure for executing a -MsgUpdateParams message. -Since: 0.40 +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [bytes](#bytes) | | Data contains the json data returned from the smart contract | @@ -1940,44 +2017,25 @@ Since: 0.40 - + -### Msg -Msg defines the wasm Msg service. +### Query +Query provides defines the gRPC querier service | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `StoreCode` | [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) | [MsgStoreCodeResponse](#cosmwasm.wasm.v1.MsgStoreCodeResponse) | StoreCode to submit Wasm code to the system | | -| `InstantiateContract` | [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) | [MsgInstantiateContractResponse](#cosmwasm.wasm.v1.MsgInstantiateContractResponse) | InstantiateContract creates a new smart contract instance for the given code id. | | -| `InstantiateContract2` | [MsgInstantiateContract2](#cosmwasm.wasm.v1.MsgInstantiateContract2) | [MsgInstantiateContract2Response](#cosmwasm.wasm.v1.MsgInstantiateContract2Response) | InstantiateContract2 creates a new smart contract instance for the given code id with a predictable address | | -| `ExecuteContract` | [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) | [MsgExecuteContractResponse](#cosmwasm.wasm.v1.MsgExecuteContractResponse) | Execute submits the given message data to a smart contract | | -| `MigrateContract` | [MsgMigrateContract](#cosmwasm.wasm.v1.MsgMigrateContract) | [MsgMigrateContractResponse](#cosmwasm.wasm.v1.MsgMigrateContractResponse) | Migrate runs a code upgrade/ downgrade for a smart contract | | -| `UpdateAdmin` | [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | | -| `ClearAdmin` | [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | | -| `UpdateInstantiateConfig` | [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) | [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) | UpdateInstantiateConfig updates instantiate config for a smart contract | | -| `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper. - -Since: 0.40 | | -| `SudoContract` | [MsgSudoContract](#cosmwasm.wasm.v1.MsgSudoContract) | [MsgSudoContractResponse](#cosmwasm.wasm.v1.MsgSudoContractResponse) | SudoContract defines a governance operation for calling sudo on a contract. The authority is defined in the keeper. - -Since: 0.40 | | -| `PinCodes` | [MsgPinCodes](#cosmwasm.wasm.v1.MsgPinCodes) | [MsgPinCodesResponse](#cosmwasm.wasm.v1.MsgPinCodesResponse) | PinCodes defines a governance operation for pinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. - -Since: 0.40 | | -| `UnpinCodes` | [MsgUnpinCodes](#cosmwasm.wasm.v1.MsgUnpinCodes) | [MsgUnpinCodesResponse](#cosmwasm.wasm.v1.MsgUnpinCodesResponse) | UnpinCodes defines a governance operation for unpinning a set of code ids in the wasmvm cache. The authority is defined in the keeper. - -Since: 0.40 | | -| `StoreAndInstantiateContract` | [MsgStoreAndInstantiateContract](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContract) | [MsgStoreAndInstantiateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse) | StoreAndInstantiateContract defines a governance operation for storing and instantiating the contract. The authority is defined in the keeper. - -Since: 0.40 | | -| `RemoveCodeUploadParamsAddresses` | [MsgRemoveCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses) | [MsgRemoveCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse) | RemoveCodeUploadParamsAddresses defines a governance operation for removing addresses from code upload params. The authority is defined in the keeper. | | -| `AddCodeUploadParamsAddresses` | [MsgAddCodeUploadParamsAddresses](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses) | [MsgAddCodeUploadParamsAddressesResponse](#cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse) | AddCodeUploadParamsAddresses defines a governance operation for adding addresses to code upload params. The authority is defined in the keeper. | | -| `StoreAndMigrateContract` | [MsgStoreAndMigrateContract](#cosmwasm.wasm.v1.MsgStoreAndMigrateContract) | [MsgStoreAndMigrateContractResponse](#cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse) | StoreAndMigrateContract defines a governance operation for storing and migrating the contract. The authority is defined in the keeper. - -Since: 0.42 | | -| `UpdateContractLabel` | [MsgUpdateContractLabel](#cosmwasm.wasm.v1.MsgUpdateContractLabel) | [MsgUpdateContractLabelResponse](#cosmwasm.wasm.v1.MsgUpdateContractLabelResponse) | UpdateContractLabel sets a new label for a smart contract - -Since: 0.43 | | +| `ContractInfo` | [QueryContractInfoRequest](#cosmwasm.wasm.v1.QueryContractInfoRequest) | [QueryContractInfoResponse](#cosmwasm.wasm.v1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | GET|/cosmwasm/wasm/v1/contract/{address}| +| `ContractHistory` | [QueryContractHistoryRequest](#cosmwasm.wasm.v1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#cosmwasm.wasm.v1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | GET|/cosmwasm/wasm/v1/contract/{address}/history| +| `ContractsByCode` | [QueryContractsByCodeRequest](#cosmwasm.wasm.v1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#cosmwasm.wasm.v1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | GET|/cosmwasm/wasm/v1/code/{code_id}/contracts| +| `AllContractState` | [QueryAllContractStateRequest](#cosmwasm.wasm.v1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#cosmwasm.wasm.v1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | GET|/cosmwasm/wasm/v1/contract/{address}/state| +| `RawContractState` | [QueryRawContractStateRequest](#cosmwasm.wasm.v1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#cosmwasm.wasm.v1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | GET|/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}| +| `SmartContractState` | [QuerySmartContractStateRequest](#cosmwasm.wasm.v1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#cosmwasm.wasm.v1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | GET|/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}| +| `Code` | [QueryCodeRequest](#cosmwasm.wasm.v1.QueryCodeRequest) | [QueryCodeResponse](#cosmwasm.wasm.v1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | GET|/cosmwasm/wasm/v1/code/{code_id}| +| `Codes` | [QueryCodesRequest](#cosmwasm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#cosmwasm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/cosmwasm/wasm/v1/code| +| `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned| +| `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params| +| `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}| +| `BuildAddress` | [QueryBuildAddressRequest](#cosmwasm.wasm.v1.QueryBuildAddressRequest) | [QueryBuildAddressResponse](#cosmwasm.wasm.v1.QueryBuildAddressResponse) | BuildAddress builds a contract address | GET|/cosmwasm/wasm/v1/contract/build_address| diff --git a/go.mod b/go.mod index 2ca66f03de..806da9d5ba 100644 --- a/go.mod +++ b/go.mod @@ -1,184 +1,213 @@ module github.com/CosmWasm/wasmd -go 1.20 +go 1.21 require ( - github.com/CosmWasm/wasmvm v1.5.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.5 + github.com/CosmWasm/wasmvm/v2 v2.0.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.5 + github.com/cosmos/cosmos-sdk v0.50.6 github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/iavl v0.20.1 - github.com/cosmos/ibc-go/v7 v7.3.0 + github.com/cosmos/gogoproto v1.4.12 + github.com/cosmos/iavl v1.1.2 github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/docker/distribution v2.8.2+incompatible - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/golang/protobuf v1.5.3 + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect + github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 - github.com/gorilla/mux v1.8.0 // indirect + github.com/gorilla/mux v1.8.1 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.16.0 - github.com/rakyll/statik v0.1.7 // indirect - github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa - github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 + github.com/prometheus/client_golang v1.19.0 + github.com/spf13/cast v1.6.0 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.16.0 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d - google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect - google.golang.org/grpc v1.56.2 + google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 gopkg.in/yaml.v2 v2.4.0 ) require ( - cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.5.1 - cosmossdk.io/errors v1.0.0 - cosmossdk.io/math v1.1.2 - cosmossdk.io/tools/rosetta v0.2.1 - github.com/cometbft/cometbft v0.37.2 - github.com/cometbft/cometbft-db v0.8.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 + cosmossdk.io/api v0.7.4 + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/collections v0.4.0 + cosmossdk.io/core v0.11.0 + cosmossdk.io/errors v1.0.1 + cosmossdk.io/log v1.3.1 + cosmossdk.io/math v1.3.0 + cosmossdk.io/store v1.1.0 + cosmossdk.io/tools/confix v0.1.1 + cosmossdk.io/x/circuit v0.1.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/nft v0.1.0 + cosmossdk.io/x/tx v0.13.3 + cosmossdk.io/x/upgrade v0.1.1 + github.com/cometbft/cometbft v0.38.6 + github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/distribution/reference v0.5.0 + github.com/rs/zerolog v1.32.0 + github.com/spf13/viper v1.18.2 + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de ) require ( - cloud.google.com/go v0.110.4 // indirect - cloud.google.com/go/compute v1.20.1 // indirect + cloud.google.com/go v0.112.0 // indirect + cloud.google.com/go/compute v1.24.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.0 // indirect - cloud.google.com/go/storage v1.30.1 // indirect + cloud.google.com/go/iam v1.1.6 // indirect + cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/log v1.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/aws/aws-sdk-go v1.44.224 // 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.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // 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.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/gobwas/httphead v0.1.0 // indirect + github.com/gobwas/pool v0.2.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.1 // indirect + github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.16.3 // indirect + github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.7.16 // indirect + github.com/linxGnu/grocksdb v1.8.14 // 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.19 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/highwayhash v1.0.2 // 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/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.52.2 // indirect + github.com/prometheus/procfs v0.13.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.30.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/spf13/afero v1.9.5 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.6.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.12.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.126.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/protobuf v1.31.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/api v0.162.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect nhooyr.io/websocket v1.8.6 // indirect - pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index f75ad4ac2b..b43e5cf8f2 100644 --- a/go.sum +++ b/go.sum @@ -3,7 +3,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -16,7 +15,6 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -32,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.4 h1:1JYyxKMN9hd5dR2MYTPWkGUgcoxVVhg0LKNKEo0qvmk= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -70,8 +68,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= +cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -111,8 +109,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -170,12 +168,11 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= +cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -187,36 +184,58 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= -cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/api v0.7.4 h1:sPo8wKwCty1lht8kgL3J7YL1voJywP3YWuA5JKkBz30= +cosmossdk.io/api v0.7.4/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= -cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= +cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= +cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= +cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= +cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= +cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= +cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/CosmWasm/wasmvm v1.5.0 h1:3hKeT9SfwfLhxTGKH3vXaKFzBz1yuvP8SlfwfQXbQfw= -github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc= +github.com/CosmWasm/wasmvm/v2 v2.0.0 h1:IqNCI2G0mvs7K6ej17/I28805rVqnu+Y1cWDqIdwb08= +github.com/CosmWasm/wasmvm/v2 v2.0.0/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -224,6 +243,7 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= +github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -236,16 +256,15 @@ github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -255,11 +274,16 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -270,8 +294,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= @@ -295,25 +319,30 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= +github.com/cometbft/cometbft v0.38.6 h1:QSgpCzrGWJ2KUq1qpw+FCfASRpE27T6LQbfEHscdyOk= +github.com/cometbft/cometbft v0.38.6/go.mod h1:8rSPxzUJYquCN8uuBgbUHOMg2KAwvr7CyUw+6ukO4nw= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -322,45 +351,50 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.5 h1:n1+WjP/VM/gAEOx3TqU2/Ny734rj/MX1kpUnn7zVJP8= -github.com/cosmos/cosmos-sdk v0.47.5/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= +github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.50.6 h1:efR3MsvMHX5sxS3be+hOobGk87IzlZbSpsI2x/Vw3hk= +github.com/cosmos/cosmos-sdk v0.50.6/go.mod h1:lVkRY6cdMJ0fG3gp8y4hFrsKZqF4z7y0M2UXFb9Yt40= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= -github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.3.0 h1:QtGeVMi/3JeLWuvEuC60sBHpAF40Oenx/y+bP8+wRRw= -github.com/cosmos/ibc-go/v7 v7.3.0/go.mod h1:mUmaHFXpXrEdcxfdXyau+utZf14pGKVUiXwYftRZZfQ= +github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= +github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= +github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= +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 v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/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.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= @@ -371,20 +405,24 @@ github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkz github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -396,26 +434,33 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= -github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -424,6 +469,7 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -431,6 +477,11 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -438,16 +489,20 @@ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/j github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= +github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -463,8 +518,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -499,8 +554,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -523,8 +578,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -535,6 +591,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -546,24 +603,24 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -573,37 +630,31 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -611,13 +662,19 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= -github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= +github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -625,22 +682,25 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -649,6 +709,8 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= @@ -657,7 +719,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -687,11 +750,10 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -710,8 +772,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= -github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= +github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -719,24 +781,22 @@ github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3v github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +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.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -775,23 +835,32 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -801,6 +870,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -808,24 +878,25 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -833,34 +904,32 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= +github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= 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= @@ -870,18 +939,22 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -892,43 +965,43 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa h1:YJfZp12Z3AFhSBeXOlv4BO55RMwPn2NoQeDsrdWnBtY= -github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -936,26 +1009,28 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= -github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -969,13 +1044,13 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -988,15 +1063,33 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1005,16 +1098,12 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1026,8 +1115,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1054,7 +1143,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1096,14 +1186,12 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1116,8 +1204,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1143,8 +1231,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1159,7 +1247,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1191,6 +1280,7 @@ golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1215,13 +1305,11 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1234,6 +1322,7 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1253,17 +1342,17 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1275,12 +1364,14 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1302,6 +1393,7 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1335,7 +1427,6 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -1343,7 +1434,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1402,8 +1494,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= +google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1411,8 +1503,9 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1451,10 +1544,8 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1521,12 +1612,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1568,8 +1659,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1586,8 +1677,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1620,8 +1711,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1632,12 +1723,12 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +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/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.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/proto/buf.yaml b/proto/buf.yaml index 655c4e3124..39d957d6bd 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,7 +1,7 @@ version: v1 name: buf.build/cosmwasm/wasmd deps: - - buf.build/cosmos/cosmos-sdk:v0.47.0 + - buf.build/cosmos/cosmos-sdk:v0.50.0 - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 diff --git a/proto/cosmwasm/wasm/v1/authz.proto b/proto/cosmwasm/wasm/v1/authz.proto index 713369fb5c..eb50c768ab 100644 --- a/proto/cosmwasm/wasm/v1/authz.proto +++ b/proto/cosmwasm/wasm/v1/authz.proto @@ -63,7 +63,7 @@ message CodeGrant { // Since: wasmd 0.30 message ContractGrant { // Contract is the bech32 address of the smart contract - string contract = 1; + string contract = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Limit defines execution limits that are enforced and updated when the grant // is applied. When the limit lapsed the grant is removed. @@ -100,7 +100,8 @@ message MaxFundsLimit { repeated cosmos.base.v1beta1.Coin amounts = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -118,7 +119,8 @@ message CombinedLimit { repeated cosmos.base.v1beta1.Coin amounts = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -152,5 +154,8 @@ message AcceptedMessagesFilter { "cosmwasm.wasm.v1.ContractAuthzFilterX"; // Messages is the list of raw contract messages - repeated bytes messages = 1 [ (gogoproto.casttype) = "RawContractMessage" ]; + repeated bytes messages = 1 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } diff --git a/proto/cosmwasm/wasm/v1/genesis.proto b/proto/cosmwasm/wasm/v1/genesis.proto index 32274c48fe..45d9ff50cf 100644 --- a/proto/cosmwasm/wasm/v1/genesis.proto +++ b/proto/cosmwasm/wasm/v1/genesis.proto @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto"; import "cosmwasm/wasm/v1/types.proto"; import "cosmwasm/wasm/v1/tx.proto"; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; @@ -58,7 +59,8 @@ message Code { // Contract struct encompasses ContractAddress, ContractInfo, and ContractState message Contract { - string contract_address = 1; + string contract_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; ContractInfo contract_info = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; repeated Model contract_state = 3 diff --git a/proto/cosmwasm/wasm/v1/proposal_legacy.proto b/proto/cosmwasm/wasm/v1/proposal_legacy.proto index 8bb872e2a8..efefbeb435 100644 --- a/proto/cosmwasm/wasm/v1/proposal_legacy.proto +++ b/proto/cosmwasm/wasm/v1/proposal_legacy.proto @@ -67,12 +67,16 @@ message InstantiateContractProposal { // Label is optional metadata to be stored with a constract instance. string label = 6; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 7 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 8 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -98,12 +102,16 @@ message InstantiateContract2Proposal { // Label is optional metadata to be stored with a constract instance. string label = 6; // Msg json encode message to be passed to the contract on instantiation - bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 7 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 8 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. bytes salt = 9; @@ -132,7 +140,10 @@ message MigrateContractProposal { // CodeID references the new WASM code uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; // Msg json encoded message to be passed to the contract on migration - bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 6 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -151,7 +162,10 @@ message SudoContractProposal { // Contract is the address of the smart contract string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as sudo - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -172,12 +186,16 @@ message ExecuteContractProposal { // Contract is the address of the smart contract string contract = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as execute - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -315,12 +333,16 @@ message StoreAndInstantiateContractProposal { // Label is optional metadata to be stored with a constract instance. string label = 8; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 9 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 9 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 10 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Source is the URL where the code is hosted string source = 11; diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index d14f315924..d759133d47 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -6,6 +6,7 @@ import "cosmwasm/wasm/v1/types.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; option (gogoproto.goproto_getters_all) = false; @@ -71,13 +72,19 @@ service Query { option (google.api.http).get = "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; } + + // BuildAddress builds a contract address + rpc BuildAddress(QueryBuildAddressRequest) + returns (QueryBuildAddressResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/contract/build_address"; + } } // QueryContractInfoRequest is the request type for the Query/ContractInfo RPC // method message QueryContractInfoRequest { // address is the address of the contract to query - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryContractInfoResponse is the response type for the Query/ContractInfo RPC // method @@ -85,7 +92,7 @@ message QueryContractInfoResponse { option (gogoproto.equal) = true; // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; ContractInfo contract_info = 2 [ (gogoproto.embed) = true, (gogoproto.nullable) = false, @@ -98,7 +105,7 @@ message QueryContractInfoResponse { // RPC method message QueryContractHistoryRequest { // address is the address of the contract to query - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -124,7 +131,8 @@ message QueryContractsByCodeRequest { // Query/ContractsByCode RPC method message QueryContractsByCodeResponse { // contracts are a set of contract addresses - repeated string contracts = 1; + repeated string contracts = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -134,7 +142,7 @@ message QueryContractsByCodeResponse { // Query/AllContractState RPC method message QueryAllContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -152,7 +160,7 @@ message QueryAllContractStateResponse { // Query/RawContractState RPC method message QueryRawContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; bytes query_data = 2; } @@ -167,16 +175,22 @@ message QueryRawContractStateResponse { // Query/SmartContractState RPC method message QuerySmartContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // QueryData contains the query data passed to the contract - bytes query_data = 2 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes query_data = 2 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // QuerySmartContractStateResponse is the response type for the // Query/SmartContractState RPC method message QuerySmartContractStateResponse { // Data contains the json data returned from the smart contract - bytes data = 1 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes data = 1 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // QueryCodeRequest is the request type for the Query/Code RPC method @@ -192,7 +206,7 @@ message CodeInfoResponse { (gogoproto.customname) = "CodeID", (gogoproto.jsontag) = "id" ]; // id for legacy support - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; bytes data_hash = 3 [ (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes" ]; @@ -253,7 +267,7 @@ message QueryParamsResponse { // Query/ContractsByCreator RPC method. message QueryContractsByCreatorRequest { // CreatorAddress is the address of contract creator - string creator_address = 1; + string creator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -262,7 +276,29 @@ message QueryContractsByCreatorRequest { // Query/ContractsByCreator RPC method. message QueryContractsByCreatorResponse { // ContractAddresses result set - repeated string contract_addresses = 1; + repeated string contract_addresses = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC +// method. +message QueryBuildAddressRequest { + // CodeHash is the hash of the code + string code_hash = 1; + // CreatorAddress is the address of the contract instantiator + string creator_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Salt is a hex encoded salt + string salt = 3; + // InitArgs are optional json encoded init args to be used in contract address + // building if provided + bytes init_args = 4; +} + +// QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC +// method. +message QueryBuildAddressResponse { + // Address is the contract address + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } \ No newline at end of file diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index 393c6a6822..adbc96ad6d 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -13,6 +13,8 @@ option (gogoproto.goproto_getters_all) = false; // Msg defines the wasm Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // StoreCode to submit Wasm code to the system rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); // InstantiateContract creates a new smart contract instance for the given @@ -89,7 +91,7 @@ message MsgStoreCode { option (cosmos.msg.v1.signer) = "sender"; // Sender is the actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; // Used in v1beta1 @@ -113,27 +115,31 @@ message MsgInstantiateContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 2; + string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } // MsgInstantiateContractResponse return instantiation result data message MsgInstantiateContractResponse { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Data contains bytes to returned from the contract bytes data = 2; } @@ -145,20 +151,24 @@ message MsgInstantiateContract2 { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 2; + string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. bytes salt = 7; @@ -170,7 +180,7 @@ message MsgInstantiateContract2 { // MsgInstantiateContract2Response return instantiation result data message MsgInstantiateContract2Response { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Data contains bytes to returned from the contract bytes data = 2; } @@ -181,16 +191,20 @@ message MsgExecuteContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract - bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 3 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on execution repeated cosmos.base.v1beta1.Coin funds = 5 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -206,13 +220,16 @@ message MsgMigrateContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID references the new WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Msg json encoded message to be passed to the contract on migration - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // MsgMigrateContractResponse returns contract migration result data. @@ -228,11 +245,11 @@ message MsgUpdateAdmin { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // NewAdmin address to be set - string new_admin = 2; + string new_admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgUpdateAdminResponse returns empty data @@ -244,9 +261,9 @@ message MsgClearAdmin { option (cosmos.msg.v1.signer) = "sender"; // Sender is the actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgClearAdminResponse returns empty data @@ -258,7 +275,7 @@ message MsgUpdateInstantiateConfig { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID references the stored WASM code uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ]; // NewInstantiatePermission is the new access control @@ -302,9 +319,12 @@ message MsgSudoContract { string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as sudo - bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 3 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // MsgSudoContractResponse defines the response structure for executing a @@ -378,17 +398,21 @@ message MsgStoreAndInstantiateContract { // pinned to cache. bool unpin_code = 5; // Admin is an optional address that can execute migrations - string admin = 6; + string admin = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Label is optional metadata to be stored with a constract instance. string label = 7; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 8 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 8 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred from the authority account to the contract // on instantiation repeated cosmos.base.v1beta1.Coin funds = 9 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Source is the URL where the code is hosted string source = 10; @@ -406,7 +430,8 @@ message MsgStoreAndInstantiateContract { // Since: 0.40 message MsgStoreAndInstantiateContractResponse { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Data contains bytes to returned from the contract bytes data = 2; } @@ -460,7 +485,10 @@ message MsgStoreAndMigrateContract { // Contract is the address of the smart contract string contract = 4; // Msg json encoded message to be passed to the contract on migration - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // MsgStoreAndMigrateContractResponse defines the response structure diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto index 614e27b975..ad530854a2 100644 --- a/proto/cosmwasm/wasm/v1/types.proto +++ b/proto/cosmwasm/wasm/v1/types.proto @@ -44,7 +44,8 @@ message AccessConfig { reserved 2; // was address - repeated string addresses = 3 [ (gogoproto.moretags) = "yaml:\"addresses\"" ]; + repeated string addresses = 3 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // Params defines the set of wasm parameters. @@ -64,7 +65,7 @@ message CodeInfo { // CodeHash is the unique identifier created by wasmvm bytes code_hash = 1; // Creator address who initially stored the code - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Used in v1beta1 reserved 3, 4; // InstantiateConfig access control to apply on contract creation, optional @@ -79,9 +80,9 @@ message ContractInfo { // CodeID is the reference to the stored Wasm code uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; // Creator address who initially instantiated the contract - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 3; + string admin = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Created Tx position when the contract was instantiated. @@ -123,7 +124,10 @@ message ContractCodeHistoryEntry { uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ]; // Updated Tx position when the operation was executed. AbsoluteTxPosition updated = 3; - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // AbsoluteTxPosition is a unique transaction position that allows for global diff --git a/contrib/devtools/Makefile b/scripts/contrib/devtools/Makefile similarity index 100% rename from contrib/devtools/Makefile rename to scripts/contrib/devtools/Makefile diff --git a/contrib/devtools/README.md b/scripts/contrib/devtools/README.md similarity index 100% rename from contrib/devtools/README.md rename to scripts/contrib/devtools/README.md diff --git a/contrib/local/01-accounts.sh b/scripts/contrib/local/01-accounts.sh similarity index 92% rename from contrib/local/01-accounts.sh rename to scripts/contrib/local/01-accounts.sh index 4aecc65b73..59478dc1ad 100755 --- a/contrib/local/01-accounts.sh +++ b/scripts/contrib/local/01-accounts.sh @@ -2,7 +2,7 @@ set -o errexit -o nounset -o pipefail BASE_ACCOUNT=$(wasmd keys show validator -a --keyring-backend=test) -wasmd q account "$BASE_ACCOUNT" -o json | jq +wasmd q auth account "$BASE_ACCOUNT" -o json | jq echo "## Add new account" wasmd keys add fred --keyring-backend=test diff --git a/contrib/local/02-contracts.sh b/scripts/contrib/local/02-contracts.sh similarity index 82% rename from contrib/local/02-contracts.sh rename to scripts/contrib/local/02-contracts.sh index d3ea4bff2c..55175e0d98 100755 --- a/contrib/local/02-contracts.sh +++ b/scripts/contrib/local/02-contracts.sh @@ -5,19 +5,19 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" echo "-----------------------" echo "## Add new CosmWasm contract" -RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/hackatom.wasm" \ +RESP=$(wasmd tx wasm store "$DIR/../../../x/wasm/keeper/testdata/hackatom.wasm" \ --from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) sleep 6 RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') -CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value') +CODE_ID=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') +CODE_HASH=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value') echo "* Code id: $CODE_ID" echo "* Code checksum: $CODE_HASH" echo "* Download code" -TMPDIR=$(mktemp -t wasmdXXXXXX) -wasmd q wasm code "$CODE_ID" "$TMPDIR" -rm -f "$TMPDIR" +TMPDIR=$(mktemp -d -t wasmdXXXXXX) +wasmd q wasm code "$CODE_ID" "$TMPDIR/delme.wasm" +rm -f "$TMPDIR/delme.wasm" echo "-----------------------" echo "## List code" wasmd query wasm list-code --node=http://localhost:26657 -o json | jq @@ -44,8 +44,8 @@ sleep 6 wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq -predictedAdress=$(wasmd q wasm build-address "$CODE_HASH" $(wasmd keys show validator -a --keyring-backend=test) $(echo -n "testing" | xxd -ps) "$INIT") -wasmd q wasm contract "$predictedAdress" -o json | jq +predictedAddress=$(wasmd q wasm build-address "$CODE_HASH" $(wasmd keys show validator -a --keyring-backend=test) $(echo -n "testing" | xxd -ps) "$INIT" | awk '{print $2}') +wasmd q wasm contract "$predictedAddress" -o json | jq echo "### Query all" RESP=$(wasmd query wasm contract-state all "$CONTRACT" -o json) @@ -80,11 +80,12 @@ echo "### Query new admin: $(wasmd q wasm contract "$CONTRACT" -o json | jq -r ' echo "-----------------------" echo "## Migrate contract" echo "### Upload new code" -RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/burner.wasm" \ - --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) +RESP=$(wasmd tx wasm store "$DIR/../../../x/wasm/keeper/testdata/burner.wasm" \ + --from validator --gas 1100000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) sleep 6 RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') +BURNER_CODE_ID=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') + echo "### Migrate to code id: $BURNER_CODE_ID" DEST_ACCOUNT=$(wasmd keys show fred -a --keyring-backend=test) diff --git a/contrib/local/03-grpc-queries.sh b/scripts/contrib/local/03-grpc-queries.sh similarity index 100% rename from contrib/local/03-grpc-queries.sh rename to scripts/contrib/local/03-grpc-queries.sh diff --git a/contrib/local/04-gov.sh b/scripts/contrib/local/04-gov.sh similarity index 92% rename from contrib/local/04-gov.sh rename to scripts/contrib/local/04-gov.sh index 5c9325c0f0..81b4b88ebd 100755 --- a/contrib/local/04-gov.sh +++ b/scripts/contrib/local/04-gov.sh @@ -5,7 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" sleep 1 echo "## Submit a CosmWasm gov proposal" -RESP=$(wasmd tx wasm submit-proposal store-instantiate "$DIR/../../x/wasm/keeper/testdata/reflect.wasm" \ +RESP=$(wasmd tx wasm submit-proposal store-instantiate "$DIR/../../../x/wasm/keeper/testdata/reflect_2_0.wasm" \ '{}' --label="testing" \ --title "testing" --summary "Testing" --deposit "1000000000ustake" \ --admin $(wasmd keys show -a validator --keyring-backend=test) \ diff --git a/contrib/local/README.md b/scripts/contrib/local/README.md similarity index 76% rename from contrib/local/README.md rename to scripts/contrib/local/README.md index 234e442f46..6f0ea24303 100644 --- a/contrib/local/README.md +++ b/scripts/contrib/local/README.md @@ -6,7 +6,7 @@ For manual testing. Works on my box(*) ... ``` make install -cd contrib/local +cd scripts/contrib/local rm -rf /tmp/trash HOME=/tmp/trash bash setup_wasmd.sh HOME=/tmp/trash bash start_node.sh @@ -15,9 +15,9 @@ HOME=/tmp/trash bash start_node.sh Next shell: ``` -cd contrib/local -./01-accounts.sh -./02-contracts.sh +cd scripts/contrib/local +HOME=/tmp/trash bash 01-accounts.sh +HOME=/tmp/trash bash 02-contracts.sh ``` ## Shell script development diff --git a/contrib/local/setup_wasmd.sh b/scripts/contrib/local/setup_wasmd.sh similarity index 100% rename from contrib/local/setup_wasmd.sh rename to scripts/contrib/local/setup_wasmd.sh diff --git a/contrib/local/start_node.sh b/scripts/contrib/local/start_node.sh similarity index 100% rename from contrib/local/start_node.sh rename to scripts/contrib/local/start_node.sh diff --git a/contrib/prometheus/README.md b/scripts/contrib/prometheus/README.md similarity index 89% rename from contrib/prometheus/README.md rename to scripts/contrib/prometheus/README.md index 398973c617..acbf2de7d8 100644 --- a/contrib/prometheus/README.md +++ b/scripts/contrib/prometheus/README.md @@ -38,7 +38,7 @@ Note the `format` parameter in the request for the endpoint: ## Run Prometheus ```sh # port 9090 is used by wasmd already -docker run -it -v $(pwd)/contrib/prometheus:/prometheus -p9091:9090 prom/prometheus --config.file=/prometheus/prometheus.yaml +docker run -it -v $(pwd)/scripts/contrib/prometheus:/prometheus -p9091:9090 prom/prometheus --config.file=/prometheus/prometheus.yaml ``` * Open [console](http://localhost:9091) and find `wasm_`service metrics diff --git a/contrib/prometheus/prometheus.yaml b/scripts/contrib/prometheus/prometheus.yaml similarity index 100% rename from contrib/prometheus/prometheus.yaml rename to scripts/contrib/prometheus/prometheus.yaml diff --git a/contrib/prototools-docker/Dockerfile b/scripts/contrib/prototools-docker/Dockerfile similarity index 100% rename from contrib/prototools-docker/Dockerfile rename to scripts/contrib/prototools-docker/Dockerfile diff --git a/contrib/prototools-docker/README.md b/scripts/contrib/prototools-docker/README.md similarity index 87% rename from contrib/prototools-docker/README.md rename to scripts/contrib/prototools-docker/README.md index 600c7024b8..3c8ef4b7a7 100644 --- a/contrib/prototools-docker/README.md +++ b/scripts/contrib/prototools-docker/README.md @@ -13,7 +13,7 @@ Installs generators and tools from: ### Build ```shell script -docker build -t cosmwasm/prototools-docker -f ./contrib/prototools-docker/Dockerfile . +docker build -t cosmwasm/prototools-docker -f ./scripts/contrib/prototools-docker/Dockerfile . ``` ```shell script diff --git a/contrib/relayer-tests/.gitignore b/scripts/contrib/relayer-tests/.gitignore similarity index 100% rename from contrib/relayer-tests/.gitignore rename to scripts/contrib/relayer-tests/.gitignore diff --git a/contrib/relayer-tests/README.md b/scripts/contrib/relayer-tests/README.md similarity index 84% rename from contrib/relayer-tests/README.md rename to scripts/contrib/relayer-tests/README.md index 199b00a493..38fef2668b 100644 --- a/contrib/relayer-tests/README.md +++ b/scripts/contrib/relayer-tests/README.md @@ -1,7 +1,7 @@ # Relayer tests These scripts helps to test go-relayer with two local wasmd chains. \ -Make sure you run below scripts under `wasmd/contrib/relayer-tests` directory. +Make sure you run below scripts under `wasmd/scripts/contrib/relayer-tests` directory. - `./init_two_chainz_relayer.sh` will spin two chains and runs - `./one_chain.sh` will spin a single chain. This script used by the one above diff --git a/contrib/relayer-tests/configs/wasmd/chains/ibc-0.json b/scripts/contrib/relayer-tests/configs/wasmd/chains/ibc-0.json similarity index 100% rename from contrib/relayer-tests/configs/wasmd/chains/ibc-0.json rename to scripts/contrib/relayer-tests/configs/wasmd/chains/ibc-0.json diff --git a/contrib/relayer-tests/configs/wasmd/chains/ibc-1.json b/scripts/contrib/relayer-tests/configs/wasmd/chains/ibc-1.json similarity index 100% rename from contrib/relayer-tests/configs/wasmd/chains/ibc-1.json rename to scripts/contrib/relayer-tests/configs/wasmd/chains/ibc-1.json diff --git a/contrib/relayer-tests/configs/wasmd/paths/demo.json b/scripts/contrib/relayer-tests/configs/wasmd/paths/demo.json similarity index 100% rename from contrib/relayer-tests/configs/wasmd/paths/demo.json rename to scripts/contrib/relayer-tests/configs/wasmd/paths/demo.json diff --git a/contrib/relayer-tests/init_two_chainz_relayer.sh b/scripts/contrib/relayer-tests/init_two_chainz_relayer.sh similarity index 100% rename from contrib/relayer-tests/init_two_chainz_relayer.sh rename to scripts/contrib/relayer-tests/init_two_chainz_relayer.sh diff --git a/contrib/relayer-tests/one_chain.sh b/scripts/contrib/relayer-tests/one_chain.sh similarity index 100% rename from contrib/relayer-tests/one_chain.sh rename to scripts/contrib/relayer-tests/one_chain.sh diff --git a/contrib/relayer-tests/test_ibc_transfer.sh b/scripts/contrib/relayer-tests/test_ibc_transfer.sh similarity index 100% rename from contrib/relayer-tests/test_ibc_transfer.sh rename to scripts/contrib/relayer-tests/test_ibc_transfer.sh diff --git a/tests/e2e/gov_test.go b/tests/e2e/gov_test.go index 33b7fd34a4..a0abd64edf 100644 --- a/tests/e2e/gov_test.go +++ b/tests/e2e/gov_test.go @@ -4,10 +4,12 @@ import ( "testing" "time" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -27,7 +29,7 @@ func TestGovVoteByContract(t *testing.T) { coord := ibctesting.NewCoordinator(t, 1) chain := coord.GetChain(ibctesting.GetChainID(1)) contractAddr := e2e.InstantiateReflectContract(t, chain) - chain.Fund(contractAddr, sdk.NewIntFromUint64(1_000_000_000)) + chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000)) // a contract with a high delegation amount delegateMsg := wasmvmtypes.CosmosMsg{ Staking: &wasmvmtypes.StakingMsg{ @@ -48,7 +50,9 @@ func TestGovVoteByContract(t *testing.T) { communityPoolBalance := chain.Balance(accountKeeper.GetModuleAccount(chain.GetContext(), distributiontypes.ModuleName).GetAddress(), sdk.DefaultBondDenom) require.False(t, communityPoolBalance.IsZero()) - initialDeposit := govKeeper.GetParams(chain.GetContext()).MinDeposit + gParams, err := govKeeper.Params.Get(chain.GetContext()) + require.NoError(t, err) + initialDeposit := gParams.MinDeposit govAcctAddr := govKeeper.GetGovernanceAccount(chain.GetContext()).GetAddress() specs := map[string]struct { @@ -57,25 +61,25 @@ func TestGovVoteByContract(t *testing.T) { }{ "yes": { vote: &wasmvmtypes.VoteMsg{ - Vote: wasmvmtypes.Yes, + Option: wasmvmtypes.Yes, }, expPass: true, }, "no": { vote: &wasmvmtypes.VoteMsg{ - Vote: wasmvmtypes.No, + Option: wasmvmtypes.No, }, expPass: false, }, "abstain": { vote: &wasmvmtypes.VoteMsg{ - Vote: wasmvmtypes.Abstain, + Option: wasmvmtypes.Abstain, }, expPass: true, }, "no with veto": { vote: &wasmvmtypes.VoteMsg{ - Vote: wasmvmtypes.NoWithVeto, + Option: wasmvmtypes.NoWithVeto, }, expPass: false, }, @@ -88,7 +92,7 @@ func TestGovVoteByContract(t *testing.T) { payloadMsg := &distributiontypes.MsgCommunityPoolSpend{ Authority: govAcctAddr.String(), Recipient: recipientAddr.String(), - Amount: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), + Amount: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), } msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{payloadMsg}, @@ -97,13 +101,14 @@ func TestGovVoteByContract(t *testing.T) { "", "my proposal", "testing", + false, ) require.NoError(t, err) rsp, gotErr := chain.SendMsgs(msg) require.NoError(t, gotErr) - require.Len(t, rsp.MsgResponses, 1) - got, ok := rsp.MsgResponses[0].GetCachedValue().(*v1.MsgSubmitProposalResponse) - require.True(t, ok) + var got v1.MsgSubmitProposalResponse + chain.UnwrapExecTXResult(rsp, &got) + propID := got.ProposalId // with other delegators voted yes @@ -120,8 +125,8 @@ func TestGovVoteByContract(t *testing.T) { e2e.MustExecViaReflectContract(t, chain, contractAddr, voteMsg) // then proposal executed after voting period - proposal, ok := govKeeper.GetProposal(chain.GetContext(), propID) - require.True(t, ok) + proposal, err := govKeeper.Proposals.Get(chain.GetContext(), propID) + require.NoError(t, err) coord.IncrementTimeBy(proposal.VotingEndTime.Sub(chain.GetContext().BlockTime()) + time.Minute) coord.CommitBlock(chain) @@ -131,7 +136,7 @@ func TestGovVoteByContract(t *testing.T) { assert.True(t, recipientBalance.IsZero()) return } - expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()) + expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()) assert.Equal(t, expBalanceAmount.String(), recipientBalance.String()) }) } diff --git a/tests/e2e/grants_test.go b/tests/e2e/grants_test.go index f7102d4133..203e23f0d3 100644 --- a/tests/e2e/grants_test.go +++ b/tests/e2e/grants_test.go @@ -6,11 +6,12 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -43,11 +44,11 @@ func TestGrants(t *testing.T) { otherPrivKey := secp256k1.GenPrivKey() otherAddr := sdk.AccAddress(otherPrivKey.PubKey().Address().Bytes()) - chain.Fund(granteeAddr, sdk.NewInt(1_000_000)) - chain.Fund(otherAddr, sdk.NewInt(1_000_000)) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + chain.Fund(granteeAddr, sdkmath.NewInt(1_000_000)) + chain.Fund(otherAddr, sdkmath.NewInt(1_000_000)) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) - myAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2_000_000)) + myAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2_000_000)) specs := map[string]struct { limit types.ContractAuthzLimitX @@ -65,14 +66,14 @@ func TestGrants(t *testing.T) { "exceed limits": { limit: types.NewMaxFundsLimit(myAmount), filter: types.NewAllowAllMessagesFilter(), - transferAmount: myAmount.Add(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), + transferAmount: myAmount.Add(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), senderKey: granteePrivKey, expErr: sdkerrors.ErrUnauthorized, }, "not match filter": { limit: types.NewMaxFundsLimit(myAmount), filter: types.NewAcceptedMessageKeysFilter("foo"), - transferAmount: sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()), + transferAmount: sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()), senderKey: granteePrivKey, expErr: sdkerrors.ErrUnauthorized, }, @@ -110,13 +111,13 @@ func TestGrants(t *testing.T) { // then if spec.expErr != nil { - require.True(t, spec.expErr.Is(gotErr)) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + require.ErrorContains(t, gotErr, fmt.Sprintf("%s/%d:", spec.expErr.Codespace(), spec.expErr.ABCICode())) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) assert.Equal(t, granterStartBalance, chain.Balance(granterAddr, sdk.DefaultBondDenom).Amount) return } require.NoError(t, gotErr) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) assert.Equal(t, granterStartBalance.Sub(spec.transferAmount.Amount), chain.Balance(granterAddr, sdk.DefaultBondDenom).Amount) }) } @@ -138,9 +139,9 @@ func TestStoreCodeGrant(t *testing.T) { otherPrivKey := secp256k1.GenPrivKey() otherAddr := sdk.AccAddress(otherPrivKey.PubKey().Address().Bytes()) - chain.Fund(granteeAddr, sdk.NewInt(1_000_000)) - chain.Fund(otherAddr, sdk.NewInt(1_000_000)) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + chain.Fund(granteeAddr, sdkmath.NewInt(1_000_000)) + chain.Fund(otherAddr, sdkmath.NewInt(1_000_000)) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) specs := map[string]struct { codeHash []byte @@ -180,7 +181,7 @@ func TestStoreCodeGrant(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // setup grant - grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) + grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) //nolint:gosec require.NoError(t, err) authorization := types.NewStoreCodeAuthorization(*grant) expiry := time.Now().Add(time.Hour) @@ -199,7 +200,7 @@ func TestStoreCodeGrant(t *testing.T) { // then if spec.expErr != nil { - require.True(t, spec.expErr.Is(gotErr)) + assert.ErrorContains(t, gotErr, fmt.Sprintf("%s/%d:", spec.expErr.Codespace(), spec.expErr.ABCICode())) return } require.NoError(t, gotErr) @@ -226,9 +227,9 @@ func TestGzipStoreCodeGrant(t *testing.T) { otherPrivKey := secp256k1.GenPrivKey() otherAddr := sdk.AccAddress(otherPrivKey.PubKey().Address().Bytes()) - chain.Fund(granteeAddr, sdk.NewInt(1_000_000)) - chain.Fund(otherAddr, sdk.NewInt(1_000_000)) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + chain.Fund(granteeAddr, sdkmath.NewInt(1_000_000)) + chain.Fund(otherAddr, sdkmath.NewInt(1_000_000)) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) specs := map[string]struct { codeHash []byte @@ -268,7 +269,7 @@ func TestGzipStoreCodeGrant(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // setup grant - grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) + grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) //nolint:gosec require.NoError(t, err) authorization := types.NewStoreCodeAuthorization(*grant) expiry := time.Now().Add(time.Hour) @@ -287,7 +288,7 @@ func TestGzipStoreCodeGrant(t *testing.T) { // then if spec.expErr != nil { - require.True(t, spec.expErr.Is(gotErr)) + assert.ErrorContains(t, gotErr, fmt.Sprintf("%s/%d:", spec.expErr.Codespace(), spec.expErr.ABCICode())) return } require.NoError(t, gotErr) @@ -308,9 +309,9 @@ func TestBrokenGzipStoreCodeGrant(t *testing.T) { otherPrivKey := secp256k1.GenPrivKey() otherAddr := sdk.AccAddress(otherPrivKey.PubKey().Address().Bytes()) - chain.Fund(granteeAddr, sdk.NewInt(1_000_000)) - chain.Fund(otherAddr, sdk.NewInt(1_000_000)) - assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) + chain.Fund(granteeAddr, sdkmath.NewInt(1_000_000)) + chain.Fund(otherAddr, sdkmath.NewInt(1_000_000)) + assert.Equal(t, sdkmath.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount) codeHash := []byte("*") instantiatePermission := types.AllowEverybody diff --git a/tests/e2e/group_test.go b/tests/e2e/group_test.go index 8708c12639..49ab9638bb 100644 --- a/tests/e2e/group_test.go +++ b/tests/e2e/group_test.go @@ -8,6 +8,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -25,8 +27,8 @@ func TestGroupWithContract(t *testing.T) { coord := ibctesting.NewCoordinator(t, 1) chain := coord.GetChain(ibctesting.GetChainID(1)) - contractAddr := e2e.InstantiateReflectContract(t, chain) - chain.Fund(contractAddr, sdk.NewIntFromUint64(1_000_000_000)) + contractAddr := e2e.InstantiateStargateReflectContract(t, chain) + chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000)) members := []group.MemberRequest{ { @@ -47,25 +49,82 @@ func TestGroupWithContract(t *testing.T) { rsp, err := chain.SendMsgs(msg) require.NoError(t, err) - createRsp := rsp.MsgResponses[0].GetCachedValue().(*group.MsgCreateGroupWithPolicyResponse) + var createRsp group.MsgCreateGroupWithPolicyResponse + chain.UnwrapExecTXResult(rsp, &createRsp) groupID, policyAddr := createRsp.GroupId, sdk.MustAccAddressFromBech32(createRsp.GroupPolicyAddress) require.NotEmpty(t, groupID) - chain.Fund(policyAddr, sdk.NewIntFromUint64(1_000_000_000)) + chain.Fund(policyAddr, sdkmath.NewIntFromUint64(1_000_000_000)) // and a proposal submitted recipientAddr := sdk.AccAddress(rand.Bytes(address.Len)) - payload := []sdk.Msg{banktypes.NewMsgSend(policyAddr, recipientAddr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())))} + payload := []sdk.Msg{banktypes.NewMsgSend(policyAddr, recipientAddr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())))} propMsg, err := group.NewMsgSubmitProposal(policyAddr.String(), []string{contractAddr.String()}, payload, "my proposal", group.Exec_EXEC_TRY, "my title", "my description") require.NoError(t, err) rsp = e2e.MustExecViaStargateReflectContract(t, chain, contractAddr, propMsg) - bz := rsp.MsgResponses[0].GetCachedValue().(*types.MsgExecuteContractResponse).Data + var execRsp types.MsgExecuteContractResponse + chain.UnwrapExecTXResult(rsp, &execRsp) + var groupRsp group.MsgSubmitProposalResponse - require.NoError(t, chain.Codec.Unmarshal(bz, &groupRsp)) + require.NoError(t, chain.Codec.Unmarshal(execRsp.Data, &groupRsp)) // require.NotEmpty(t, groupRsp.ProposalId) // and coins received recipientBalance := chain.Balance(recipientAddr, sdk.DefaultBondDenom) - expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()) + expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()) + assert.Equal(t, expBalanceAmount.String(), recipientBalance.String()) +} + +func TestGroupWithNewReflectContract(t *testing.T) { + // Given a group with a contract as only member + // When contract submits a proposal with try_execute + // Then the payload msg is executed + + coord := ibctesting.NewCoordinator(t, 1) + chain := coord.GetChain(ibctesting.GetChainID(1)) + contractAddr := e2e.InstantiateReflectContract(t, chain) + chain.Fund(contractAddr, sdkmath.NewIntFromUint64(1_000_000_000)) + + members := []group.MemberRequest{ + { + Address: contractAddr.String(), + Weight: "1", + Metadata: "my contract", + }, + } + msg, err := group.NewMsgCreateGroupWithPolicy( + chain.SenderAccount.GetAddress().String(), + members, + "my group", + "my metadata", + false, + group.NewPercentageDecisionPolicy("1", time.Second, 0), + ) + require.NoError(t, err) + rsp, err := chain.SendMsgs(msg) + require.NoError(t, err) + + var createRsp group.MsgCreateGroupWithPolicyResponse + chain.UnwrapExecTXResult(rsp, &createRsp) + groupID, policyAddr := createRsp.GroupId, sdk.MustAccAddressFromBech32(createRsp.GroupPolicyAddress) + require.NotEmpty(t, groupID) + chain.Fund(policyAddr, sdkmath.NewIntFromUint64(1_000_000_000)) + // and a proposal submitted + recipientAddr := sdk.AccAddress(rand.Bytes(address.Len)) + + payload := []sdk.Msg{banktypes.NewMsgSend(policyAddr, recipientAddr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())))} + propMsg, err := group.NewMsgSubmitProposal(policyAddr.String(), []string{contractAddr.String()}, payload, "my proposal", group.Exec_EXEC_TRY, "my title", "my description") + require.NoError(t, err) + + rsp = e2e.MustExecViaAnyReflectContract(t, chain, contractAddr, propMsg) + var execRsp types.MsgExecuteContractResponse + chain.UnwrapExecTXResult(rsp, &execRsp) + + var groupRsp group.MsgSubmitProposalResponse + require.NoError(t, chain.Codec.Unmarshal(execRsp.Data, &groupRsp)) + + // and coins received + recipientBalance := chain.Balance(recipientAddr, sdk.DefaultBondDenom) + expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()) assert.Equal(t, expBalanceAmount.String(), recipientBalance.String()) } diff --git a/tests/e2e/ibc_fees_test.go b/tests/e2e/ibc_fees_test.go index ea6c72fe69..5c29bec5ca 100644 --- a/tests/e2e/ibc_fees_test.go +++ b/tests/e2e/ibc_fees_test.go @@ -7,14 +7,16 @@ import ( "testing" "time" - ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" @@ -29,7 +31,7 @@ func TestIBCFeesTransfer(t *testing.T) { // with an ics-20 channel established // when an ics-29 fee is attached to an ibc package // then the relayer's payee is receiving the fee(s) on success - codec := app.MakeEncodingConfig().Codec + marshaler := app.MakeEncodingConfig(t).Codec coord := wasmibctesting.NewCoordinator(t, 2) chainA := coord.GetChain(wasmibctesting.GetChainID(1)) chainB := coord.GetChain(wasmibctesting.GetChainID(2)) @@ -38,17 +40,17 @@ func TestIBCFeesTransfer(t *testing.T) { actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address()) receiver := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) payee := sdk.AccAddress(bytes.Repeat([]byte{2}, address.Len)) - oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1))) + oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(codec.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(codec.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), Order: channeltypes.UNORDERED, } // with an ics-20 transfer channel setup between both chains @@ -62,7 +64,7 @@ func TestIBCFeesTransfer(t *testing.T) { require.NoError(t, err) // when a transfer package is sent - transferCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1)) + transferCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1)) ibcPayloadMsg := ibctransfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, transferCoin, actorChainA.String(), receiver.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()), "testing") ibcPackageFee := ibcfee.NewFee(oneToken, oneToken, sdk.Coins{}) feeMsg := ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), nil) @@ -105,7 +107,7 @@ func TestIBCFeesTransfer(t *testing.T) { gotBalance = chainA.Balance(receiver, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String()) payeeBalance = chainB.AllBalances(payee) - assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2)).String(), payeeBalance.String()) + assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2)).String(), payeeBalance.String()) } func TestIBCFeesWasm(t *testing.T) { @@ -114,7 +116,7 @@ func TestIBCFeesWasm(t *testing.T) { // and an ibc channel established // when an ics-29 fee is attached to an ibc package // then the relayer's payee is receiving the fee(s) on success - codec := app.MakeEncodingConfig().Codec + marshaler := app.MakeEncodingConfig(t).Codec coord := wasmibctesting.NewCoordinator(t, 2) chainA := coord.GetChain(wasmibctesting.GetChainID(1)) chainB := coord.GetChain(ibctesting.GetChainID(2)) @@ -133,17 +135,17 @@ func TestIBCFeesWasm(t *testing.T) { ibcContractPortID := chainA.ContractInfo(ibcContractAddr).IBCPortID payee := sdk.AccAddress(bytes.Repeat([]byte{2}, address.Len)) - oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1))) + oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibcContractPortID, - Version: string(codec.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(codec.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), Order: channeltypes.UNORDERED, } // with an ics-29 fee enabled channel setup between both chains @@ -182,11 +184,11 @@ func TestIBCFeesWasm(t *testing.T) { require.NoError(t, err) assert.JSONEq(t, `{"balance":"99999900"}`, string(gotCW20Balance)) payeeBalance := chainA.AllBalances(payee) - assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2)).String(), payeeBalance.String()) + assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2)).String(), payeeBalance.String()) // and on chain B pendingIncentivisedPackages = appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibcContractPortID, path.EndpointA.ChannelID) assert.Len(t, pendingIncentivisedPackages, 0) - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, "cw20:"+cw20ContractAddr.String(), sdk.NewInt(100)) + expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, "cw20:"+cw20ContractAddr.String(), sdkmath.NewInt(100)) gotBalance := chainB.Balance(actorChainB, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String(), chainB.AllBalances(actorChainB)) @@ -215,5 +217,5 @@ func TestIBCFeesWasm(t *testing.T) { assert.JSONEq(t, `{"balance":"100000000"}`, string(gotCW20Balance)) // and on chain B payeeBalance = chainB.AllBalances(payee) - assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2)).String(), payeeBalance.String()) + assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2)).String(), payeeBalance.String()) } diff --git a/tests/e2e/ica_test.go b/tests/e2e/ica_test.go index d72617b2ff..489da9a4ed 100644 --- a/tests/e2e/ica_test.go +++ b/tests/e2e/ica_test.go @@ -1,19 +1,23 @@ package e2e import ( - "bytes" "testing" "time" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/rand" "github.com/cosmos/gogoproto/proto" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - hosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + hosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -40,62 +44,89 @@ func TestICA(t *testing.T) { path := wasmibctesting.NewPath(controllerChain, hostChain) coord.SetupConnections(path) - ownerAddr := sdk.AccAddress(controllerChain.SenderPrivKey.PubKey().Address()) - msg := icacontrollertypes.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, ownerAddr.String(), "") - res, err := controllerChain.SendMsgs(msg) - require.NoError(t, err) - chanID, portID, version := parseIBCChannelEvents(t, res) - - // next open channels on both sides - path.EndpointA.ChannelID = chanID - path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: portID, - Version: version, - Order: channeltypes.ORDERED, - } - path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: icatypes.HostPortID, - Version: icatypes.Version, - Order: channeltypes.ORDERED, - } - coord.CreateChannels(path) - - // assert ICA exists on controller - contApp := controllerChain.App.(*app.WasmApp) - icaRsp, err := contApp.ICAControllerKeeper.InterchainAccount(sdk.WrapSDKContext(controllerChain.GetContext()), &icacontrollertypes.QueryInterchainAccountRequest{ - Owner: ownerAddr.String(), - ConnectionId: path.EndpointA.ConnectionID, - }) - require.NoError(t, err) - icaAddr := sdk.MustAccAddressFromBech32(icaRsp.GetAddress()) - hostChain.Fund(icaAddr, sdk.NewInt(1_000)) - - // submit a tx - targetAddr := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) - sendCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) - payloadMsg := banktypes.NewMsgSend(icaAddr, targetAddr, sdk.NewCoins(sendCoin)) - rawPayloadData, err := icatypes.SerializeCosmosTx(controllerChain.Codec, []proto.Message{payloadMsg}) - require.NoError(t, err) - payloadPacket := icatypes.InterchainAccountPacketData{ - Type: icatypes.EXECUTE_TX, - Data: rawPayloadData, - Memo: "testing", + specs := map[string]struct { + icaVersion string + encoding string + }{ + "proto": { + icaVersion: "", // empty string defaults to the proto3 encoding type + encoding: icatypes.EncodingProtobuf, + }, + "json": { + icaVersion: string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{ + Version: icatypes.Version, + ControllerConnectionId: path.EndpointA.ConnectionID, + HostConnectionId: path.EndpointB.ConnectionID, + Encoding: icatypes.EncodingProto3JSON, // use proto3json + TxType: icatypes.TxTypeSDKMultiMsg, + })), + encoding: icatypes.EncodingProto3JSON, + }, } - relativeTimeout := uint64(time.Minute.Nanoseconds()) // note this is in nanoseconds - msgSendTx := icacontrollertypes.NewMsgSendTx(ownerAddr.String(), path.EndpointA.ConnectionID, relativeTimeout, payloadPacket) - _, err = controllerChain.SendMsgs(msgSendTx) - require.NoError(t, err) + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + icaControllerKey := secp256k1.GenPrivKey() + icaControllerAddr := sdk.AccAddress(icaControllerKey.PubKey().Address().Bytes()) + controllerChain.Fund(icaControllerAddr, sdkmath.NewInt(1_000)) + + msg := icacontrollertypes.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, icaControllerAddr.String(), spec.icaVersion) + res, err := controllerChain.SendNonDefaultSenderMsgs(icaControllerKey, msg) + require.NoError(t, err) + chanID, portID, version := parseIBCChannelEvents(t, res) + + // next open channels on both sides + path.EndpointA.ChannelID = chanID + path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ + PortID: portID, + Version: version, + Order: channeltypes.ORDERED, + } + path.EndpointB.ChannelID = "" + path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ + PortID: icatypes.HostPortID, + Version: icatypes.Version, + Order: channeltypes.ORDERED, + } + coord.CreateChannels(path) - assert.Equal(t, 1, len(controllerChain.PendingSendPackets)) - require.NoError(t, coord.RelayAndAckPendingPackets(path)) + // assert ICA exists on controller + contApp := controllerChain.App.(*app.WasmApp) + icaRsp, err := contApp.ICAControllerKeeper.InterchainAccount(controllerChain.GetContext(), &icacontrollertypes.QueryInterchainAccountRequest{ + Owner: icaControllerAddr.String(), + ConnectionId: path.EndpointA.ConnectionID, + }) + require.NoError(t, err) + icaAddr := sdk.MustAccAddressFromBech32(icaRsp.GetAddress()) + hostChain.Fund(icaAddr, sdkmath.NewInt(1_000)) - gotBalance := hostChain.Balance(targetAddr, sdk.DefaultBondDenom) - assert.Equal(t, sendCoin.String(), gotBalance.String()) + // submit a tx + targetAddr := sdk.AccAddress(rand.Bytes(address.Len)) + sendCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) + payloadMsg := banktypes.NewMsgSend(icaAddr, targetAddr, sdk.NewCoins(sendCoin)) + rawPayloadData, err := icatypes.SerializeCosmosTx(controllerChain.Codec, []proto.Message{payloadMsg}, spec.encoding) + require.NoError(t, err) + payloadPacket := icatypes.InterchainAccountPacketData{ + Type: icatypes.EXECUTE_TX, + Data: rawPayloadData, + Memo: "testing", + } + relativeTimeout := uint64(time.Minute.Nanoseconds()) // note this is in nanoseconds + msgSendTx := icacontrollertypes.NewMsgSendTx(icaControllerAddr.String(), path.EndpointA.ConnectionID, relativeTimeout, payloadPacket) + _, err = controllerChain.SendNonDefaultSenderMsgs(icaControllerKey, msgSendTx) + require.NoError(t, err) + + assert.Equal(t, 1, len(controllerChain.PendingSendPackets)) + require.NoError(t, coord.RelayAndAckPendingPackets(path)) + + gotBalance := hostChain.Balance(targetAddr, sdk.DefaultBondDenom) + assert.Equal(t, sendCoin.String(), gotBalance.String()) + }) + } } -func parseIBCChannelEvents(t *testing.T, res *sdk.Result) (string, string, string) { +func parseIBCChannelEvents(t *testing.T, res *abci.ExecTxResult) (string, string, string) { t.Helper() - chanID, err := ibctesting.ParseChannelIDFromEvents(res.GetEvents()) + chanID, err := wasmibctesting.ParseChannelIDFromEvents(res.GetEvents()) require.NoError(t, err) portID, err := wasmibctesting.ParsePortIDFromEvents(res.GetEvents()) require.NoError(t, err) diff --git a/tests/e2e/reflect_helper.go b/tests/e2e/reflect_helper.go index 26cb2798cd..f857c8dad0 100644 --- a/tests/e2e/reflect_helper.go +++ b/tests/e2e/reflect_helper.go @@ -1,13 +1,16 @@ package e2e import ( + "encoding/base64" "encoding/json" + "fmt" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/ibctesting" @@ -15,36 +18,65 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) -// InstantiateReflectContract store and instantiate a reflect contract instance +// InstantiateStargateReflectContract stores and instantiates the reflect contract shipped with CosmWasm 1.5.3. +// This instance still expects the old CosmosMsg.Stargate variant instead of the new CosmosMsg.Any. +func InstantiateStargateReflectContract(t *testing.T, chain *ibctesting.TestChain) sdk.AccAddress { + codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_5.wasm").CodeID + contractAddr := chain.InstantiateContract(codeID, []byte(`{}`)) + require.NotEmpty(t, contractAddr) + return contractAddr +} + +// InstantiateReflectContract stores and instantiates a 2.0 reflect contract instance. func InstantiateReflectContract(t *testing.T, chain *ibctesting.TestChain) sdk.AccAddress { - t.Helper() - codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_1.wasm").CodeID + codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_2_0.wasm").CodeID contractAddr := chain.InstantiateContract(codeID, []byte(`{}`)) require.NotEmpty(t, contractAddr) return contractAddr } // MustExecViaReflectContract submit execute message to send payload to reflect contract -func MustExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...wasmvmtypes.CosmosMsg) *sdk.Result { - t.Helper() +func MustExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...wasmvmtypes.CosmosMsg) *abci.ExecTxResult { rsp, err := ExecViaReflectContract(t, chain, contractAddr, msgs) require.NoError(t, err) return rsp } type sdkMessageType interface { - codec.ProtoMarshaler + proto.Message sdk.Msg } -func MustExecViaStargateReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *sdk.Result { - t.Helper() +func MustExecViaStargateReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *abci.ExecTxResult { + require.NotEmpty(t, msgs) + // convert messages to stargate variant + vmMsgs := make([]string, len(msgs)) + for i, m := range msgs { + bz, err := chain.Codec.Marshal(m) + require.NoError(t, err) + // json is built manually because the wasmvm CosmosMsg does not have the `Stargate` variant anymore + vmMsgs[i] = fmt.Sprintf("{\"stargate\":{\"type_url\":\"%s\",\"value\":\"%s\"}}", sdk.MsgTypeURL(m), base64.StdEncoding.EncodeToString(bz)) + } + // build the complete reflect message + reflectSendBz := []byte(fmt.Sprintf("{\"reflect_msg\":{\"msgs\":%s}}", vmMsgs)) + + execMsg := &types.MsgExecuteContract{ + Sender: chain.SenderAccount.GetAddress().String(), + Contract: contractAddr.String(), + Msg: reflectSendBz, + } + rsp, err := chain.SendMsgs(execMsg) + require.NoError(t, err) + return rsp +} + +func MustExecViaAnyReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *abci.ExecTxResult { vmMsgs := make([]wasmvmtypes.CosmosMsg, len(msgs)) for i, m := range msgs { bz, err := chain.Codec.Marshal(m) require.NoError(t, err) vmMsgs[i] = wasmvmtypes.CosmosMsg{ - Stargate: &wasmvmtypes.StargateMsg{ + Any: &wasmvmtypes.AnyMsg{ TypeURL: sdk.MsgTypeURL(m), Value: bz, }, @@ -56,8 +88,7 @@ func MustExecViaStargateReflectContract[T sdkMessageType](t *testing.T, chain *i } // ExecViaReflectContract submit execute message to send payload to reflect contract -func ExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs []wasmvmtypes.CosmosMsg) (*sdk.Result, error) { - t.Helper() +func ExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs []wasmvmtypes.CosmosMsg) (*abci.ExecTxResult, error) { require.NotEmpty(t, msgs) reflectSend := testdata.ReflectHandleMsg{ Reflect: &testdata.ReflectPayload{Msgs: msgs}, diff --git a/tests/system/.gitignore b/tests/system/.gitignore index 73423081ac..22873da42d 100644 --- a/tests/system/.gitignore +++ b/tests/system/.gitignore @@ -1 +1,2 @@ /testnet +/binaries diff --git a/tests/system/Makefile b/tests/system/Makefile index 641305df18..b2396fd3fb 100644 --- a/tests/system/Makefile +++ b/tests/system/Makefile @@ -10,7 +10,6 @@ test: format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/CosmWasm/wasmd - + find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gci write --skip-generated -s standard -s default -s "prefix(cosmossdk.io)" -s "prefix(github.com/cosmos/cosmos-sdk)" -s "prefix(github.com/CosmWasm/wasmd)" --custom-order .PHONY: all test format diff --git a/tests/system/basic_test.go b/tests/system/basic_test.go index 1fba127648..a6178381f5 100644 --- a/tests/system/basic_test.go +++ b/tests/system/basic_test.go @@ -50,10 +50,13 @@ func TestBasicWasm(t *testing.T) { t.Cleanup(cleanupFn) t.Log("Instantiate wasm code") - initMsg := fmt.Sprintf(`{"verifier":%q, "beneficiary":%q}`, randomBech32Addr(), randomBech32Addr()) + verifierAddr := randomBech32Addr() + initMsg := fmt.Sprintf(`{"verifier":%q, "beneficiary":%q}`, verifierAddr, randomBech32Addr()) newContractAddr := cli.WasmInstantiate(codeID, initMsg, "--admin="+defaultSrcAddr, "--label=label1", "--from="+defaultSrcAddr) - assert.Equal(t, expContractAddr, newContractAddr) - assert.Len(t, done(), 1) + require.Equal(t, expContractAddr, newContractAddr) + require.Len(t, done(), 1) + gotRsp := cli.QuerySmart(newContractAddr, `{"verifier":{}}`) + require.Equal(t, fmt.Sprintf(`{"data":{"verifier":"%s"}}`, verifierAddr), gotRsp) t.Log("Update Instantiate Config") qResult = cli.CustomQuery("q", "wasm", "code-info", fmt.Sprint(codeID)) diff --git a/tests/system/cli.go b/tests/system/cli.go index 7aeddb38ab..5b0eef69d3 100644 --- a/tests/system/cli.go +++ b/tests/system/cli.go @@ -3,6 +3,7 @@ package system import ( "fmt" "io" + "os" "os/exec" "path/filepath" "strconv" @@ -10,17 +11,17 @@ import ( "testing" "time" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" - - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/codec" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" "golang.org/x/exp/slices" + + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/std" + sdk "github.com/cosmos/cosmos-sdk/types" ) type ( @@ -42,17 +43,19 @@ type WasmdCli struct { awaitNextBlock awaitNextBlock expTXCommitted bool execBinary string + nodesCount int } // NewWasmdCLI constructor func NewWasmdCLI(t *testing.T, sut *SystemUnderTest, verbose bool) *WasmdCli { return NewWasmdCLIx( t, - sut.execBinary, + sut.ExecBinary, sut.rpcAddr, sut.chainID, sut.AwaitNextBlock, - filepath.Join(workDir, sut.outputDir), + sut.nodesCount, + filepath.Join(WorkDir, sut.outputDir), "1"+sdk.DefaultBondDenom, verbose, assert.NoError, @@ -67,6 +70,7 @@ func NewWasmdCLIx( nodeAddress string, chainID string, awaiter awaitNextBlock, + nodesCount int, homeDir string, fees string, debug bool, @@ -84,6 +88,7 @@ func NewWasmdCLIx( homeDir: homeDir, Debug: debug, awaitNextBlock: awaiter, + nodesCount: nodesCount, fees: fees, assertErrorFn: assertErrorFn, expTXCommitted: expTXCommitted, @@ -105,6 +110,7 @@ func (c WasmdCli) WithRunErrorMatcher(f RunErrorAssert) WasmdCli { c.nodeAddress, c.chainID, c.awaitNextBlock, + c.nodesCount, c.homeDir, c.fees, c.Debug, @@ -120,6 +126,7 @@ func (c WasmdCli) WithNodeAddress(nodeAddr string) WasmdCli { nodeAddr, c.chainID, c.awaitNextBlock, + c.nodesCount, c.homeDir, c.fees, c.Debug, @@ -135,6 +142,7 @@ func (c WasmdCli) WithAssertTXUncommitted() WasmdCli { c.nodeAddress, c.chainID, c.awaitNextBlock, + c.nodesCount, c.homeDir, c.fees, c.Debug, @@ -156,7 +164,7 @@ func (c WasmdCli) CustomCommand(args ...string) string { if !ok { return execOutput } - rsp, committed := c.awaitTxCommitted(execOutput, defaultWaitTime) + rsp, committed := c.awaitTxCommitted(execOutput, DefaultWaitTime) c.t.Logf("tx committed: %v", committed) require.Equal(c.t, c.expTXCommitted, committed, "expected tx committed: %v", c.expTXCommitted) return rsp @@ -210,13 +218,13 @@ func (c WasmdCli) runWithInput(args []string, input io.Reader) (output string, o err = fmt.Errorf("recovered from panic: %v", r) } }() - cmd := exec.Command(locateExecutable("wasmd"), args...) //nolint:gosec - cmd.Dir = workDir + cmd := exec.Command(locateExecutable(c.execBinary), args...) //nolint:gosec + cmd.Dir = WorkDir cmd.Stdin = input return cmd.CombinedOutput() }() ok = c.assertErrorFn(c.t, gotErr, string(gotOut)) - return string(gotOut), ok + return strings.TrimSpace(string(gotOut)), ok } func (c WasmdCli) withQueryFlags(args ...string) []string { @@ -236,7 +244,7 @@ func (c WasmdCli) withTXFlags(args ...string) []string { } func (c WasmdCli) withKeyringFlags(args ...string) []string { - r := append(args, //nolint:gocritic + r := append(args, "--home", c.homeDir, "--keyring-backend", "test", ) @@ -262,7 +270,7 @@ func (c WasmdCli) WasmExecute(contractAddr, msg, from string, args ...string) st // AddKey add key to default keyring. Returns address func (c WasmdCli) AddKey(name string) string { - cmd := c.withKeyringFlags("keys", "add", name) //, "--no-backup") + cmd := c.withKeyringFlags("keys", "add", name, "--no-backup") out, _ := c.run(cmd) addr := gjson.Get(out, "address").String() require.NotEmpty(c.t, addr, "got %q", out) @@ -302,13 +310,13 @@ func (c WasmdCli) FundAddress(destAddr, amount string) string { // WasmStore uploads a wasm contract to the chain. Returns code id func (c WasmdCli) WasmStore(file string, args ...string) int { if len(args) == 0 { - args = []string{"--from=" + defaultSrcAddr, "--gas=2500000"} + args = []string{"--from=" + defaultSrcAddr, "--gas=2500000", "--fees=3stake"} } cmd := append([]string{"tx", "wasm", "store", file}, args...) rsp := c.CustomCommand(cmd...) RequireTxSuccess(c.t, rsp) - codeID := gjson.Get(rsp, "logs.#.events.#.attributes.#(key=code_id).value").Array()[0].Array()[0].Int() + codeID := gjson.Get(rsp, "events.#.attributes.#(key=code_id).value").Array()[0].Array()[0].Int() require.NotEmpty(c.t, codeID) return int(codeID) } @@ -321,7 +329,7 @@ func (c WasmdCli) WasmInstantiate(codeID int, initMsg string, args ...string) st cmd := append([]string{"tx", "wasm", "instantiate", strconv.Itoa(codeID), initMsg}, args...) rsp := c.CustomCommand(cmd...) RequireTxSuccess(c.t, rsp) - addr := gjson.Get(rsp, "logs.#.events.#.attributes.#(key=_contract_address).value").Array()[0].Array()[0].String() + addr := gjson.Get(rsp, "events.#.attributes.#(key=_contract_address).value").Array()[0].Array()[0].String() require.NotEmpty(c.t, addr) return addr } @@ -341,21 +349,21 @@ func (c WasmdCli) QueryBalances(addr string) string { // QueryBalance returns balance amount for given denom. // 0 when not found func (c WasmdCli) QueryBalance(addr, denom string) int64 { - raw := c.CustomQuery("q", "bank", "balances", addr, "--denom="+denom) + raw := c.CustomQuery("q", "bank", "balance", addr, denom) require.Contains(c.t, raw, "amount", raw) - return gjson.Get(raw, "amount").Int() + return gjson.Get(raw, "balance.amount").Int() } // QueryTotalSupply returns total amount of tokens for a given denom. // 0 when not found func (c WasmdCli) QueryTotalSupply(denom string) int64 { - raw := c.CustomQuery("q", "bank", "total", "--denom="+denom) + raw := c.CustomQuery("q", "bank", "total-supply") require.Contains(c.t, raw, "amount", raw) - return gjson.Get(raw, "amount").Int() + return gjson.Get(raw, fmt.Sprintf("supply.#(denom==%q).amount", denom)).Int() } -func (c WasmdCli) GetTendermintValidatorSet() rpc.ResultValidatorsOutput { - args := []string{"q", "tendermint-validator-set"} +func (c WasmdCli) GetCometBFTValidatorSet() cmtservice.GetLatestValidatorSetResponse { + args := []string{"q", "comet-validator-set"} got := c.CustomQuery(args...) // still using amino here as the SDK @@ -363,17 +371,17 @@ func (c WasmdCli) GetTendermintValidatorSet() rpc.ResultValidatorsOutput { std.RegisterLegacyAminoCodec(amino) std.RegisterInterfaces(codectypes.NewInterfaceRegistry()) - var res rpc.ResultValidatorsOutput + var res cmtservice.GetLatestValidatorSetResponse require.NoError(c.t, amino.UnmarshalJSON([]byte(got), &res), got) return res } -// IsInTendermintValset returns true when the given pub key is in the current active tendermint validator set -func (c WasmdCli) IsInTendermintValset(valPubKey cryptotypes.PubKey) (rpc.ResultValidatorsOutput, bool) { - valResult := c.GetTendermintValidatorSet() +// IsInCometBftValset returns true when the given pub key is in the current active tendermint validator set +func (c WasmdCli) IsInCometBftValset(valPubKey cryptotypes.PubKey) (cmtservice.GetLatestValidatorSetResponse, bool) { + valResult := c.GetCometBFTValidatorSet() var found bool for _, v := range valResult.Validators { - if v.PubKey.Equals(valPubKey) { + if v.PubKey.Equal(valPubKey) { found = true break } @@ -381,6 +389,44 @@ func (c WasmdCli) IsInTendermintValset(valPubKey cryptotypes.PubKey) (rpc.Result return valResult, found } +// SubmitGovProposal submit a gov v1 proposal +func (c WasmdCli) SubmitGovProposal(proposalJson string, args ...string) string { + if len(args) == 0 { + args = []string{"--from=" + defaultSrcAddr} + } + + pathToProposal := filepath.Join(c.t.TempDir(), "proposal.json") + err := os.WriteFile(pathToProposal, []byte(proposalJson), os.FileMode(0o744)) + require.NoError(c.t, err) + c.t.Log("Submit upgrade proposal") + return c.CustomCommand(append([]string{"tx", "gov", "submit-proposal", pathToProposal}, args...)...) +} + +// SubmitAndVoteGovProposal submit proposal, let all validators vote yes and return proposal id +func (c WasmdCli) SubmitAndVoteGovProposal(proposalJson string, args ...string) string { + rsp := c.SubmitGovProposal(proposalJson, args...) + RequireTxSuccess(c.t, rsp) + raw := c.CustomQuery("q", "gov", "proposals", "--depositor", c.GetKeyAddr(defaultSrcAddr)) + proposals := gjson.Get(raw, "proposals.#.id").Array() + require.NotEmpty(c.t, proposals, raw) + ourProposalID := proposals[len(proposals)-1].String() // last is ours + for i := 0; i < c.nodesCount; i++ { + go func(i int) { // do parallel + c.t.Logf("Voting: validator %d\n", i) + rsp = c.CustomCommand("tx", "gov", "vote", ourProposalID, "yes", "--from", c.GetKeyAddr(fmt.Sprintf("node%d", i))) + RequireTxSuccess(c.t, rsp) + }(i) + } + return ourProposalID +} + +// Version returns the current version of the client binary +func (c WasmdCli) Version() string { + v, ok := c.run([]string{"version"}) + require.True(c.t, ok) + return v +} + // RequireTxSuccess require the received response to contain the success code func RequireTxSuccess(t *testing.T, got string) { t.Helper() diff --git a/tests/system/cli_test.go b/tests/system/cli_test.go index 02b486aadd..09b8b7b080 100644 --- a/tests/system/cli_test.go +++ b/tests/system/cli_test.go @@ -9,11 +9,13 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" + + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestUnsafeResetAll(t *testing.T) { @@ -22,14 +24,14 @@ func TestUnsafeResetAll(t *testing.T) { // when `unsafe-reset-all` is executed // then the dir and all files in it are removed - wasmDir := filepath.Join(workDir, sut.nodePath(0), "wasm") + wasmDir := filepath.Join(WorkDir, sut.nodePath(0), "wasm") require.NoError(t, os.MkdirAll(wasmDir, os.ModePerm)) _, err := os.CreateTemp(wasmDir, "testing") require.NoError(t, err) // when - sut.ForEachNodeExecAndWait(t, []string{"tendermint", "unsafe-reset-all"}) + sut.ForEachNodeExecAndWait(t, []string{"comet", "unsafe-reset-all"}) // then sut.withEachNodeHome(func(i int, home string) { @@ -94,7 +96,7 @@ func TestVestingAccounts(t *testing.T) { assert.Equal(t, myStartTimestamp, accounts[0].Get("start_time").Int()) // check accounts have some balances - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000000))), GetGenesisBalance([]byte(raw), vest1Addr)) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000001))), GetGenesisBalance([]byte(raw), vest2Addr)) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(200000002))), GetGenesisBalance([]byte(raw), vest3Addr)) + assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000000))), GetGenesisBalance([]byte(raw), vest1Addr)) + assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000001))), GetGenesisBalance([]byte(raw), vest2Addr)) + assert.Equal(t, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200000002))), GetGenesisBalance([]byte(raw), vest3Addr)) } diff --git a/tests/system/fraud_test.go b/tests/system/fraud_test.go index 9e5e4d61d5..65e4335d24 100644 --- a/tests/system/fraud_test.go +++ b/tests/system/fraud_test.go @@ -7,9 +7,9 @@ import ( "math" "testing" - sdkmath "cosmossdk.io/math" - "github.com/stretchr/testify/require" + + sdkmath "cosmossdk.io/math" ) func TestRecursiveMsgsExternalTrigger(t *testing.T) { diff --git a/tests/system/genesis_io.go b/tests/system/genesis_io.go index 23e54f09e8..0e75c85655 100644 --- a/tests/system/genesis_io.go +++ b/tests/system/genesis_io.go @@ -3,18 +3,22 @@ package system import ( "fmt" "testing" + "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" "github.com/tidwall/sjson" + + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // SetConsensusMaxGas max gas that can be consumed in a block func SetConsensusMaxGas(t *testing.T, max int) GenesisMutator { return func(genesis []byte) []byte { t.Helper() - state, err := sjson.SetRawBytes(genesis, "consensus_params.block.max_gas", []byte(fmt.Sprintf(`"%d"`, max))) + state, err := sjson.SetRawBytes(genesis, "consensus.params.block.max_gas", []byte(fmt.Sprintf(`"%d"`, max))) require.NoError(t, err) return state } @@ -26,7 +30,7 @@ func GetGenesisBalance(rawGenesis []byte, addr string) sdk.Coins { balances := gjson.GetBytes(rawGenesis, fmt.Sprintf(`app_state.bank.balances.#[address==%q]#.coins`, addr)).Array() for _, coins := range balances { for _, coin := range coins.Array() { - r = append(r, sdk.NewCoin(coin.Get("denom").String(), sdk.NewInt(coin.Get("amount").Int()))) + r = append(r, sdk.NewCoin(coin.Get("denom").String(), sdkmath.NewInt(coin.Get("amount").Int()))) } } return r @@ -43,3 +47,12 @@ func SetCodeUploadPermission(t *testing.T, permission string, addresses ...strin return []byte(state) } } + +func SetGovVotingPeriod(t *testing.T, period time.Duration) GenesisMutator { + return func(genesis []byte) []byte { + t.Helper() + state, err := sjson.SetRawBytes(genesis, "app_state.gov.params.voting_period", []byte(fmt.Sprintf("%q", period.String()))) + require.NoError(t, err) + return state + } +} diff --git a/tests/system/go.mod b/tests/system/go.mod index 28db89cd9f..954a7d5184 100644 --- a/tests/system/go.mod +++ b/tests/system/go.mod @@ -1,152 +1,163 @@ module github.com/CosmWasm/wasmd/tests/system -go 1.19 +go 1.21 require ( - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect - github.com/cosmos/cosmos-sdk v0.47.5 + github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect + github.com/cosmos/cosmos-sdk v0.50.6 github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.4.10 // indirect - github.com/cosmos/iavl v0.20.0 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/cosmos/gogoproto v1.4.12 // indirect + github.com/cosmos/iavl v1.1.2 // indirect + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.15.0 // indirect - github.com/rakyll/statik v0.1.7 // indirect - github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/cobra v1.6.1 // indirect + github.com/prometheus/client_golang v1.19.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/cobra v1.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect - google.golang.org/grpc v1.56.2 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 // indirect ) require ( - cosmossdk.io/math v1.1.2 - github.com/cometbft/cometbft v0.37.2 + cosmossdk.io/math v1.3.0 + github.com/cometbft/cometbft v0.38.6 github.com/tidwall/gjson v1.14.2 github.com/tidwall/sjson v1.2.5 - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 ) require ( - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.5.1 // indirect + cosmossdk.io/api v0.7.4 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/core v0.11.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/errors v1.0.0 // indirect - cosmossdk.io/log v1.2.1 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect + cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/log v1.3.1 // indirect + cosmossdk.io/store v1.1.0 // indirect + cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/armon/go-metrics v0.4.1 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/cometbft/cometbft-db v0.7.0 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect + github.com/emicklei/dot v1.6.1 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.16.3 // indirect + github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/highwayhash v1.0.2 // 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/pelletier/go-toml/v2 v2.0.7 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.52.2 // indirect + github.com/prometheus/procfs v0.13.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.30.0 // indirect + github.com/rs/zerolog v1.32.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.15.0 // indirect - github.com/subosito/gotenv v1.4.2 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/viper v1.18.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.6.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.12.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/protobuf v1.31.0 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.3.8 // indirect + go.uber.org/multierr v1.10.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect nhooyr.io/websocket v1.8.6 // indirect - pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( diff --git a/tests/system/go.sum b/tests/system/go.sum index ff2c855499..d15de7c26d 100644 --- a/tests/system/go.sum +++ b/tests/system/go.sum @@ -1,68 +1,41 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= -cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/api v0.7.4 h1:sPo8wKwCty1lht8kgL3J7YL1voJywP3YWuA5JKkBz30= +cosmossdk.io/api v0.7.4/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= -cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= +cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= +cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -70,6 +43,7 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= +github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -82,13 +56,12 @@ github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -96,11 +69,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -111,18 +89,15 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -130,23 +105,27 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= +github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= -github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= +github.com/cometbft/cometbft v0.38.6 h1:QSgpCzrGWJ2KUq1qpw+FCfASRpE27T6LQbfEHscdyOk= +github.com/cometbft/cometbft v0.38.6/go.mod h1:8rSPxzUJYquCN8uuBgbUHOMg2KAwvr7CyUw+6ukO4nw= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -155,41 +134,42 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.5 h1:n1+WjP/VM/gAEOx3TqU2/Ny734rj/MX1kpUnn7zVJP8= -github.com/cosmos/cosmos-sdk v0.47.5/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= +github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.50.6 h1:efR3MsvMHX5sxS3be+hOobGk87IzlZbSpsI2x/Vw3hk= +github.com/cosmos/cosmos-sdk v0.50.6/go.mod h1:lVkRY6cdMJ0fG3gp8y4hFrsKZqF4z7y0M2UXFb9Yt40= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= +github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= +github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= +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 v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= @@ -201,57 +181,62 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= -github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -266,6 +251,7 @@ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/j github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= @@ -276,6 +262,7 @@ github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -291,26 +278,18 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -322,8 +301,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -336,39 +315,21 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= @@ -383,29 +344,30 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= @@ -417,14 +379,16 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -433,16 +397,16 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= @@ -455,8 +419,6 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= @@ -467,11 +429,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -490,35 +451,38 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= 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= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +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.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -548,22 +512,31 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -573,6 +546,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -580,24 +554,25 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us= -github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -605,34 +580,32 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= +github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= 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= @@ -642,18 +615,22 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -664,41 +641,43 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= -github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -706,20 +685,19 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= -github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.14.2 h1:6BBkirS0rAHjumnjHF6qgy5d2YAJ1TLIaFE2lzfOLqo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -739,88 +717,66 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -833,60 +789,35 @@ golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -902,9 +833,6 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -913,38 +841,22 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -952,32 +864,29 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -986,164 +895,64 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 h1:s5YSX+ZH5b5vS9rnpGymvIyMpLRJizowqDlOuyjXnTk= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1159,8 +968,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1184,6 +993,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -1191,24 +1001,17 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/tests/system/main_test.go b/tests/system/main_test.go index e806addd4f..0467cc2f8f 100644 --- a/tests/system/main_test.go +++ b/tests/system/main_test.go @@ -14,18 +14,20 @@ import ( "time" "github.com/cometbft/cometbft/libs/rand" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" ) var ( - sut *SystemUnderTest - verbose bool + sut *SystemUnderTest + verbose bool + execBinaryName string ) func TestMain(m *testing.M) { rebuild := flag.Bool("rebuild", false, "rebuild artifacts") - waitTime := flag.Duration("wait-time", defaultWaitTime, "time to wait for chain events") + waitTime := flag.Duration("wait-time", DefaultWaitTime, "time to wait for chain events") nodesCount := flag.Int("nodes-count", 4, "number of nodes in the cluster") blockTime := flag.Duration("block-time", 1000*time.Millisecond, "block creation time") execBinary := flag.String("binary", "wasmd", "executable binary for server/ client side") @@ -40,16 +42,17 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - workDir = dir + WorkDir = dir if verbose { - println("Work dir: ", workDir) + println("Work dir: ", WorkDir) } initSDKConfig(*bech32Prefix) - defaultWaitTime = *waitTime + DefaultWaitTime = *waitTime if *execBinary == "" { panic("executable binary name must not be empty") } + execBinaryName = *execBinary sut = NewSystemUnderTest(*execBinary, verbose, *nodesCount, *blockTime) if *rebuild { sut.BuildNewBinary() @@ -78,7 +81,7 @@ func requireEnoughFileHandlers(nodesCount int) { } cmd := exec.Command(ulimit, "-n") - cmd.Dir = workDir + cmd.Dir = WorkDir out, err := cmd.CombinedOutput() if err != nil { panic(fmt.Sprintf("unexpected error :%#+v, output: %s", err, string(out))) diff --git a/tests/system/staking_test.go b/tests/system/staking_test.go index 2cb25d9778..5e5df6df3c 100644 --- a/tests/system/staking_test.go +++ b/tests/system/staking_test.go @@ -21,7 +21,7 @@ func TestStakeUnstake(t *testing.T) { // add genesis account with some tokens account1Addr := cli.AddKey("account1") sut.ModifyGenesisCLI(t, - []string{"genesis", "add-genesis-account", account1Addr, "100000000stake"}, + []string{"genesis", "add-genesis-account", account1Addr, "10000000stake"}, ) sut.StartChain(t) @@ -35,20 +35,20 @@ func TestStakeUnstake(t *testing.T) { RequireTxSuccess(t, rsp) t.Log(cli.QueryBalance(account1Addr, "stake")) - assert.Equal(t, int64(99989999), cli.QueryBalance(account1Addr, "stake")) + assert.Equal(t, int64(9989999), cli.QueryBalance(account1Addr, "stake")) rsp = cli.CustomQuery("q", "staking", "delegation", account1Addr, valAddr) - assert.Equal(t, "10000", gjson.Get(rsp, "balance.amount").String()) - assert.Equal(t, "stake", gjson.Get(rsp, "balance.denom").String()) + assert.Equal(t, "10000", gjson.Get(rsp, "delegation_response.balance.amount").String(), rsp) + assert.Equal(t, "stake", gjson.Get(rsp, "delegation_response.balance.denom").String(), rsp) // unstake tokens rsp = cli.CustomCommand("tx", "staking", "unbond", valAddr, "5000stake", "--from="+account1Addr, "--fees=1stake") RequireTxSuccess(t, rsp) rsp = cli.CustomQuery("q", "staking", "delegation", account1Addr, valAddr) - assert.Equal(t, "5000", gjson.Get(rsp, "balance.amount").String()) - assert.Equal(t, "stake", gjson.Get(rsp, "balance.denom").String()) + assert.Equal(t, "5000", gjson.Get(rsp, "delegation_response.balance.amount").String(), rsp) + assert.Equal(t, "stake", gjson.Get(rsp, "delegation_response.balance.denom").String(), rsp) rsp = cli.CustomQuery("q", "staking", "unbonding-delegation", account1Addr, valAddr) - assert.Equal(t, "5000", gjson.Get(rsp, "entries.#.balance").Array()[0].String()) + assert.Equal(t, "5000", gjson.Get(rsp, "unbond.entries.#.balance").Array()[0].String(), rsp) } diff --git a/tests/system/system.go b/tests/system/system.go index 89b5ca0543..f89ce4217e 100644 --- a/tests/system/system.go +++ b/tests/system/system.go @@ -7,37 +7,45 @@ import ( "context" "fmt" "io" - "io/ioutil" "os" "os/exec" "path/filepath" + "regexp" "strconv" "strings" "sync/atomic" + "syscall" "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/tidwall/sjson" - "github.com/cometbft/cometbft/libs/sync" client "github.com/cometbft/cometbft/rpc/client/http" ctypes "github.com/cometbft/cometbft/rpc/core/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/server" "github.com/stretchr/testify/require" + "github.com/tidwall/sjson" + + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" ) -var workDir string +var ( + // WorkDir is the directory where tests are executed. Path should be relative to this dir + WorkDir string + + // ExecBinaryUnversionedRegExp regular expression to extract the unversioned binary name + ExecBinaryUnversionedRegExp = regexp.MustCompile(`^(\w+)-?.*$`) +) // SystemUnderTest blockchain provisioning type SystemUnderTest struct { - execBinary string - blockListener *EventListener - currentHeight int64 - chainID string - outputDir string + ExecBinary string + blockListener *EventListener + currentHeight int64 + chainID string + outputDir string + // blockTime is the the expected/desired block time. This is not going to be very precise + // since Tendermint consensus does not allow specifying it directly. blockTime time.Duration rpcAddr string initialNodesCount int @@ -49,16 +57,25 @@ type SystemUnderTest struct { out io.Writer verbose bool ChainStarted bool + projectName string dirty bool // requires full reset when marked dirty + + pidsLock sync.RWMutex + pids map[int]struct{} } func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTime time.Duration) *SystemUnderTest { if execBinary == "" { panic("executable binary name must not be empty") } + nameTokens := ExecBinaryUnversionedRegExp.FindAllString(execBinary, 1) + if len(nameTokens) == 0 || nameTokens[0] == "" { + panic("failed to parse project name from binary") + } + return &SystemUnderTest{ chainID: "testing", - execBinary: execBinary, + ExecBinary: execBinary, outputDir: "./testnet", blockTime: blockTime, rpcAddr: "tcp://localhost:26657", @@ -68,15 +85,20 @@ func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTi out: os.Stdout, verbose: verbose, minGasPrice: fmt.Sprintf("0.000001%s", sdk.DefaultBondDenom), + projectName: nameTokens[0], + pids: make(map[int]struct{}, nodesCount), } } func (s *SystemUnderTest) SetupChain() { s.Logf("Setup chain: %s\n", s.outputDir) - if err := os.RemoveAll(filepath.Join(workDir, s.outputDir)); err != nil { + if err := os.RemoveAll(filepath.Join(WorkDir, s.outputDir)); err != nil { panic(err.Error()) } + // The commit timeout is a lower bound for the block time. We try to set it to a level that allows us to reach the expected block time. + commitTimeout := time.Duration((int64(s.blockTime) * 90) / 100) // leave 10% for all other operations + args := []string{ "testnet", "init-files", @@ -84,17 +106,17 @@ func (s *SystemUnderTest) SetupChain() { "--output-dir=" + s.outputDir, "--v=" + strconv.Itoa(s.initialNodesCount), "--keyring-backend=test", - "--commit-timeout=" + s.blockTime.String(), + "--commit-timeout=" + commitTimeout.String(), "--minimum-gas-prices=" + s.minGasPrice, "--starting-ip-address", "", // empty to use host systems "--single-host", } - fmt.Printf("+++ %s %s", s.execBinary, strings.Join(args, " ")) + fmt.Printf("+++ %s %s\n", s.ExecBinary, strings.Join(args, " ")) cmd := exec.Command( //nolint:gosec - locateExecutable(s.execBinary), + locateExecutable(s.ExecBinary), args..., ) - cmd.Dir = workDir + cmd.Dir = WorkDir out, err := cmd.CombinedOutput() if err != nil { panic(fmt.Sprintf("unexpected error :%#+v, output: %s", err, string(out))) @@ -103,13 +125,13 @@ func (s *SystemUnderTest) SetupChain() { s.nodesCount = s.initialNodesCount // modify genesis with system test defaults - src := filepath.Join(workDir, s.nodePath(0), "config", "genesis.json") - genesisBz, err := ioutil.ReadFile(src) + src := filepath.Join(WorkDir, s.nodePath(0), "config", "genesis.json") + genesisBz, err := os.ReadFile(src) if err != nil { panic(fmt.Sprintf("failed to load genesis: %s", err)) } - genesisBz, err = sjson.SetRawBytes(genesisBz, "consensus_params.block.max_gas", []byte(fmt.Sprintf(`"%d"`, 10_000_000))) + genesisBz, err = sjson.SetRawBytes(genesisBz, "consensus.params.block.max_gas", []byte(fmt.Sprintf(`"%d"`, 10_000_000))) if err != nil { panic(fmt.Sprintf("failed set block max gas: %s", err)) } @@ -120,13 +142,13 @@ func (s *SystemUnderTest) SetupChain() { }) // backup genesis - dest := filepath.Join(workDir, s.nodePath(0), "config", "genesis.json.orig") + dest := filepath.Join(WorkDir, s.nodePath(0), "config", "genesis.json.orig") if _, err := copyFile(src, dest); err != nil { panic(fmt.Sprintf("copy failed :%#+v", err)) } // backup keyring - src = filepath.Join(workDir, s.nodePath(0), "keyring-test") - dest = filepath.Join(workDir, s.outputDir, "keyring-test") + src = filepath.Join(WorkDir, s.nodePath(0), "keyring-test") + dest = filepath.Join(WorkDir, s.outputDir, "keyring-test") if err := copyFilesInDir(src, dest); err != nil { panic(fmt.Sprintf("copy files from dir :%#+v", err)) } @@ -136,7 +158,7 @@ func (s *SystemUnderTest) StartChain(t *testing.T, xargs ...string) { t.Helper() s.Log("Start chain\n") s.ChainStarted = true - s.forEachNodesExecAsync(t, append([]string{"start", "--trace", "--log_level=info"}, xargs...)...) + s.startNodesAsync(t, append([]string{"start", "--trace", "--log_level=info"}, xargs...)...) s.AwaitNodeUp(t, s.rpcAddr) @@ -159,13 +181,13 @@ func (s *SystemUnderTest) MarkDirty() { } // IsDirty true when non default genesis or other state modification were applied that might create incompatibility for tests -func (s SystemUnderTest) IsDirty() bool { +func (s *SystemUnderTest) IsDirty() bool { return s.dirty } // watchLogs stores stdout/stderr in a file and in a ring buffer to output the last n lines on test error func (s *SystemUnderTest) watchLogs(node int, cmd *exec.Cmd) { - logfile, err := os.Create(filepath.Join(workDir, s.outputDir, fmt.Sprintf("node%d.out", node))) + logfile, err := os.Create(filepath.Join(WorkDir, s.outputDir, fmt.Sprintf("node%d.out", node))) if err != nil { panic(fmt.Sprintf("open logfile error %#+v", err)) } @@ -184,7 +206,7 @@ func (s *SystemUnderTest) watchLogs(node int, cmd *exec.Cmd) { go appendToBuf(io.TeeReader(outReader, logfile), s.outBuff, stopRingBuffer) s.cleanupFn = append(s.cleanupFn, func() { close(stopRingBuffer) - logfile.Close() + _ = logfile.Close() }) } @@ -217,11 +239,34 @@ func isLogNoise(text string) bool { return false } +// AwaitUpgradeInfo blocks util an upgrade info file is persisted to disk +func (s *SystemUnderTest) AwaitUpgradeInfo(t *testing.T) { + var found bool + for !found { + s.withEachNodeHome(func(i int, home string) { + _, err := os.Stat(filepath.Join(s.nodePath(0), "data", "upgrade-info.json")) + switch { + case err == nil: + found = true + case !os.IsNotExist(err): + t.Fatalf(err.Error()) + } + }) + time.Sleep(s.blockTime / 2) + } +} + +func (s *SystemUnderTest) AwaitChainStopped() { + for s.anyNodeRunning() { + time.Sleep(s.blockTime) + } +} + // AwaitNodeUp ensures the node is running func (s *SystemUnderTest) AwaitNodeUp(t *testing.T, rpcAddr string) { t.Helper() t.Logf("Await node is up: %s", rpcAddr) - timeout := defaultWaitTime + timeout := DefaultWaitTime ctx, done := context.WithTimeout(context.Background(), timeout) defer done() @@ -265,34 +310,45 @@ func (s *SystemUnderTest) StopChain() { } s.cleanupFn = nil // send SIGTERM - cmd := exec.Command(locateExecutable("pkill"), "-15", s.execBinary) //nolint:gosec - cmd.Dir = workDir - if _, err := cmd.CombinedOutput(); err != nil { - s.Logf("failed to stop chain: %s\n", err) - } - - var shutdown bool - for timeout := time.NewTimer(500 * time.Millisecond).C; !shutdown; { - select { - case <-timeout: - s.Log("killing nodes now") - cmd = exec.Command(locateExecutable("pkill"), "-9", s.execBinary) //nolint:gosec - cmd.Dir = workDir - if _, err := cmd.CombinedOutput(); err != nil { - s.Logf("failed to kill process: %s\n", err) + s.withEachPid(func(p *os.Process) { + go func() { + if err := p.Signal(syscall.SIGTERM); err != nil { + s.Logf("failed to stop node with pid %d: %s\n", p.Pid, err) } - shutdown = true - default: - if err := exec.Command(locateExecutable("pgrep"), s.execBinary).Run(); err != nil { //nolint:gosec - shutdown = true + }() + }) + // give some final time to shut down + s.withEachPid(func(p *os.Process) { + time.Sleep(200 * time.Millisecond) + }) + // goodbye + for ; s.anyNodeRunning(); time.Sleep(100 * time.Millisecond) { + s.withEachPid(func(p *os.Process) { + s.Logf("killing node %d\n", p.Pid) + if err := p.Kill(); err != nil { + s.Logf("failed to kill node with pid %d: %s\n", p.Pid, err) } - } + }) } s.ChainStarted = false } +func (s *SystemUnderTest) withEachPid(cb func(p *os.Process)) { + s.pidsLock.RLock() + pids := s.pids + s.pidsLock.RUnlock() + + for pid := range pids { + p, err := os.FindProcess(pid) + if err != nil { + continue + } + cb(p) + } +} + // PrintBuffer prints the chain logs to the console -func (s SystemUnderTest) PrintBuffer() { +func (s *SystemUnderTest) PrintBuffer() { s.outBuff.Do(func(v interface{}) { if v != nil { fmt.Fprintf(s.out, "out> %s\n", v) @@ -307,17 +363,41 @@ func (s SystemUnderTest) PrintBuffer() { } // BuildNewBinary builds and installs new executable binary -func (s SystemUnderTest) BuildNewBinary() { +func (s *SystemUnderTest) BuildNewBinary() { s.Log("Install binaries\n") makePath := locateExecutable("make") cmd := exec.Command(makePath, "clean", "install") - cmd.Dir = workDir + cmd.Dir = WorkDir out, err := cmd.CombinedOutput() if err != nil { panic(fmt.Sprintf("unexpected error %#v : output: %s", err, string(out))) } } +// AwaitBlockHeight blocks until te target height is reached. An optional timout parameter can be passed to abort early +func (s *SystemUnderTest) AwaitBlockHeight(t *testing.T, targetHeight int64, timeout ...time.Duration) { + t.Helper() + require.Greater(t, targetHeight, s.currentHeight) + var maxWaitTime time.Duration + if len(timeout) != 0 { + maxWaitTime = timeout[0] + } else { + maxWaitTime = time.Duration(targetHeight-s.currentHeight+3) * s.blockTime + } + abort := time.NewTimer(maxWaitTime).C + for { + select { + case <-abort: + t.Fatalf("Timeout - block %d not reached within %s", targetHeight, maxWaitTime) + return + default: + if current := s.AwaitNextBlock(t); current >= targetHeight { + return + } + } + } +} + // AwaitNextBlock is a first class function that any caller can use to ensure a new block was minted. // Returns the new height func (s *SystemUnderTest) AwaitNextBlock(t *testing.T, timeout ...time.Duration) int64 { @@ -355,19 +435,19 @@ func (s *SystemUnderTest) ResetChain(t *testing.T) { t.Helper() t.Log("Reset chain") s.StopChain() - restoreOriginalGenesis(t, *s) - restoreOriginalKeyring(t, *s) + restoreOriginalGenesis(t, s) + restoreOriginalKeyring(t, s) s.resetBuffers() // remove all additional nodes for i := s.initialNodesCount; i < s.nodesCount; i++ { - os.RemoveAll(filepath.Join(workDir, s.nodePath(i))) - os.Remove(filepath.Join(workDir, s.outputDir, fmt.Sprintf("node%d.out", i))) + _ = os.RemoveAll(filepath.Join(WorkDir, s.nodePath(i))) + _ = os.Remove(filepath.Join(WorkDir, s.outputDir, fmt.Sprintf("node%d.out", i))) } s.nodesCount = s.initialNodesCount - // reset all validataor nodes - s.ForEachNodeExecAndWait(t, []string{"tendermint", "unsafe-reset-all"}) + // reset all validator nodes + s.ForEachNodeExecAndWait(t, []string{"comet", "unsafe-reset-all"}) s.currentHeight = 0 s.dirty = false } @@ -397,7 +477,7 @@ func (s *SystemUnderTest) ModifyGenesisJSON(t *testing.T, mutators ...GenesisMut // modify json without enforcing a reset func (s *SystemUnderTest) modifyGenesisJSON(t *testing.T, mutators ...GenesisMutator) { require.Empty(t, s.currentHeight, "forced chain reset required") - current, err := os.ReadFile(filepath.Join(workDir, s.nodePath(0), "config", "genesis.json")) + current, err := os.ReadFile(filepath.Join(WorkDir, s.nodePath(0), "config", "genesis.json")) require.NoError(t, err) for _, m := range mutators { current = m(current) @@ -410,7 +490,7 @@ func (s *SystemUnderTest) modifyGenesisJSON(t *testing.T, mutators ...GenesisMut // ReadGenesisJSON returns current genesis.json content as raw string func (s *SystemUnderTest) ReadGenesisJSON(t *testing.T) string { - content, err := os.ReadFile(filepath.Join(workDir, s.nodePath(0), "config", "genesis.json")) + content, err := os.ReadFile(filepath.Join(WorkDir, s.nodePath(0), "config", "genesis.json")) require.NoError(t, err) return string(content) } @@ -431,7 +511,7 @@ func (s *SystemUnderTest) setGenesis(t *testing.T, srcPath string) { } func saveGenesis(home string, content []byte) error { - out, err := os.Create(filepath.Join(workDir, home, "config", "genesis.json")) + out, err := os.Create(filepath.Join(WorkDir, home, "config", "genesis.json")) if err != nil { return fmt.Errorf("out file: %w", err) } @@ -455,12 +535,12 @@ func (s *SystemUnderTest) ForEachNodeExecAndWait(t *testing.T, cmds ...[]string) result[i] = make([]string, len(cmds)) for j, xargs := range cmds { xargs = append(xargs, "--home", home) - s.Logf("Execute `%s %s`\n", s.execBinary, strings.Join(xargs, " ")) + s.Logf("Execute `%s %s`\n", s.ExecBinary, strings.Join(xargs, " ")) cmd := exec.Command( //nolint:gosec - locateExecutable(s.execBinary), + locateExecutable(s.ExecBinary), xargs..., ) - cmd.Dir = workDir + cmd.Dir = WorkDir out, err := cmd.CombinedOutput() require.NoError(t, err, "node %d: %s", i, string(out)) s.Logf("Result: %s\n", string(out)) @@ -470,50 +550,62 @@ func (s *SystemUnderTest) ForEachNodeExecAndWait(t *testing.T, cmds ...[]string) return result } -// forEachNodesExecAsync runs the given app cli command for all cluster nodes and returns without waiting -func (s *SystemUnderTest) forEachNodesExecAsync(t *testing.T, xargs ...string) []func() error { - r := make([]func() error, s.nodesCount) +// startNodesAsync runs the given app cli command for all cluster nodes and returns without waiting +func (s *SystemUnderTest) startNodesAsync(t *testing.T, xargs ...string) { s.withEachNodeHome(func(i int, home string) { - args := append(xargs, "--home", home) //nolint:gocritic - s.Logf("Execute `%s %s`\n", s.execBinary, strings.Join(args, " ")) + args := append(xargs, "--home", home) + s.Logf("Execute `%s %s`\n", s.ExecBinary, strings.Join(args, " ")) cmd := exec.Command( //nolint:gosec - locateExecutable(s.execBinary), + locateExecutable(s.ExecBinary), args..., ) - cmd.Dir = workDir + cmd.Dir = WorkDir s.watchLogs(i, cmd) require.NoError(t, cmd.Start(), "node %d", i) - r[i] = cmd.Wait + + pid := cmd.Process.Pid + s.pidsLock.Lock() + s.pids[pid] = struct{}{} + s.pidsLock.Unlock() + s.Logf("Node started: %d\n", pid) + + // cleanup when stopped + go func(pid int) { + _ = cmd.Wait() // blocks until shutdown + s.pidsLock.Lock() + delete(s.pids, pid) + s.pidsLock.Unlock() + s.Logf("Node stopped: %d\n", pid) + }(pid) }) - return r } -func (s SystemUnderTest) withEachNodeHome(cb func(i int, home string)) { +func (s *SystemUnderTest) withEachNodeHome(cb func(i int, home string)) { for i := 0; i < s.nodesCount; i++ { cb(i, s.nodePath(i)) } } // nodePath returns the path of the node within the work dir. not absolute -func (s SystemUnderTest) nodePath(i int) string { - return fmt.Sprintf("%s/node%d/%s", s.outputDir, i, s.execBinary) +func (s *SystemUnderTest) nodePath(i int) string { + return fmt.Sprintf("%s/node%d/%s", s.outputDir, i, s.projectName) } -func (s SystemUnderTest) Log(msg string) { +func (s *SystemUnderTest) Log(msg string) { if s.verbose { - fmt.Fprint(s.out, msg) + _, _ = fmt.Fprint(s.out, msg) } } -func (s SystemUnderTest) Logf(msg string, args ...interface{}) { +func (s *SystemUnderTest) Logf(msg string, args ...interface{}) { s.Log(fmt.Sprintf(msg, args...)) } -func (s SystemUnderTest) RPCClient(t *testing.T) RPCClient { +func (s *SystemUnderTest) RPCClient(t *testing.T) RPCClient { return NewRPCClient(t, s.rpcAddr) } -func (s SystemUnderTest) AllPeers(t *testing.T) []string { +func (s *SystemUnderTest) AllPeers(t *testing.T) []string { result := make([]string, s.nodesCount) for i, n := range s.AllNodes(t) { result[i] = n.PeerAddr() @@ -521,7 +613,7 @@ func (s SystemUnderTest) AllPeers(t *testing.T) []string { return result } -func (s SystemUnderTest) AllNodes(t *testing.T) []Node { +func (s *SystemUnderTest) AllNodes(t *testing.T) []Node { result := make([]Node, s.nodesCount) outs := s.ForEachNodeExecAndWait(t, []string{"tendermint", "show-node-id"}) ip, err := server.ExternalIP() @@ -554,20 +646,20 @@ func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumb // prepare new node moniker := fmt.Sprintf("node%d", nodeNumber) args := []string{"init", moniker, "--home", nodePath, "--overwrite"} - s.Logf("Execute `%s %s`\n", s.execBinary, strings.Join(args, " ")) + s.Logf("Execute `%s %s`\n", s.ExecBinary, strings.Join(args, " ")) cmd := exec.Command( //nolint:gosec - locateExecutable(s.execBinary), + locateExecutable(s.ExecBinary), args..., ) - cmd.Dir = workDir + cmd.Dir = WorkDir s.watchLogs(nodeNumber, cmd) require.NoError(t, cmd.Run(), "failed to start node with id %d", nodeNumber) require.NoError(t, saveGenesis(nodePath, []byte(s.ReadGenesisJSON(t)))) // quick hack: copy config and overwrite by start params - configFile := filepath.Join(workDir, nodePath, "config", "config.toml") + configFile := filepath.Join(WorkDir, nodePath, "config", "config.toml") _ = os.Remove(configFile) - _, err := copyFile(filepath.Join(workDir, s.nodePath(0), "config", "config.toml"), configFile) + _, err := copyFile(filepath.Join(WorkDir, s.nodePath(0), "config", "config.toml"), configFile) require.NoError(t, err) // start node @@ -591,12 +683,12 @@ func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumb "--log_level=info", "--home", nodePath, } - s.Logf("Execute `%s %s`\n", s.execBinary, strings.Join(args, " ")) + s.Logf("Execute `%s %s`\n", s.ExecBinary, strings.Join(args, " ")) cmd = exec.Command( //nolint:gosec - locateExecutable(s.execBinary), + locateExecutable(s.ExecBinary), args..., ) - cmd.Dir = workDir + cmd.Dir = WorkDir s.watchLogs(nodeNumber, cmd) require.NoError(t, cmd.Start(), "node %d", nodeNumber) return node @@ -607,6 +699,13 @@ func (s *SystemUnderTest) NewEventListener(t *testing.T) *EventListener { return NewEventListener(t, s.rpcAddr) } +// is any process let running? +func (s *SystemUnderTest) anyNodeRunning() bool { + s.pidsLock.RLock() + defer s.pidsLock.RUnlock() + return len(s.pids) != 0 +} + type Node struct { ID string IP string @@ -651,7 +750,7 @@ func NewEventListener(t *testing.T, rpcAddr string) *EventListener { return &EventListener{client: httpClient, t: t} } -var defaultWaitTime = 30 * time.Second +var DefaultWaitTime = 30 * time.Second type ( CleanupFn func() @@ -666,7 +765,7 @@ func (l *EventListener) Subscribe(query string, cb EventConsumer) func() { eventsChan, err := l.client.WSEvents.Subscribe(ctx, "testing", query) require.NoError(l.t, err) cleanup := func() { - ctx, _ := context.WithTimeout(ctx, defaultWaitTime) //nolint:govet + ctx, _ := context.WithTimeout(ctx, DefaultWaitTime) //nolint:govet go l.client.WSEvents.Unsubscribe(ctx, "testing", query) //nolint:errcheck done() } @@ -684,7 +783,7 @@ func (l *EventListener) Subscribe(query string, cb EventConsumer) func() { // For query syntax See https://docs.cosmos.network/master/core/events.html#subscribing-to-events func (l *EventListener) AwaitQuery(query string, optMaxWaitTime ...time.Duration) *ctypes.ResultEvent { c, result := CaptureSingleEventConsumer() - maxWaitTime := defaultWaitTime + maxWaitTime := DefaultWaitTime if len(optMaxWaitTime) != 0 { maxWaitTime = optMaxWaitTime[0] } @@ -746,7 +845,7 @@ func CaptureSingleEventConsumer() (EventConsumer, *ctypes.ResultEvent) { // // assert.Len(t, done(), 1) // then verify your assumption func CaptureAllEventsConsumer(t *testing.T, optMaxWaitTime ...time.Duration) (c EventConsumer, done func() []ctypes.ResultEvent) { - maxWaitTime := defaultWaitTime + maxWaitTime := DefaultWaitTime if len(optMaxWaitTime) != 0 { maxWaitTime = optMaxWaitTime[0] } @@ -774,17 +873,17 @@ func CaptureAllEventsConsumer(t *testing.T, optMaxWaitTime ...time.Duration) (c } // restoreOriginalGenesis replace nodes genesis by the one created on setup -func restoreOriginalGenesis(t *testing.T, s SystemUnderTest) { - src := filepath.Join(workDir, s.nodePath(0), "config", "genesis.json.orig") +func restoreOriginalGenesis(t *testing.T, s *SystemUnderTest) { + src := filepath.Join(WorkDir, s.nodePath(0), "config", "genesis.json.orig") s.setGenesis(t, src) } // restoreOriginalKeyring replaces test keyring with original -func restoreOriginalKeyring(t *testing.T, s SystemUnderTest) { - dest := filepath.Join(workDir, s.outputDir, "keyring-test") +func restoreOriginalKeyring(t *testing.T, s *SystemUnderTest) { + dest := filepath.Join(WorkDir, s.outputDir, "keyring-test") require.NoError(t, os.RemoveAll(dest)) for i := 0; i < s.initialNodesCount; i++ { - src := filepath.Join(workDir, s.nodePath(i), "keyring-test") + src := filepath.Join(WorkDir, s.nodePath(i), "keyring-test") require.NoError(t, copyFilesInDir(src, dest)) } } @@ -812,7 +911,7 @@ func copyFilesInDir(src, dest string) error { if err != nil { return fmt.Errorf("mkdirs: %s", err) } - fs, err := ioutil.ReadDir(src) + fs, err := os.ReadDir(src) if err != nil { return fmt.Errorf("read dir: %s", err) } @@ -828,7 +927,7 @@ func copyFilesInDir(src, dest string) error { } func storeTempFile(t *testing.T, content []byte) *os.File { - out, err := ioutil.TempFile(t.TempDir(), "genesis") + out, err := os.CreateTemp(t.TempDir(), "genesis") require.NoError(t, err) _, err = io.Copy(out, bytes.NewReader(content)) require.NoError(t, err) diff --git a/tests/system/upgrade_test.go b/tests/system/upgrade_test.go new file mode 100644 index 0000000000..9196862756 --- /dev/null +++ b/tests/system/upgrade_test.go @@ -0,0 +1,155 @@ +//go:build system_test && linux + +package system + +import ( + "archive/tar" + "compress/gzip" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" +) + +func TestChainUpgrade(t *testing.T) { + // Scenario: + // start a legacy chain with some state + // when a chain upgrade proposal is executed + // then the chain upgrades successfully + + legacyBinary := FetchExecutable(t, "v0.41.0") + t.Logf("+++ legacy binary: %s\n", legacyBinary) + currentBranchBinary := sut.ExecBinary + sut.ExecBinary = legacyBinary + sut.SetupChain() + votingPeriod := 5 * time.Second // enough time to vote + sut.ModifyGenesisJSON(t, SetGovVotingPeriod(t, votingPeriod)) + + const ( + upgradeHeight int64 = 22 + upgradeName = "v0.50" + ) + + sut.StartChain(t, fmt.Sprintf("--halt-height=%d", upgradeHeight)) + + cli := NewWasmdCLI(t, sut, verbose) + + // set some state to ensure that migrations work + verifierAddr := cli.AddKey("verifier") + beneficiary := randomBech32Addr() + cli.FundAddress(verifierAddr, "1000stake") + + t.Log("Launch hackatom contract") + codeID := cli.WasmStore("./testdata/hackatom.wasm.gzip") + initMsg := fmt.Sprintf(`{"verifier":%q, "beneficiary":%q}`, verifierAddr, beneficiary) + contractAddr := cli.WasmInstantiate(codeID, initMsg, "--admin="+defaultSrcAddr, "--label=label1", "--from="+defaultSrcAddr, "--amount=1000000stake") + + gotRsp := cli.QuerySmart(contractAddr, `{"verifier":{}}`) + require.Equal(t, fmt.Sprintf(`{"data":{"verifier":"%s"}}`, verifierAddr), gotRsp) + + // submit upgrade proposal + proposal := fmt.Sprintf(` +{ + "messages": [ + { + "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + "authority": "wasm10d07y265gmmuvt4z0w9aw880jnsr700js7zslc", + "plan": { + "name": %q, + "height": "%d" + } + } + ], + "metadata": "ipfs://CID", + "deposit": "100000000stake", + "title": "my upgrade", + "summary": "testing" +}`, upgradeName, upgradeHeight) + proposalID := cli.SubmitAndVoteGovProposal(proposal) + t.Logf("current_height: %d\n", sut.currentHeight) + raw := cli.CustomQuery("q", "gov", "proposal", proposalID) + t.Log(raw) + sut.AwaitBlockHeight(t, upgradeHeight-1) + t.Logf("current_height: %d\n", sut.currentHeight) + raw = cli.CustomQuery("q", "gov", "proposal", proposalID) + proposalStatus := gjson.Get(raw, "status").String() + require.Equal(t, "PROPOSAL_STATUS_PASSED", proposalStatus, raw) + + t.Log("waiting for upgrade info") + sut.AwaitUpgradeInfo(t) + sut.StopChain() + + t.Log("Upgrade height was reached. Upgrading chain") + sut.ExecBinary = currentBranchBinary + sut.StartChain(t) + cli = NewWasmdCLI(t, sut, verbose) + + // ensure that state matches expectations + gotRsp = cli.QuerySmart(contractAddr, `{"verifier":{}}`) + require.Equal(t, fmt.Sprintf(`{"data":{"verifier":"%s"}}`, verifierAddr), gotRsp) + // and contract execution works as expected + RequireTxSuccess(t, cli.WasmExecute(contractAddr, `{"release":{}}`, verifierAddr)) + assert.Equal(t, int64(1_000_000), cli.QueryBalance(beneficiary, "stake")) +} + +const cacheDir = "binaries" + +// FetchExecutable to download and extract tar.gz for linux +func FetchExecutable(t *testing.T, version string) string { + // use local cache + cacheFolder := filepath.Join(WorkDir, cacheDir) + err := os.MkdirAll(cacheFolder, 0o777) + if err != nil && !os.IsExist(err) { + panic(err) + } + + cacheFile := filepath.Join(cacheFolder, fmt.Sprintf("%s_%s", execBinaryName, version)) + if _, err := os.Stat(cacheFile); err == nil { + return cacheFile + } + t.Logf("+++ version not in cache, downloading from github") + + // then download from GH releases: only works with Linux currently as we are not publishing OSX binaries + const releaseUrl = "https://github.com/CosmWasm/wasmd/releases/download/%s/wasmd-%s-linux-amd64.tar.gz" + destDir := t.TempDir() + rsp, err := http.Get(fmt.Sprintf(releaseUrl, version, version)) + require.NoError(t, err) + defer rsp.Body.Close() + gzr, err := gzip.NewReader(rsp.Body) + require.NoError(t, err) + defer gzr.Close() + tr := tar.NewReader(gzr) + + var workFileName string + for { + header, err := tr.Next() + switch { + case err == io.EOF: + require.NotEmpty(t, workFileName) + require.NoError(t, os.Rename(workFileName, cacheFile)) + return cacheFile + case err != nil: + require.NoError(t, err) + case header == nil: + continue + } + workFileName = filepath.Join(destDir, header.Name) + switch header.Typeflag { + case tar.TypeDir: + t.Fatalf("unexpected type") + case tar.TypeReg: + f, err := os.OpenFile(workFileName, os.O_CREATE|os.O_RDWR, os.FileMode(0o755)) + require.NoError(t, err) + _, err = io.Copy(f, tr) + require.NoError(t, err) + _ = f.Close() + } + } +} diff --git a/x/wasm/alias.go b/x/wasm/alias.go index fbe2656fa8..f53463b993 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -97,8 +97,6 @@ var ( // variable aliases // Deprecated: Do not use. - ModuleCdc = types.ModuleCdc - // Deprecated: Do not use. DefaultCodespace = types.DefaultCodespace // Deprecated: Do not use. ErrCreateFailed = types.ErrCreateFailed diff --git a/x/wasm/client/cli/genesis_msg.go b/x/wasm/client/cli/genesis_msg.go index f636ad4e46..4b2f054bc2 100644 --- a/x/wasm/client/cli/genesis_msg.go +++ b/x/wasm/client/cli/genesis_msg.go @@ -8,17 +8,18 @@ import ( "errors" "fmt" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/spf13/cobra" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cobra" "github.com/CosmWasm/wasmd/x/wasm/ioutils" "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -354,12 +355,12 @@ func hasAccountBalance(cmd *cobra.Command, appState map[string]json.RawMessage, // GenesisData contains raw and unmarshalled data from the genesis file type GenesisData struct { GenesisFile string - GenDoc *tmtypes.GenesisDoc + GenDoc *genutiltypes.AppGenesis AppState map[string]json.RawMessage WasmModuleState *types.GenesisState } -func NewGenesisData(genesisFile string, genDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage, wasmModuleState *types.GenesisState) *GenesisData { +func NewGenesisData(genesisFile string, genDoc *genutiltypes.AppGenesis, appState map[string]json.RawMessage, wasmModuleState *types.GenesisState) *GenesisData { return &GenesisData{GenesisFile: genesisFile, GenDoc: genDoc, AppState: appState, WasmModuleState: wasmModuleState} } @@ -425,13 +426,13 @@ func (x DefaultGenesisIO) AlterWasmModuleState(cmd *cobra.Command, callback func clientCtx := client.GetClientContextFromCmd(cmd) wasmGenStateBz, err := clientCtx.Codec.MarshalJSON(g.WasmModuleState) if err != nil { - return sdkerrors.Wrap(err, "marshal wasm genesis state") + return errorsmod.Wrap(err, "marshal wasm genesis state") } g.AppState[types.ModuleName] = wasmGenStateBz appStateJSON, err := json.Marshal(g.AppState) if err != nil { - return sdkerrors.Wrap(err, "marshal application genesis state") + return errorsmod.Wrap(err, "marshal application genesis state") } g.GenDoc.AppState = appStateJSON diff --git a/x/wasm/client/cli/genesis_msg_test.go b/x/wasm/client/cli/genesis_msg_test.go index 416d2461fa..2e38dffdfe 100644 --- a/x/wasm/client/cli/genesis_msg_test.go +++ b/x/wasm/client/cli/genesis_msg_test.go @@ -7,8 +7,14 @@ import ( "path" "testing" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "cosmossdk.io/log" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -22,10 +28,6 @@ import ( genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -646,7 +648,6 @@ func TestGetAllContracts(t *testing.T) { } func setupGenesis(t *testing.T, wasmGenesis types.GenesisState, myWellFundedAccount string) string { - appCodec := keeper.MakeEncodingConfig(t).Codec homeDir := t.TempDir() @@ -659,18 +660,15 @@ func setupGenesis(t *testing.T, wasmGenesis types.GenesisState, myWellFundedAcco bankGenesis.Balances = append(bankGenesis.Balances, banktypes.Balance{ // add a balance for the default sender account Address: myWellFundedAccount, - Coins: sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10000000000))), + Coins: sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(10000000000))), }) appState[banktypes.ModuleName] = appCodec.MustMarshalJSON(bankGenesis) appState[stakingtypes.ModuleName] = appCodec.MustMarshalJSON(stakingtypes.DefaultGenesisState()) appStateBz, err := json.Marshal(appState) require.NoError(t, err) - genDoc := tmtypes.GenesisDoc{ - ChainID: "testing", - AppState: appStateBz, - } - err = genutil.ExportGenesisFile(&genDoc, genFilename) + genDoc := genutiltypes.NewAppGenesisWithVersion("testing", appStateBz) + err = genutil.ExportGenesisFile(genDoc, genFilename) require.NoError(t, err) return homeDir @@ -678,7 +676,7 @@ func setupGenesis(t *testing.T, wasmGenesis types.GenesisState, myWellFundedAcco func executeCmdWithContext(t *testing.T, homeDir string, cmd *cobra.Command) error { logger := log.NewNopLogger() - cfg, err := genutiltest.CreateDefaultTendermintConfig(homeDir) + cfg, err := genutiltest.CreateDefaultCometConfig(homeDir) require.NoError(t, err) appCodec := keeper.MakeEncodingConfig(t).Codec serverCtx := server.NewContext(viper.New(), cfg, logger) diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go index 928dee6b69..9b95ae949d 100644 --- a/x/wasm/client/cli/gov_tx.go +++ b/x/wasm/client/cli/gov_tx.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - wasmvm "github.com/CosmWasm/wasmvm" - "github.com/docker/distribution/reference" + wasmvm "github.com/CosmWasm/wasmvm/v2" + "github.com/distribution/reference" "github.com/pkg/errors" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -62,7 +62,7 @@ func ProposalStoreCodeCmd() *cobra.Command { Short: "Submit a wasm binary proposal", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -80,13 +80,10 @@ func ProposalStoreCodeCmd() *cobra.Command { return err } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -154,7 +151,7 @@ func ProposalInstantiateContractCmd() *cobra.Command { Short: "Submit an instantiate wasm contract proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -173,13 +170,10 @@ func ProposalInstantiateContractCmd() *cobra.Command { return err } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -201,7 +195,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { Short: "Submit an instantiate wasm contract proposal with predictable address", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -220,13 +214,10 @@ func ProposalInstantiateContract2Cmd() *cobra.Command { return err } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -250,7 +241,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { Short: "Submit a store and instantiate wasm contract proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -341,12 +332,12 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command { Msg: []byte(args[1]), Funds: amount, } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -375,7 +366,7 @@ func ProposalMigrateContractCmd() *cobra.Command { Short: "Submit a migrate wasm contract to a new code version proposal", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -394,13 +385,10 @@ func ProposalMigrateContractCmd() *cobra.Command { return err } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -417,7 +405,7 @@ func ProposalExecuteContractCmd() *cobra.Command { Short: "Submit a execute wasm contract proposal (run by any address)", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -448,12 +436,12 @@ func ProposalExecuteContractCmd() *cobra.Command { Msg: execMsg, Funds: funds, } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -474,7 +462,7 @@ func ProposalSudoContractCmd() *cobra.Command { Short: "Submit a sudo wasm contract proposal (to call privileged commands)", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -493,12 +481,12 @@ func ProposalSudoContractCmd() *cobra.Command { Contract: args[0], Msg: []byte(args[1]), } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -517,7 +505,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { Short: "Submit a new admin for a contract proposal", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -531,13 +519,13 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { return errors.New("authority address is required") } - src := parseUpdateContractAdminArgs(args, authority) - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + src, err := parseUpdateContractAdminArgs(args, authority) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -556,7 +544,7 @@ func ProposalClearContractAdminCmd() *cobra.Command { Short: "Submit a clear admin for a contract to prevent further migrations proposal", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -574,12 +562,12 @@ func ProposalClearContractAdminCmd() *cobra.Command { Sender: authority, Contract: args[0], } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -598,7 +586,7 @@ func ProposalPinCodesCmd() *cobra.Command { Short: "Submit a pin code proposal for pinning a code to cache", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -621,12 +609,12 @@ func ProposalPinCodesCmd() *cobra.Command { Authority: authority, CodeIDs: codeIds, } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -657,7 +645,7 @@ func ProposalUnpinCodesCmd() *cobra.Command { Short: "Submit a unpin code proposal for unpinning a code to cache", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -679,12 +667,12 @@ func ProposalUnpinCodesCmd() *cobra.Command { Authority: authority, CodeIDs: codeIds, } - - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) - if err != nil { + if err = msg.ValidateBasic(); err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { + + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) + if err != nil { return err } @@ -763,7 +751,7 @@ Example: $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm,%s1vx8knpllrj7n963p9ttd80w47kpacrhuts497x `, version.AppName, bech32Prefix, bech32Prefix)), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -785,20 +773,21 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1 msgs := make([]sdk.Msg, len(updates)) for i, update := range updates { permission := update.InstantiatePermission - msgs[i] = &types.MsgUpdateInstantiateConfig{ + msg := &types.MsgUpdateInstantiateConfig{ Sender: authority, CodeID: update.CodeID, NewInstantiatePermission: &permission, } + if err = msg.ValidateBasic(); err != nil { + return err + } + msgs[i] = msg } - proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -815,7 +804,7 @@ func ProposalAddCodeUploadParamsAddresses() *cobra.Command { Short: "Submit an add code upload params addresses proposal to add addresses to code upload config params", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -834,13 +823,10 @@ func ProposalAddCodeUploadParamsAddresses() *cobra.Command { Addresses: args, } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -857,7 +843,7 @@ func ProposalRemoveCodeUploadParamsAddresses() *cobra.Command { Short: "Submit a remove code upload params addresses proposal to remove addresses from code upload config params", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -876,13 +862,10 @@ func ProposalRemoveCodeUploadParamsAddresses() *cobra.Command { Addresses: args, } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, @@ -899,35 +882,41 @@ func addCommonProposalFlags(cmd *cobra.Command) { cmd.Flags().String(cli.FlagSummary, "", "Summary of proposal") cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") cmd.Flags().String(flagAuthority, DefaultGovAuthority.String(), "The address of the governance account. Default is the sdk gov module account") + cmd.Flags().Bool(flagExpedite, false, "Expedite proposals have shorter voting period but require higher voting threshold") } -func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) { +func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, bool, error) { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { - return client.Context{}, "", "", nil, err + return client.Context{}, "", "", nil, false, err } proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) if err != nil { - return clientCtx, proposalTitle, "", nil, err + return clientCtx, proposalTitle, "", nil, false, err } summary, err := cmd.Flags().GetString(cli.FlagSummary) if err != nil { - return client.Context{}, proposalTitle, summary, nil, err + return client.Context{}, proposalTitle, summary, nil, false, err } depositArg, err := cmd.Flags().GetString(cli.FlagDeposit) if err != nil { - return client.Context{}, proposalTitle, summary, nil, err + return client.Context{}, proposalTitle, summary, nil, false, err } deposit, err := sdk.ParseCoinsNormalized(depositArg) if err != nil { - return client.Context{}, proposalTitle, summary, deposit, err + return client.Context{}, proposalTitle, summary, deposit, false, err } - return clientCtx, proposalTitle, summary, deposit, nil + expedite, err := cmd.Flags().GetBool(flagExpedite) + if err != nil { + return client.Context{}, proposalTitle, summary, deposit, false, err + } + + return clientCtx, proposalTitle, summary, deposit, expedite, nil } func ProposalStoreAndMigrateContractCmd() *cobra.Command { @@ -936,7 +925,7 @@ func ProposalStoreAndMigrateContractCmd() *cobra.Command { Short: "Submit a store and migrate wasm contract proposal", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, proposalTitle, summary, deposit, err := getProposalInfo(cmd) + clientCtx, proposalTitle, summary, deposit, expedite, err := getProposalInfo(cmd) if err != nil { return err } @@ -963,13 +952,10 @@ func ProposalStoreAndMigrateContractCmd() *cobra.Command { Contract: args[1], } - proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary) + proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&msg}, deposit, clientCtx.GetFromAddress().String(), "", proposalTitle, summary, expedite) if err != nil { return err } - if err = proposalMsg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg) }, diff --git a/x/wasm/client/cli/new_tx.go b/x/wasm/client/cli/new_tx.go index 9fe212eebd..5d54602aa3 100644 --- a/x/wasm/client/cli/new_tx.go +++ b/x/wasm/client/cli/new_tx.go @@ -31,9 +31,6 @@ func MigrateContractCmd() *cobra.Command { if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { - return nil - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, SilenceUsage: true, @@ -57,7 +54,7 @@ func parseMigrateContractArgs(args []string, sender string) (types.MsgMigrateCon CodeID: codeID, Msg: []byte(migrateMsg), } - return msg, nil + return msg, msg.ValidateBasic() } // UpdateContractAdminCmd sets an new admin for a contract @@ -73,8 +70,8 @@ func UpdateContractAdminCmd() *cobra.Command { return err } - msg := parseUpdateContractAdminArgs(args, clientCtx.GetFromAddress().String()) - if err := msg.ValidateBasic(); err != nil { + msg, err := parseUpdateContractAdminArgs(args, clientCtx.GetFromAddress().String()) + if err != nil { return err } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) @@ -85,13 +82,13 @@ func UpdateContractAdminCmd() *cobra.Command { return cmd } -func parseUpdateContractAdminArgs(args []string, sender string) types.MsgUpdateAdmin { +func parseUpdateContractAdminArgs(args []string, sender string) (types.MsgUpdateAdmin, error) { msg := types.MsgUpdateAdmin{ Sender: sender, Contract: args[0], NewAdmin: args[1], } - return msg + return msg, msg.ValidateBasic() } // ClearContractAdminCmd clears an admin for a contract diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index 7dd820e3fb..89f6790327 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -10,7 +10,7 @@ import ( "os" "strconv" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -78,32 +77,30 @@ func GetCmdBuildAddress() *cobra.Command { Aliases: []string{"address"}, Args: cobra.RangeArgs(3, 4), RunE: func(cmd *cobra.Command, args []string) error { - codeHash, err := hex.DecodeString(args[0]) - if err != nil { - return fmt.Errorf("code-hash: %s", err) - } - creator, err := sdk.AccAddressFromBech32(args[1]) + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { - return fmt.Errorf("creator: %s", err) - } - salt, err := hex.DecodeString(args[2]) - switch { - case err != nil: - return fmt.Errorf("salt: %s", err) - case len(salt) == 0: - return errors.New("empty salt") + return err } - if len(args) == 3 { - cmd.Println(keeper.BuildContractAddressPredictable(codeHash, creator, salt, []byte{}).String()) - return nil + var initArgs []byte + if len(args) == 4 { + initArgs = types.RawContractMessage(args[3]) } - msg := types.RawContractMessage(args[3]) - if err := msg.ValidateBasic(); err != nil { - return fmt.Errorf("init message: %s", err) + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.BuildAddress( + context.Background(), + &types.QueryBuildAddressRequest{ + CodeHash: args[0], + CreatorAddress: args[1], + Salt: args[2], + InitArgs: initArgs, + }, + ) + if err != nil { + return err } - cmd.Println(keeper.BuildContractAddressPredictable(codeHash, creator, salt, msg).String()) - return nil + return clientCtx.PrintProto(res) }, SilenceUsage: true, } diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 49a326d333..f5499af965 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -47,6 +47,7 @@ const ( flagAllowAllMsgs = "allow-all-messages" flagNoTokenTransfer = "no-token-transfer" flagAuthority = "authority" + flagExpedite = "expedite" ) // GetTxCmd returns the transaction commands for this module @@ -91,9 +92,6 @@ func StoreCodeCmd() *cobra.Command { if err != nil { return err } - if err = msg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, SilenceUsage: true, @@ -132,7 +130,7 @@ func parseStoreCodeArgs(file, sender string, flags *flag.FlagSet) (types.MsgStor WASMByteCode: wasm, InstantiatePermission: perm, } - return msg, nil + return msg, msg.ValidateBasic() } func parseAccessConfigFlags(flags *flag.FlagSet) (*types.AccessConfig, error) { @@ -218,9 +216,6 @@ $ %s tx wasm instantiate 1 '{"foo":"bar"}' --admin="$(%s keys show mykey -a)" \ if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, SilenceUsage: true, @@ -279,9 +274,6 @@ $ %s tx wasm instantiate2 1 '{"foo":"bar"}' $(echo -n "testing" | xxd -ps) --adm Salt: salt, FixMsg: fixMsg, } - if err := msg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, SilenceUsage: true, @@ -363,7 +355,7 @@ func parseInstantiateArgs(rawCodeID, initMsg string, kr keyring.Keyring, sender Msg: []byte(initMsg), Admin: adminStr, } - return &msg, nil + return &msg, msg.ValidateBasic() } // ExecuteContractCmd will instantiate a contract from previously uploaded code. @@ -383,9 +375,6 @@ func ExecuteContractCmd() *cobra.Command { if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, SilenceUsage: true, @@ -431,15 +420,15 @@ func GrantCmd() *cobra.Command { func GrantAuthorizationCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "contract [message_type=\"execution\"|\"migration\"] [grantee] [contract_addr_bech32] --allow-raw-msgs [msg1,msg2,...] --allow-msg-keys [key1,key2,...] --allow-all-messages", + Use: "contract [grantee] [message_type=\"execution\"|\"migration\"] [contract_addr_bech32] --allow-raw-msgs [msg1,msg2,...] --allow-msg-keys [key1,key2,...] --allow-all-messages", Short: "Grant authorization to interact with a contract on behalf of you", Long: fmt.Sprintf(`Grant authorization to an address. Examples: -$ %s tx grant contract execution --allow-all-messages --max-calls 1 --no-token-transfer --expiration 1667979596 +$ %s tx grant contract execution --allow-all-messages --max-calls 1 --no-token-transfer --expiration 1667979596 -$ %s tx grant contract execution --allow-all-messages --max-funds 100000uwasm --expiration 1667979596 +$ %s tx grant contract execution --allow-all-messages --max-funds 100000uwasm --expiration 1667979596 -$ %s tx grant contract execution --allow-all-messages --max-calls 5 --max-funds 100000uwasm --expiration 1667979596 +$ %s tx grant contract execution --allow-all-messages --max-calls 5 --max-funds 100000uwasm --expiration 1667979596 `, version.AppName, version.AppName, version.AppName), Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/wasm/client/cli/utils.go b/x/wasm/client/cli/utils.go index f6c0c6bf88..97adca5635 100644 --- a/x/wasm/client/cli/utils.go +++ b/x/wasm/client/cli/utils.go @@ -14,7 +14,7 @@ import ( func ExtendUnsafeResetAllCmd(rootCmd *cobra.Command) { unsafeResetCmd := tmcmd.ResetAllCmd.Use for _, branchCmd := range rootCmd.Commands() { - if branchCmd.Use != "tendermint" { + if branchCmd.Use != "comet" { continue } for _, cmd := range branchCmd.Commands() { diff --git a/x/wasm/common_test.go b/x/wasm/common_test.go index 202770aa60..aa507ee429 100644 --- a/x/wasm/common_test.go +++ b/x/wasm/common_test.go @@ -14,7 +14,6 @@ const firstCodeID = 1 // ensure store code returns the expected response func assertStoreCodeResponse(t *testing.T, data []byte, expected uint64) { - t.Helper() var pStoreResp types.MsgStoreCodeResponse require.NoError(t, pStoreResp.Unmarshal(data)) require.Equal(t, pStoreResp.CodeID, expected) @@ -22,7 +21,6 @@ func assertStoreCodeResponse(t *testing.T, data []byte, expected uint64) { // ensure execution returns the expected data func assertExecuteResponse(t *testing.T, data, expected []byte) { - t.Helper() var pExecResp types.MsgExecuteContractResponse require.NoError(t, pExecResp.Unmarshal(data)) require.Equal(t, pExecResp.Data, expected) @@ -30,7 +28,6 @@ func assertExecuteResponse(t *testing.T, data, expected []byte) { // ensures this returns a valid bech32 address and returns it func parseInitResponse(t *testing.T, data []byte) string { - t.Helper() var pInstResp types.MsgInstantiateContractResponse require.NoError(t, pInstResp.Unmarshal(data)) require.NotEmpty(t, pInstResp.Address) diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 0197a03779..45adcf4d19 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -3,16 +3,16 @@ package wasm import ( "math" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/x/wasm/ibc_integration_test.go b/x/wasm/ibc_integration_test.go index 421bdf33a5..d268a8c720 100644 --- a/x/wasm/ibc_integration_test.go +++ b/x/wasm/ibc_integration_test.go @@ -1,13 +1,14 @@ package wasm_test import ( + "encoding/json" "testing" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -51,8 +52,10 @@ func TestOnChanOpenInitVersion(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { myContract := &wasmtesting.MockIBCContractCallbacks{ - IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { - return spec.contractRsp, 0, nil + IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { + return &wasmvmtypes.IBCChannelOpenResult{ + Ok: spec.contractRsp, + }, 0, nil }, } var ( @@ -67,10 +70,9 @@ func TestOnChanOpenInitVersion(t *testing.T) { appA = chainA.App.(*app.WasmApp) contractInfo = appA.WasmKeeper.GetContractInfo(chainA.GetContext(), myContractAddr) ) - path := wasmibctesting.NewPath(chainA, chainB) - coordinator.SetupConnections(path) - + coordinator.SetupClients(path) + coordinator.CreateConnections(path) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: contractInfo.IBCPortID, Version: spec.startVersion, @@ -110,8 +112,10 @@ func TestOnChanOpenTryVersion(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { myContract := &wasmtesting.MockIBCContractCallbacks{ - IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { - return spec.contractRsp, 0, nil + IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { + return &wasmvmtypes.IBCChannelOpenResult{ + Ok: spec.contractRsp, + }, 0, nil }, } var ( @@ -190,8 +194,9 @@ func TestOnIBCPacketReceive(t *testing.T) { myMockContractAddr := chainA.SeedNewContractInstance() // setups env but uses mock contract // setup chain B contracts - reflectID := chainB.StoreCodeFile("./keeper/testdata/reflect.wasm").CodeID - initMsg := wasmkeeper.IBCReflectInitMsg{ReflectCodeID: reflectID}.GetBytes(t) + reflectID := chainB.StoreCodeFile("./keeper/testdata/reflect_1_5.wasm").CodeID + initMsg, err := json.Marshal(wasmkeeper.IBCReflectInitMsg{ReflectCodeID: reflectID}) + require.NoError(t, err) codeID := chainB.StoreCodeFile("./keeper/testdata/ibc_reflect.wasm").CodeID ibcReflectContractAddr := chainB.InstantiateContract(codeID, initMsg) @@ -221,7 +226,7 @@ func TestOnIBCPacketReceive(t *testing.T) { require.Equal(t, 1, len(chainA.PendingSendPackets)) require.Equal(t, 0, len(chainB.PendingSendPackets)) - err := coord.RelayAndAckPendingPackets(path) + err = coord.RelayAndAckPendingPackets(path) // then if spec.expPacketNotHandled { @@ -248,11 +253,11 @@ type captureAckTestContractEngine struct { // NewCaptureAckTestContractEngine constructor func NewCaptureAckTestContractEngine() *captureAckTestContractEngine { m := wasmtesting.NewIBCContractMockWasmEngine(&wasmtesting.MockIBCContractCallbacks{ - IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { - return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil + IBCChannelOpenFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { + return &wasmvmtypes.IBCChannelOpenResult{Ok: &wasmvmtypes.IBC3ChannelOpenResponse{}}, 0, nil }, - IBCChannelConnectFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { - return &wasmvmtypes.IBCBasicResponse{}, 0, nil + IBCChannelConnectFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil }, }) return &captureAckTestContractEngine{m} @@ -262,18 +267,20 @@ func NewCaptureAckTestContractEngine() *captureAckTestContractEngine { func (x *captureAckTestContractEngine) SubmitIBCPacket(t *testing.T, path *wasmibctesting.Path, chainA *wasmibctesting.TestChain, senderContractAddr sdk.AccAddress, packetData []byte) *[]byte { t.Helper() // prepare a bridge to send an ibc packet by an ordinary wasm execute message - x.MockWasmEngine.ExecuteFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &wasmvmtypes.SendPacketMsg{ - ChannelID: path.EndpointA.ChannelID, Data: executeMsg, Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{Revision: 1, Height: 10000000}}, - }}}}}, + x.MockWasmEngine.ExecuteFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &wasmvmtypes.SendPacketMsg{ + ChannelID: path.EndpointA.ChannelID, Data: executeMsg, Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{Revision: 1, Height: 10000000}}, + }}}}}, + }, }, 0, nil } // capture acknowledgement var gotAck []byte - x.MockWasmEngine.IBCPacketAckFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { + x.MockWasmEngine.IBCPacketAckFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { gotAck = msg.Acknowledgement.Data - return &wasmvmtypes.IBCBasicResponse{}, 0, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } // start the process diff --git a/x/wasm/ibc_reflect_test.go b/x/wasm/ibc_reflect_test.go index 7151b27150..c73155da9e 100644 --- a/x/wasm/ibc_reflect_test.go +++ b/x/wasm/ibc_reflect_test.go @@ -3,9 +3,9 @@ package wasm_test import ( "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -16,7 +16,7 @@ import ( func TestIBCReflectContract(t *testing.T) { // scenario: // chain A: ibc_reflect_send.wasm - // chain B: reflect.wasm + ibc_reflect.wasm + // chain B: reflect_1_5.wasm + ibc_reflect.wasm // // Chain A "ibc_reflect_send" sends a IBC packet "on channel connect" event to chain B "ibc_reflect" // "ibc_reflect" sends a submessage to "reflect" which is returned as submessage. @@ -32,7 +32,7 @@ func TestIBCReflectContract(t *testing.T) { codeID := chainA.StoreCodeFile("./keeper/testdata/ibc_reflect_send.wasm").CodeID sendContractAddr := chainA.InstantiateContract(codeID, initMsg) - reflectID := chainB.StoreCodeFile("./keeper/testdata/reflect.wasm").CodeID + reflectID := chainB.StoreCodeFile("./keeper/testdata/reflect_1_5.wasm").CodeID initMsg = wasmkeeper.IBCReflectInitMsg{ ReflectCodeID: reflectID, }.GetBytes(t) @@ -116,7 +116,7 @@ type AccountQuery struct { } type AccountResponse struct { - LastUpdateTime uint64 `json:"last_update_time,string"` - RemoteAddr string `json:"remote_addr"` - RemoteBalance wasmvmtypes.Coins `json:"remote_balance"` + LastUpdateTime uint64 `json:"last_update_time,string"` + RemoteAddr string `json:"remote_addr"` + RemoteBalance wasmvmtypes.Array[wasmvmtypes.Coin] `json:"remote_balance"` } diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go index f25622c8ee..032c25f6e0 100644 --- a/x/wasm/ibc_test.go +++ b/x/wasm/ibc_test.go @@ -3,12 +3,12 @@ package wasm import ( "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index 504e82f283..b1425cc7e3 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -1,44 +1,46 @@ package ibctesting import ( + "context" "fmt" "testing" "time" + // simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/tmhash" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmprotoversion "github.com/cometbft/cometbft/proto/tendermint/version" - tmtypes "github.com/cometbft/cometbft/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtprotoversion "github.com/cometbft/cometbft/proto/tendermint/version" + cmttypes "github.com/cometbft/cometbft/types" tmversion "github.com/cometbft/cometbft/version" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - "github.com/cosmos/ibc-go/v7/modules/core/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - "github.com/cosmos/ibc-go/v7/testing/mock" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + "github.com/cosmos/ibc-go/v8/modules/core/types" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/testutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -51,14 +53,16 @@ var MaxAccounts = 10 type SenderAccount struct { SenderPrivKey cryptotypes.PrivKey - SenderAccount authtypes.AccountI + SenderAccount sdk.AccountI } // ChainApp Abstract chain app definition used for testing type ChainApp interface { - abci.Application + servertypes.ABCI AppCodec() codec.Codec - NewContext(isCheckTx bool, header tmproto.Header) sdk.Context + GetContextForFinalizeBlock(txBytes []byte) sdk.Context + NewContextLegacy(isCheckTx bool, header cmtproto.Header) sdk.Context + NewUncachedContext(isCheckTx bool, header cmtproto.Header) sdk.Context LastBlockHeight() int64 LastCommitID() storetypes.CommitID GetBaseApp() *baseapp.BaseApp @@ -72,7 +76,7 @@ type ChainApp interface { GetWasmKeeper() wasmkeeper.Keeper } -// TestChain is a testing struct that wraps a simapp with the last TM Header, the current ABCI +// TestChain is a testing struct that wraps a simapp with the last CMT header, the current ABCI // header and the validators of the TestChain. It also contains a field called ChainID. This // is the clientID that *other* chains use to refer to this TestChain. The SenderAccount // is used for delivering transactions through the application state. @@ -83,25 +87,25 @@ type TestChain struct { Coordinator *Coordinator App ChainApp ChainID string - LastHeader *ibctm.Header // header for last block height committed - CurrentHeader tmproto.Header // header for current block height + LastHeader *ibctm.Header // header for last block height committed + CurrentHeader cmtproto.Header // header for current block height QueryServer types.QueryServer TxConfig client.TxConfig - Codec codec.BinaryCodec + Codec codec.Codec - Vals *tmtypes.ValidatorSet - NextVals *tmtypes.ValidatorSet + Vals *cmttypes.ValidatorSet + NextVals *cmttypes.ValidatorSet // Signers is a map from validator address to the PrivValidator // The map is converted into an array that is the same order as the validators right before signing commit // This ensures that signers will always be in correct order even as validator powers change. // If a test adds a new validator after chain creation, then the signer map must be updated to include // the new PrivValidator entry. - Signers map[string]tmtypes.PrivValidator + Signers map[string]cmttypes.PrivValidator // autogenerated sender private key SenderPrivKey cryptotypes.PrivKey - SenderAccount authtypes.AccountI + SenderAccount sdk.AccountI SenderAccounts []SenderAccount PendingSendPackets []channeltypes.Packet @@ -114,44 +118,41 @@ type PacketAck struct { } // ChainAppFactory abstract factory method that usually implemented by app.SetupWithGenesisValSet -type ChainAppFactory func(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) ChainApp +type ChainAppFactory func(t *testing.T, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) ChainApp // DefaultWasmAppFactory instantiates and sets up the default wasmd app -func DefaultWasmAppFactory(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) ChainApp { - t.Helper() +func DefaultWasmAppFactory(t *testing.T, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) ChainApp { return app.SetupWithGenesisValSet(t, valSet, genAccs, chainID, opts, balances...) } // NewDefaultTestChain initializes a new test chain with a default of 4 validators // Use this function if the tests do not need custom control over the validator set func NewDefaultTestChain(t *testing.T, coord *Coordinator, chainID string, opts ...wasmkeeper.Option) *TestChain { - t.Helper() return NewTestChain(t, coord, DefaultWasmAppFactory, chainID, opts...) } // NewTestChain initializes a new test chain with a default of 4 validators // Use this function if the tests do not need custom control over the validator set func NewTestChain(t *testing.T, coord *Coordinator, appFactory ChainAppFactory, chainID string, opts ...wasmkeeper.Option) *TestChain { - t.Helper() // generate validators private/public key var ( validatorsPerChain = 4 - validators = make([]*tmtypes.Validator, 0, validatorsPerChain) - signersByAddress = make(map[string]tmtypes.PrivValidator, validatorsPerChain) + validators = make([]*cmttypes.Validator, 0, validatorsPerChain) + signersByAddress = make(map[string]cmttypes.PrivValidator, validatorsPerChain) ) for i := 0; i < validatorsPerChain; i++ { - privVal := mock.NewPV() + _, privVal := cmttypes.RandValidator(false, 100) pubKey, err := privVal.GetPubKey() require.NoError(t, err) - validators = append(validators, tmtypes.NewValidator(pubKey, 1)) + validators = append(validators, cmttypes.NewValidator(pubKey, 1)) signersByAddress[pubKey.Address().String()] = privVal } // construct validator set; // Note that the validators are sorted by voting power // or, if equal, by address lexical order - valSet := tmtypes.NewValidatorSet(validators) + valSet := cmttypes.NewValidatorSet(validators) return NewTestChainWithValSet(t, coord, appFactory, chainID, valSet, signersByAddress, opts...) } @@ -171,8 +172,7 @@ func NewTestChain(t *testing.T, coord *Coordinator, appFactory ChainAppFactory, // // CONTRACT: Validator array must be provided in the order expected by Tendermint. // i.e. sorted first by power and then lexicographically by address. -func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAppFactory, chainID string, valSet *tmtypes.ValidatorSet, signers map[string]tmtypes.PrivValidator, opts ...wasmkeeper.Option) *TestChain { - t.Helper() +func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAppFactory, chainID string, valSet *cmttypes.ValidatorSet, signers map[string]cmttypes.PrivValidator, opts ...wasmkeeper.Option) *TestChain { genAccs := []authtypes.GenesisAccount{} genBals := []banktypes.Balance{} senderAccs := []SenderAccount{} @@ -181,7 +181,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAp for i := 0; i < MaxAccounts; i++ { senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), uint64(i), 0) - amount, ok := sdk.NewIntFromString("10000000000000000000") + amount, ok := sdkmath.NewIntFromString("10000000000000000000") require.True(t, ok) // add sender account @@ -204,7 +204,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAp wasmApp := appFactory(t, valSet, genAccs, chainID, opts, genBals...) // create current header and call begin block - header := tmproto.Header{ + header := cmtproto.Header{ ChainID: chainID, Height: 1, Time: coord.CurrentTime.UTC(), @@ -228,7 +228,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAp SenderPrivKey: senderAccs[0].SenderPrivKey, SenderAccount: senderAccs[0].SenderAccount, SenderAccounts: senderAccs, - DefaultMsgFees: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.ZeroInt())), + DefaultMsgFees: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.ZeroInt())), } coord.CommitBlock(chain) @@ -238,7 +238,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, appFactory ChainAp // GetContext returns the current context for the application. func (chain *TestChain) GetContext() sdk.Context { - return chain.App.NewContext(false, chain.CurrentHeader) + return chain.App.NewUncachedContext(false, chain.CurrentHeader) } // QueryProof performs an abci query with the given key and returns the proto encoded merkle proof @@ -257,12 +257,13 @@ func (chain *TestChain) QueryProofAtHeight(key []byte, height int64) ([]byte, cl // QueryProofForStore performs an abci query with the given key and returns the proto encoded merkle proof // for the query and the height at which the proof will succeed on a tendermint verifier. func (chain *TestChain) QueryProofForStore(storeKey string, key []byte, height int64) ([]byte, clienttypes.Height) { - res := chain.App.Query(abci.RequestQuery{ + res, err := chain.App.Query(context.TODO(), &abci.RequestQuery{ Path: fmt.Sprintf("store/%s/key", storeKey), Height: height - 1, Data: key, Prove: true, }) + require.NoError(chain.t, err) merkleProof, err := commitmenttypes.ConvertProofs(res.ProofOps) require.NoError(chain.t, err) @@ -281,12 +282,13 @@ func (chain *TestChain) QueryProofForStore(storeKey string, key []byte, height i // QueryUpgradeProof performs an abci query with the given key and returns the proto encoded merkle proof // for the query and the height at which the proof will succeed on a tendermint verifier. func (chain *TestChain) QueryUpgradeProof(key []byte, height uint64) ([]byte, clienttypes.Height) { - res := chain.App.Query(abci.RequestQuery{ + res, err := chain.App.Query(context.TODO(), &abci.RequestQuery{ Path: "store/upgrade/key", Height: int64(height - 1), Data: key, Prove: true, }) + require.NoError(chain.t, err) merkleProof, err := commitmenttypes.ConvertProofs(res.ProofOps) require.NoError(chain.t, err) @@ -316,18 +318,27 @@ func (chain *TestChain) QueryConsensusStateProof(clientID string) ([]byte, clien // NextBlock sets the last header to the current header and increments the current header to be // at the next block height. It does not update the time as that is handled by the Coordinator. -// It will call Endblock and Commit and apply the validator set changes to the next validators -// of the next block being created. This follows the Tendermint protocol of applying valset changes +// It will call FinalizeBlock and Commit and apply the validator set changes to the next validators +// of the next block being created. This follows the CometBFT protocol of applying valset changes // returned on block `n` to the validators of block `n+2`. -// It calls BeginBlock with the new block created before returning. -func (chain *TestChain) NextBlock() abci.ResponseEndBlock { - res := chain.App.EndBlock(abci.RequestEndBlock{Height: chain.CurrentHeader.Height}) - chain.App.Commit() - chain.CaptureIBCEvents(res.Events) +// It updates the current header with the new block created before returning. +func (chain *TestChain) NextBlock() { + res, err := chain.App.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: chain.CurrentHeader.Height, + Time: chain.CurrentHeader.GetTime(), // todo (Alex): is this the correct time + NextValidatorsHash: chain.NextVals.Hash(), + }) + require.NoError(chain.t, err) + chain.commitBlock(res) +} + +func (chain *TestChain) commitBlock(res *abci.ResponseFinalizeBlock) { + _, err := chain.App.Commit() + require.NoError(chain.t, err) // set the last header to the current header // use nil trusted fields - chain.LastHeader = chain.CurrentTMClientHeader() + chain.LastHeader = chain.CurrentCmtClientHeader() // val set changes returned from previous block get applied to the next validators // of this block. See tendermint spec for details. @@ -335,7 +346,7 @@ func (chain *TestChain) NextBlock() abci.ResponseEndBlock { chain.NextVals = ibctesting.ApplyValSetChanges(chain.t, chain.Vals, res.ValidatorUpdates) // increment the current header - chain.CurrentHeader = tmproto.Header{ + chain.CurrentHeader = cmtproto.Header{ ChainID: chain.ChainID, Height: chain.App.LastBlockHeight() + 1, AppHash: chain.App.LastCommitID().Hash, @@ -346,21 +357,6 @@ func (chain *TestChain) NextBlock() abci.ResponseEndBlock { NextValidatorsHash: chain.NextVals.Hash(), ProposerAddress: chain.CurrentHeader.ProposerAddress, } - - votes := make([]abci.VoteInfo, len(chain.Vals.Validators)) - for i, v := range chain.Vals.Validators { - votes[i] = abci.VoteInfo{ - Validator: abci.Validator{Address: v.Address, Power: v.VotingPower}, - SignedLastBlock: true, - } - } - chain.App.BeginBlock(abci.RequestBeginBlock{ - Header: chain.CurrentHeader, - LastCommitInfo: abci.CommitInfo{ - Votes: votes, - }, - }) - return res } // sendMsgs delivers a transaction through the application without returning the result. @@ -372,39 +368,62 @@ func (chain *TestChain) sendMsgs(msgs ...sdk.Msg) error { // SendMsgs delivers a transaction through the application. It updates the senders sequence // number and updates the TestChain's headers. It returns the result and error if one // occurred. -func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) { +func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*abci.ExecTxResult, error) { + rsp, gotErr := chain.sendWithSigner(chain.SenderPrivKey, chain.SenderAccount, msgs...) + require.NoError(chain.t, chain.SenderAccount.SetSequence(chain.SenderAccount.GetSequence()+1)) + return rsp, gotErr +} + +// SendNonDefaultSenderMsgs is the same as SendMsgs but with a custom signer/account +func (chain *TestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivKey, msgs ...sdk.Msg) (*abci.ExecTxResult, error) { + require.NotEqual(chain.t, chain.SenderPrivKey, senderPrivKey, "use SendMsgs method") + + addr := sdk.AccAddress(senderPrivKey.PubKey().Address().Bytes()) + account := chain.App.GetAccountKeeper().GetAccount(chain.GetContext(), addr) + require.NotNil(chain.t, account) + return chain.sendWithSigner(senderPrivKey, account, msgs...) +} + +// sendWithSigner is a generic helper to send messages +func (chain *TestChain) sendWithSigner( + senderPrivKey cryptotypes.PrivKey, + senderAccount sdk.AccountI, + msgs ...sdk.Msg, +) (*abci.ExecTxResult, error) { // ensure the chain has the latest time chain.Coordinator.UpdateTimeForChain(chain) - _, r, gotErr := app.SignAndDeliverWithoutCommit( + + blockResp, gotErr := app.SignAndDeliverWithoutCommit( chain.t, chain.TxConfig, chain.App.GetBaseApp(), msgs, chain.DefaultMsgFees, chain.ChainID, - []uint64{chain.SenderAccount.GetAccountNumber()}, - []uint64{chain.SenderAccount.GetSequence()}, - chain.SenderPrivKey, + []uint64{senderAccount.GetAccountNumber()}, + []uint64{senderAccount.GetSequence()}, + chain.CurrentHeader.GetTime(), + senderPrivKey, ) - - // NextBlock calls app.Commit() - chain.NextBlock() - - // increment sequence for successful and failed transaction execution - require.NoError(chain.t, chain.SenderAccount.SetSequence(chain.SenderAccount.GetSequence()+1)) - chain.Coordinator.IncrementTime() - if gotErr != nil { return nil, gotErr } - chain.CaptureIBCEvents(r.Events) + chain.commitBlock(blockResp) + chain.Coordinator.IncrementTime() + + require.Len(chain.t, blockResp.TxResults, 1) + txResult := blockResp.TxResults[0] + if txResult.Code != 0 { + return txResult, fmt.Errorf("%s/%d: %q", txResult.Codespace, txResult.Code, txResult.Log) + } - return r, nil + chain.CaptureIBCEvents(txResult) + return txResult, nil } -func (chain *TestChain) CaptureIBCEvents(evts []abci.Event) { - toSend := GetSendPackets(evts) +func (chain *TestChain) CaptureIBCEvents(r *abci.ExecTxResult) { + toSend := GetSendPackets(r.Events) if len(toSend) > 0 { // Keep a queue on the chain that we can relay in tests chain.PendingSendPackets = append(chain.PendingSendPackets, toSend...) @@ -428,19 +447,28 @@ func (chain *TestChain) GetConsensusState(clientID string, height exported.Heigh // GetValsAtHeight will return the validator set of the chain at a given height. It will return // a success boolean depending on if the validator set exists or not at that height. -func (chain *TestChain) GetValsAtHeight(height int64) (*tmtypes.ValidatorSet, bool) { - histInfo, ok := chain.App.GetStakingKeeper().GetHistoricalInfo(chain.GetContext(), height) - if !ok { +func (chain *TestChain) GetValsAtHeight(height int64) (*cmttypes.ValidatorSet, bool) { + // if the current uncommitted header equals the requested height, then we can return + // the current validator set as this validator set will be stored in the historical info + // when the block height is executed + if height == chain.CurrentHeader.Height { + return chain.Vals, true + } + + histInfo, err := chain.App.GetStakingKeeper().GetHistoricalInfo(chain.GetContext(), height) + if err != nil { return nil, false } - valSet := stakingtypes.Validators(histInfo.Valset) + valSet := stakingtypes.Validators{ + Validators: histInfo.Valset, + } - tmValidators, err := testutil.ToTmValidators(valSet, sdk.DefaultPowerReduction) + cmtValidators, err := testutil.ToCmtValidators(valSet, sdk.DefaultPowerReduction) if err != nil { panic(err) } - return tmtypes.NewValidatorSet(tmValidators), true + return cmttypes.NewValidatorSet(cmtValidators), true } // GetAcknowledgement retrieves an acknowledgement for the provided packet. If the @@ -460,32 +488,32 @@ func (chain *TestChain) GetPrefix() commitmenttypes.MerklePrefix { // ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the // light client on the source chain. func (chain *TestChain) ConstructUpdateTMClientHeader(counterparty *TestChain, clientID string) (*ibctm.Header, error) { - return chain.ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight()) + return chain.ConstructUpdateCMTClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight()) } -// ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the +// ConstructUpdateCMTClientHeaderWithTrustedHeight will construct a valid 07-tendermint Header to update the // light client on the source chain. -func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibctm.Header, error) { +func (chain *TestChain) ConstructUpdateCMTClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibctm.Header, error) { header := counterparty.LastHeader // Relayer must query for LatestHeight on client to get TrustedHeight if the trusted height is not set if trustedHeight.IsZero() { trustedHeight = chain.GetClientState(clientID).GetLatestHeight().(clienttypes.Height) } var ( - tmTrustedVals *tmtypes.ValidatorSet - ok bool + cmtTrustedVals *cmttypes.ValidatorSet + ok bool ) // Once we get TrustedHeight from client, we must query the validators from the counterparty chain // If the LatestHeight == LastHeader.Height, then TrustedValidators are current validators // If LatestHeight < LastHeader.Height, we can query the historical validator set from HistoricalInfo if trustedHeight == counterparty.LastHeader.GetHeight() { - tmTrustedVals = counterparty.Vals + cmtTrustedVals = counterparty.Vals } else { // NOTE: We need to get validators from counterparty at height: trustedHeight+1 // since the last trusted validators for a header at height h // is the NextValidators at h+1 committed to in header h by // NextValidatorsHash - tmTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.RevisionHeight + 1)) + cmtTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.RevisionHeight + 1)) if !ok { return nil, errorsmod.Wrapf(ibctm.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight) } @@ -494,7 +522,7 @@ func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterpa // for now assume revision number is 0 header.TrustedHeight = trustedHeight - trustedVals, err := tmTrustedVals.ToProto() + trustedVals, err := cmtTrustedVals.ToProto() if err != nil { return nil, err } @@ -509,26 +537,35 @@ func (chain *TestChain) ExpireClient(amount time.Duration) { chain.Coordinator.IncrementTimeBy(amount) } -// CurrentTMClientHeader creates a TM header using the current header parameters +// CurrentCmtClientHeader creates a CMT header using the current header parameters // on the chain. The trusted fields in the header are set to nil. -func (chain *TestChain) CurrentTMClientHeader() *ibctm.Header { - return chain.CreateTMClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, chain.NextVals, nil, chain.Signers) +func (chain *TestChain) CurrentCmtClientHeader() *ibctm.Header { + return chain.CreateCmtClientHeader( + chain.ChainID, + chain.CurrentHeader.Height, + clienttypes.Height{}, + chain.CurrentHeader.Time, + chain.Vals, + chain.NextVals, + nil, + chain.Signers, + ) } -// CreateTMClientHeader creates a TM header to update the TM client. Args are passed in to allow +// CreateCmtClientHeader creates a CMT header to update the CMT client. Args are passed in to allow // caller flexibility to use params that differ from the chain. -func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, nextVals, tmTrustedVals *tmtypes.ValidatorSet, signers map[string]tmtypes.PrivValidator) *ibctm.Header { +func (chain *TestChain) CreateCmtClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, cmtValSet, nextVals, cmtTrustedVals *cmttypes.ValidatorSet, signers map[string]cmttypes.PrivValidator) *ibctm.Header { var ( - valSet *tmproto.ValidatorSet - trustedVals *tmproto.ValidatorSet + valSet *cmtproto.ValidatorSet + trustedVals *cmtproto.ValidatorSet ) - require.NotNil(chain.t, tmValSet) + require.NotNil(chain.t, cmtValSet) - vsetHash := tmValSet.Hash() + vsetHash := cmtValSet.Hash() nextValHash := nextVals.Hash() - tmHeader := tmtypes.Header{ - Version: tmprotoversion.Consensus{Block: tmversion.BlockProtocol, App: 2}, + cmtHeader := cmttypes.Header{ + Version: cmtprotoversion.Consensus{Block: tmversion.BlockProtocol, App: 2}, ChainID: chainID, Height: blockHeight, Time: timestamp, @@ -541,35 +578,34 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, AppHash: chain.CurrentHeader.AppHash, LastResultsHash: tmhash.Sum([]byte("last_results_hash")), EvidenceHash: tmhash.Sum([]byte("evidence_hash")), - ProposerAddress: tmValSet.Proposer.Address, //nolint:staticcheck // SA5011: possible nil pointer dereference + ProposerAddress: cmtValSet.Proposer.Address, //nolint:staticcheck // SA5011: possible nil pointer dereference } - hhash := tmHeader.Hash() + hhash := cmtHeader.Hash() blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set"))) - voteSet := tmtypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet) + voteSet := cmttypes.NewExtendedVoteSet(chainID, blockHeight, 1, cmtproto.PrecommitType, cmtValSet) // MakeCommit expects a signer array in the same order as the validator array. // Thus we iterate over the ordered validator set and construct a signer array // from the signer map in the same order. - signerArr := make([]tmtypes.PrivValidator, len(tmValSet.Validators)) //nolint:staticcheck - for i, v := range tmValSet.Validators { //nolint:staticcheck + signerArr := make([]cmttypes.PrivValidator, len(cmtValSet.Validators)) //nolint:staticcheck + for i, v := range cmtValSet.Validators { //nolint:staticcheck signerArr[i] = signers[v.Address.String()] } - - commit, err := tmtypes.MakeCommit(blockID, blockHeight, 1, voteSet, signerArr, timestamp) + extCommit, err := cmttypes.MakeExtCommit(blockID, blockHeight, 1, voteSet, signerArr, timestamp, true) require.NoError(chain.t, err) - signedHeader := &tmproto.SignedHeader{ - Header: tmHeader.ToProto(), - Commit: commit.ToProto(), + signedHeader := &cmtproto.SignedHeader{ + Header: cmtHeader.ToProto(), + Commit: extCommit.ToCommit().ToProto(), } - if tmValSet != nil { //nolint:staticcheck - valSet, err = tmValSet.ToProto() + if cmtValSet != nil { //nolint:staticcheck + valSet, err = cmtValSet.ToProto() require.NoError(chain.t, err) } - if tmTrustedVals != nil { - trustedVals, err = tmTrustedVals.ToProto() + if cmtTrustedVals != nil { + trustedVals, err = cmtTrustedVals.ToProto() require.NoError(chain.t, err) } @@ -583,11 +619,11 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, } } -// MakeBlockID copied unimported test functions from tmtypes to use them here -func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) tmtypes.BlockID { - return tmtypes.BlockID{ +// MakeBlockID copied unimported test functions from cmttypes to use them here +func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) cmttypes.BlockID { + return cmttypes.BlockID{ Hash: hash, - PartSetHeader: tmtypes.PartSetHeader{ + PartSetHeader: cmttypes.PartSetHeader{ Total: partSetSize, Hash: partSetHash, }, @@ -611,7 +647,7 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope require.NoError(chain.t, err) } - chain.NextBlock() + chain.Coordinator.CommitBlock(chain) } // GetPortCapability returns the port capability for the given portID. The capability must @@ -637,7 +673,7 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc require.NoError(chain.t, err) } - chain.NextBlock() + chain.Coordinator.CommitBlock(chain) } // GetChannelCapability returns the channel capability for the given portID and channelID. diff --git a/x/wasm/ibctesting/coordinator.go b/x/wasm/ibctesting/coordinator.go index 75f5271ac6..de91edfcd1 100644 --- a/x/wasm/ibctesting/coordinator.go +++ b/x/wasm/ibctesting/coordinator.go @@ -5,10 +5,9 @@ import ( "testing" "time" - abci "github.com/cometbft/cometbft/abci/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -81,7 +80,6 @@ func (coord *Coordinator) UpdateTime() { // UpdateTimeForChain updates the clock for a specific chain. func (coord *Coordinator) UpdateTimeForChain(chain *TestChain) { chain.CurrentHeader.Time = coord.CurrentTime.UTC() - chain.App.BeginBlock(abci.RequestBeginBlock{Header: chain.CurrentHeader}) } // Setup constructs a TM client, connection, and channel on both chains provided. It will diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index 2e22ec802b..eb519c254e 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -4,18 +4,18 @@ import ( "fmt" "strings" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + abci "github.com/cometbft/cometbft/abci/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" ) // Endpoint is a which represents a channel endpoint and its associated @@ -122,7 +122,7 @@ func (endpoint *Endpoint) CreateClient() (err error) { return err } - endpoint.ClientID, err = ibctesting.ParseClientIDFromEvents(res.GetEvents()) + endpoint.ClientID, err = ParseClientIDFromEvents(res.GetEvents()) require.NoError(endpoint.Chain.t, err) return nil @@ -185,7 +185,7 @@ func (endpoint *Endpoint) UpgradeChain() error { baseapp.SetChainID(newChainID)(endpoint.Chain.App.GetBaseApp()) endpoint.Chain.ChainID = newChainID endpoint.Chain.CurrentHeader.ChainID = newChainID - endpoint.Chain.NextBlock() // commit changes + endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain) // update counterparty client manually clientState.ChainId = newChainID @@ -201,13 +201,9 @@ func (endpoint *Endpoint) UpgradeChain() error { // ensure the next update isn't identical to the one set in state endpoint.Chain.Coordinator.IncrementTime() - endpoint.Chain.NextBlock() - - if err = endpoint.Counterparty.UpdateClient(); err != nil { - return err - } + endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain) - return nil + return endpoint.Counterparty.UpdateClient() } // ConnOpenInit will construct and execute a MsgConnectionOpenInit on the associated endpoint. @@ -223,7 +219,7 @@ func (endpoint *Endpoint) ConnOpenInit() error { return err } - endpoint.ConnectionID, err = ibctesting.ParseConnectionIDFromEvents(res.GetEvents()) + endpoint.ConnectionID, err = ParseConnectionIDFromEvents(res.GetEvents()) require.NoError(endpoint.Chain.t, err) return nil @@ -249,7 +245,7 @@ func (endpoint *Endpoint) ConnOpenTry() error { } if endpoint.ConnectionID == "" { - endpoint.ConnectionID, err = ibctesting.ParseConnectionIDFromEvents(res.GetEvents()) + endpoint.ConnectionID, err = ParseConnectionIDFromEvents(res.GetEvents()) require.NoError(endpoint.Chain.t, err) } @@ -331,7 +327,7 @@ func (endpoint *Endpoint) ChanOpenInit() error { return err } - endpoint.ChannelID, err = ibctesting.ParseChannelIDFromEvents(res.GetEvents()) + endpoint.ChannelID, err = ParseChannelIDFromEvents(res.GetEvents()) require.NoError(endpoint.Chain.t, err) // update version to selected app version @@ -362,7 +358,7 @@ func (endpoint *Endpoint) ChanOpenTry() error { } if endpoint.ChannelID == "" { - endpoint.ChannelID, err = ibctesting.ParseChannelIDFromEvents(res.GetEvents()) + endpoint.ChannelID, err = ParseChannelIDFromEvents(res.GetEvents()) require.NoError(endpoint.Chain.t, err) } @@ -476,7 +472,7 @@ func (endpoint *Endpoint) RecvPacket(packet channeltypes.Packet) error { // RecvPacketWithResult receives a packet on the associated endpoint and the result // of the transaction is returned. The counterparty client is updated. -func (endpoint *Endpoint) RecvPacketWithResult(packet channeltypes.Packet) (*sdk.Result, error) { +func (endpoint *Endpoint) RecvPacketWithResult(packet channeltypes.Packet) (*abci.ExecTxResult, error) { // get proof of packet commitment on source packetKey := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) proof, proofHeight := endpoint.Counterparty.Chain.QueryProof(packetKey) diff --git a/x/wasm/ibctesting/event_utils.go b/x/wasm/ibctesting/event_utils.go index 71df2784a5..cc6dea6a62 100644 --- a/x/wasm/ibctesting/event_utils.go +++ b/x/wasm/ibctesting/event_utils.go @@ -7,10 +7,8 @@ import ( "strings" abci "github.com/cometbft/cometbft/abci/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - - sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) func GetSendPackets(evts []abci.Event) []channeltypes.Packet { @@ -91,7 +89,7 @@ func parseTimeoutHeight(raw string) clienttypes.Height { } } -func ParsePortIDFromEvents(events sdk.Events) (string, error) { +func ParsePortIDFromEvents(events []abci.Event) (string, error) { for _, ev := range events { if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry { for _, attr := range ev.Attributes { @@ -104,7 +102,7 @@ func ParsePortIDFromEvents(events sdk.Events) (string, error) { return "", fmt.Errorf("port id event attribute not found") } -func ParseChannelVersionFromEvents(events sdk.Events) (string, error) { +func ParseChannelVersionFromEvents(events []abci.Event) (string, error) { for _, ev := range events { if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry { for _, attr := range ev.Attributes { diff --git a/x/wasm/ibctesting/events.go b/x/wasm/ibctesting/events.go new file mode 100644 index 0000000000..d30ca576bb --- /dev/null +++ b/x/wasm/ibctesting/events.go @@ -0,0 +1,172 @@ +package ibctesting + +import ( + "encoding/hex" + "fmt" + "strconv" + + abci "github.com/cometbft/cometbft/abci/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + "github.com/stretchr/testify/suite" +) + +type EventsMap map[string]map[string]string + +// ParseClientIDFromEvents parses events emitted from a MsgCreateClient and returns the +// client identifier. +func ParseClientIDFromEvents(events []abci.Event) (string, error) { + for _, ev := range events { + if ev.Type == clienttypes.EventTypeCreateClient { + for _, attr := range ev.Attributes { + if attr.Key == clienttypes.AttributeKeyClientID { + return attr.Value, nil + } + } + } + } + return "", fmt.Errorf("client identifier event attribute not found") +} + +// ParseConnectionIDFromEvents parses events emitted from a MsgConnectionOpenInit or +// MsgConnectionOpenTry and returns the connection identifier. +func ParseConnectionIDFromEvents(events []abci.Event) (string, error) { + for _, ev := range events { + if ev.Type == connectiontypes.EventTypeConnectionOpenInit || + ev.Type == connectiontypes.EventTypeConnectionOpenTry { + for _, attr := range ev.Attributes { + if attr.Key == connectiontypes.AttributeKeyConnectionID { + return attr.Value, nil + } + } + } + } + return "", fmt.Errorf("connection identifier event attribute not found") +} + +// ParseChannelIDFromEvents parses events emitted from a MsgChannelOpenInit or +// MsgChannelOpenTry and returns the channel identifier. +func ParseChannelIDFromEvents(events []abci.Event) (string, error) { + for _, ev := range events { + if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry { + for _, attr := range ev.Attributes { + if attr.Key == channeltypes.AttributeKeyChannelID { + return attr.Value, nil + } + } + } + } + return "", fmt.Errorf("channel identifier event attribute not found") +} + +// ParsePacketFromEvents parses events emitted from a MsgRecvPacket and returns the +// acknowledgement. +func ParsePacketFromEvents(events []abci.Event) (channeltypes.Packet, error) { + for _, ev := range events { + if ev.Type == channeltypes.EventTypeSendPacket { + packet := channeltypes.Packet{} + for _, attr := range ev.Attributes { + switch attr.Key { + case channeltypes.AttributeKeyDataHex: + bz, err := hex.DecodeString(attr.Value) + if err != nil { + panic(err) + } + packet.Data = bz + + case channeltypes.AttributeKeySequence: + seq, err := strconv.ParseUint(attr.Value, 10, 64) + if err != nil { + return channeltypes.Packet{}, err + } + + packet.Sequence = seq + + case channeltypes.AttributeKeySrcPort: + packet.SourcePort = attr.Value + + case channeltypes.AttributeKeySrcChannel: + packet.SourceChannel = attr.Value + + case channeltypes.AttributeKeyDstPort: + packet.DestinationPort = attr.Value + + case channeltypes.AttributeKeyDstChannel: + packet.DestinationChannel = attr.Value + + case channeltypes.AttributeKeyTimeoutHeight: + height, err := clienttypes.ParseHeight(attr.Value) + if err != nil { + return channeltypes.Packet{}, err + } + + packet.TimeoutHeight = height + + case channeltypes.AttributeKeyTimeoutTimestamp: + timestamp, err := strconv.ParseUint(attr.Value, 10, 64) + if err != nil { + return channeltypes.Packet{}, err + } + + packet.TimeoutTimestamp = timestamp + + default: + continue + } + } + + return packet, nil + } + } + return channeltypes.Packet{}, fmt.Errorf("acknowledgement event attribute not found") +} + +// ParseAckFromEvents parses events emitted from a MsgRecvPacket and returns the +// acknowledgement. +func ParseAckFromEvents(events []abci.Event) ([]byte, error) { + for _, ev := range events { + if ev.Type == channeltypes.EventTypeWriteAck { + for _, attr := range ev.Attributes { + if attr.Key == channeltypes.AttributeKeyAckHex { + bz, err := hex.DecodeString(attr.Value) + if err != nil { + panic(err) + } + return bz, nil + } + } + } + } + return nil, fmt.Errorf("acknowledgement event attribute not found") +} + +// AssertEvents asserts that expected events are present in the actual events. +// Expected map needs to be a subset of actual events to pass. +func AssertEvents( + suite *suite.Suite, + expected EventsMap, + actual []abci.Event, +) { + hasEvents := make(map[string]bool) + for eventType := range expected { + hasEvents[eventType] = false + } + + for _, event := range actual { + expEvent, eventFound := expected[event.Type] + if eventFound { + hasEvents[event.Type] = true + suite.Require().Len(event.Attributes, len(expEvent)) + for _, attr := range event.Attributes { + expValue, found := expEvent[attr.Key] + suite.Require().True(found) + suite.Require().Equal(expValue, attr.Value) + } + } + } + + for eventName, hasEvent := range hasEvents { + suite.Require().True(hasEvent, "event: %s was not found in events", eventName) + } +} diff --git a/x/wasm/ibctesting/faucet.go b/x/wasm/ibctesting/faucet.go index 559149906f..38565465e8 100644 --- a/x/wasm/ibctesting/faucet.go +++ b/x/wasm/ibctesting/faucet.go @@ -5,11 +5,8 @@ import ( "cosmossdk.io/math" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/CosmWasm/wasmd/app" ) // Fund an address with the given amount in default denom @@ -20,36 +17,3 @@ func (chain *TestChain) Fund(addr sdk.AccAddress, amount math.Int) { Amount: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amount)), })) } - -// SendNonDefaultSenderMsgs delivers a transaction through the application. It returns the result and error if one -// occurred. -func (chain *TestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivKey, msgs ...sdk.Msg) (*sdk.Result, error) { - require.NotEqual(chain.t, chain.SenderPrivKey, senderPrivKey, "use SendMsgs method") - - // ensure the chain has the latest time - chain.Coordinator.UpdateTimeForChain(chain) - - addr := sdk.AccAddress(senderPrivKey.PubKey().Address().Bytes()) - account := chain.App.GetAccountKeeper().GetAccount(chain.GetContext(), addr) - require.NotNil(chain.t, account) - _, r, err := app.SignAndDeliverWithoutCommit( - chain.t, - chain.TxConfig, - chain.App.GetBaseApp(), - msgs, - chain.DefaultMsgFees, - chain.ChainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - senderPrivKey, - ) - - // SignAndDeliverWithoutCommit calls app.Commit() - chain.NextBlock() - chain.Coordinator.IncrementTime() - if err != nil { - return r, err - } - chain.CaptureIBCEvents(r.Events) - return r, nil -} diff --git a/x/wasm/ibctesting/path.go b/x/wasm/ibctesting/path.go index fe0ace44f4..0bc4943056 100644 --- a/x/wasm/ibctesting/path.go +++ b/x/wasm/ibctesting/path.go @@ -4,8 +4,7 @@ import ( "bytes" "fmt" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -55,7 +54,7 @@ func (path *Path) RelayPacket(packet channeltypes.Packet, _ []byte) error { return err } - ack, err := ibctesting.ParseAckFromEvents(res.GetEvents()) + ack, err := ParseAckFromEvents(res.GetEvents()) if err != nil { return err } @@ -78,7 +77,7 @@ func (path *Path) RelayPacket(packet channeltypes.Packet, _ []byte) error { return err } - ack, err := ibctesting.ParseAckFromEvents(res.GetEvents()) + ack, err := ParseAckFromEvents(res.GetEvents()) if err != nil { return err } diff --git a/x/wasm/ibctesting/wasm.go b/x/wasm/ibctesting/wasm.go index b01611a8b5..48343926da 100644 --- a/x/wasm/ibctesting/wasm.go +++ b/x/wasm/ibctesting/wasm.go @@ -3,6 +3,7 @@ package ibctesting import ( "bytes" "compress/gzip" + "context" "encoding/json" "fmt" "os" @@ -11,7 +12,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" "github.com/cosmos/gogoproto/proto" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,13 +57,23 @@ func (chain *TestChain) StoreCode(byteCode []byte) types.MsgStoreCodeResponse { } r, err := chain.SendMsgs(storeMsg) require.NoError(chain.t, err) - // unmarshal protobuf response from data - require.Len(chain.t, r.MsgResponses, 1) - require.NotEmpty(chain.t, r.MsgResponses[0].GetCachedValue()) - pInstResp := r.MsgResponses[0].GetCachedValue().(*types.MsgStoreCodeResponse) + + var pInstResp types.MsgStoreCodeResponse + chain.UnwrapExecTXResult(r, &pInstResp) + require.NotEmpty(chain.t, pInstResp.CodeID) require.NotEmpty(chain.t, pInstResp.Checksum) - return *pInstResp + return pInstResp +} + +// UnwrapExecTXResult is a helper to unpack execution result from proto any type +func (chain *TestChain) UnwrapExecTXResult(r *abci.ExecTxResult, target proto.Message) { + var wrappedRsp sdk.TxMsgData + require.NoError(chain.t, chain.Codec.Unmarshal(r.Data, &wrappedRsp)) + + // unmarshal protobuf response from data + require.Len(chain.t, wrappedRsp.MsgResponses, 1) + require.NoError(chain.t, proto.Unmarshal(wrappedRsp.MsgResponses[0].Value, target)) } func (chain *TestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.AccAddress { @@ -77,9 +88,10 @@ func (chain *TestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.A r, err := chain.SendMsgs(instantiateMsg) require.NoError(chain.t, err) - require.Len(chain.t, r.MsgResponses, 1) - require.NotEmpty(chain.t, r.MsgResponses[0].GetCachedValue()) - pExecResp := r.MsgResponses[0].GetCachedValue().(*types.MsgInstantiateContractResponse) + + var pExecResp types.MsgInstantiateContractResponse + chain.UnwrapExecTXResult(r, &pExecResp) + a, err := sdk.AccAddressFromBech32(pExecResp.Address) require.NoError(chain.t, err) return a @@ -95,10 +107,11 @@ func (chain *TestChain) RawQuery(contractAddr string, queryData []byte) ([]byte, return nil, err } - res := chain.App.Query(abci.RequestQuery{ + res, err := chain.App.Query(context.TODO(), &abci.RequestQuery{ Path: "/cosmwasm.wasm.v1.Query/RawContractState", Data: reqBin, }) + require.NoError(chain.t, err) if res.Code != 0 { return nil, fmt.Errorf("raw query failed: (%d) %s", res.Code, res.Log) @@ -132,11 +145,11 @@ func (chain *TestChain) SmartQuery(contractAddr string, queryMsg, response inter return err } - // TODO: what is the query? - res := chain.App.Query(abci.RequestQuery{ + res, err := chain.App.Query(context.TODO(), &abci.RequestQuery{ Path: "/cosmwasm.wasm.v1.Query/SmartContractState", Data: reqBin, }) + require.NoError(chain.t, err) if res.Code != 0 { return fmt.Errorf("smart query failed: (%d) %s", res.Code, res.Log) diff --git a/x/wasm/ioutils/ioutil.go b/x/wasm/ioutils/ioutil.go index f380fb5a1e..e54fd77de5 100644 --- a/x/wasm/ioutils/ioutil.go +++ b/x/wasm/ioutils/ioutil.go @@ -3,8 +3,8 @@ package ioutils import ( "bytes" "compress/gzip" - "errors" "encoding/json" + "errors" "io" errorsmod "cosmossdk.io/errors" diff --git a/x/wasm/keeper/addresses.go b/x/wasm/keeper/addresses.go index d9136f26d0..4f7093631d 100644 --- a/x/wasm/keeper/addresses.go +++ b/x/wasm/keeper/addresses.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "encoding/binary" "fmt" @@ -11,19 +12,19 @@ import ( ) // AddressGenerator abstract address generator to be used for a single contract address -type AddressGenerator func(ctx sdk.Context, codeID uint64, checksum []byte) sdk.AccAddress +type AddressGenerator func(ctx context.Context, codeID uint64, checksum []byte) sdk.AccAddress // ClassicAddressGenerator generates a contract address using codeID and instanceID sequence func (k Keeper) ClassicAddressGenerator() AddressGenerator { - return func(ctx sdk.Context, codeID uint64, _ []byte) sdk.AccAddress { - instanceID := k.autoIncrementID(ctx, types.KeySequenceInstanceID) + return func(ctx context.Context, codeID uint64, _ []byte) sdk.AccAddress { + instanceID := k.mustAutoIncrementID(ctx, types.KeySequenceInstanceID) return BuildContractAddressClassic(codeID, instanceID) } } // PredicableAddressGenerator generates a predictable contract address func PredicableAddressGenerator(creator sdk.AccAddress, salt, msg []byte, fixMsg bool) AddressGenerator { - return func(ctx sdk.Context, _ uint64, checksum []byte) sdk.AccAddress { + return func(_ context.Context, _ uint64, checksum []byte) sdk.AccAddress { if !fixMsg { // clear msg to not be included in the address generation msg = []byte{} } diff --git a/x/wasm/keeper/addresses_test.go b/x/wasm/keeper/addresses_test.go index 33195b9944..c548f46787 100644 --- a/x/wasm/keeper/addresses_test.go +++ b/x/wasm/keeper/addresses_test.go @@ -6,7 +6,6 @@ import ( "testing" tmbytes "github.com/cometbft/cometbft/libs/bytes" - "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/wasm/keeper/ante.go b/x/wasm/keeper/ante.go index 1718c1ce11..96bf474caf 100644 --- a/x/wasm/keeper/ante.go +++ b/x/wasm/keeper/ante.go @@ -3,7 +3,10 @@ package keeper import ( "encoding/binary" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + corestoretypes "cosmossdk.io/core/store" + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -11,12 +14,12 @@ import ( // CountTXDecorator ante handler to count the tx position in a block. type CountTXDecorator struct { - storeKey storetypes.StoreKey + storeService corestoretypes.KVStoreService } // NewCountTXDecorator constructor -func NewCountTXDecorator(storeKey storetypes.StoreKey) *CountTXDecorator { - return &CountTXDecorator{storeKey: storeKey} +func NewCountTXDecorator(s corestoretypes.KVStoreService) *CountTXDecorator { + return &CountTXDecorator{storeService: s} } // AnteHandle handler stores a tx counter with current height encoded in the store to let the app handle @@ -27,12 +30,16 @@ func (a CountTXDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, if simulate { return next(ctx, tx, simulate) } - store := ctx.KVStore(a.storeKey) + store := a.storeService.OpenKVStore(ctx) currentHeight := ctx.BlockHeight() var txCounter uint32 // start with 0 // load counter when exists - if bz := store.Get(types.TXCounterPrefix); bz != nil { + bz, err := store.Get(types.TXCounterPrefix) + if err != nil { + return ctx, errorsmod.Wrap(err, "read tx counter") + } + if bz != nil { lastHeight, val := decodeHeightCounter(bz) if currentHeight == lastHeight { // then use stored counter @@ -40,8 +47,10 @@ func (a CountTXDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, } // else use `0` from above to start with } // store next counter value for current height - store.Set(types.TXCounterPrefix, encodeHeightCounter(currentHeight, txCounter+1)) - + err = store.Set(types.TXCounterPrefix, encodeHeightCounter(currentHeight, txCounter+1)) + if err != nil { + return ctx, errorsmod.Wrap(err, "store tx counter") + } return next(types.WithTXCounter(ctx, txCounter), tx, simulate) } @@ -57,11 +66,11 @@ func decodeHeightCounter(bz []byte) (int64, uint32) { // LimitSimulationGasDecorator ante decorator to limit gas in simulation calls type LimitSimulationGasDecorator struct { - gasLimit *sdk.Gas + gasLimit *storetypes.Gas } // NewLimitSimulationGasDecorator constructor accepts nil value to fallback to block gas limit. -func NewLimitSimulationGasDecorator(gasLimit *sdk.Gas) *LimitSimulationGasDecorator { +func NewLimitSimulationGasDecorator(gasLimit *storetypes.Gas) *LimitSimulationGasDecorator { if gasLimit != nil && *gasLimit == 0 { panic("gas limit must not be zero") } @@ -86,12 +95,13 @@ func (d LimitSimulationGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu // apply custom node gas limit if d.gasLimit != nil { - return next(ctx.WithGasMeter(sdk.NewGasMeter(*d.gasLimit)), tx, simulate) + return next(ctx.WithGasMeter(storetypes.NewGasMeter(*d.gasLimit)), tx, simulate) } // default to max block gas when set, to be on the safe side - if maxGas := ctx.ConsensusParams().GetBlock().MaxGas; maxGas > 0 { - return next(ctx.WithGasMeter(sdk.NewGasMeter(sdk.Gas(maxGas))), tx, simulate) + params := ctx.ConsensusParams() + if maxGas := params.GetBlock().MaxGas; maxGas > 0 { + return next(ctx.WithGasMeter(storetypes.NewGasMeter(storetypes.Gas(maxGas))), tx, simulate) } return next(ctx, tx, simulate) } diff --git a/x/wasm/keeper/ante_test.go b/x/wasm/keeper/ante_test.go index c1e59c4aa2..5334964615 100644 --- a/x/wasm/keeper/ante_test.go +++ b/x/wasm/keeper/ante_test.go @@ -4,14 +4,17 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -20,9 +23,9 @@ import ( ) func TestCountTxDecorator(t *testing.T) { - keyWasm := sdk.NewKVStoreKey(types.StoreKey) + keyWasm := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) + ms := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db) require.NoError(t, ms.LoadLatestVersion()) const myCurrentBlockHeight = 100 @@ -33,9 +36,7 @@ func TestCountTxDecorator(t *testing.T) { nextAssertAnte func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) }{ "no initial counter set": { - setupDB: func(t *testing.T, ctx sdk.Context) { - t.Helper() - }, + setupDB: func(t *testing.T, ctx sdk.Context) {}, nextAssertAnte: func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { gotCounter, ok := types.TXCounter(ctx) require.True(t, ok) @@ -48,7 +49,6 @@ func TestCountTxDecorator(t *testing.T) { }, "persistent counter incremented - big endian": { setupDB: func(t *testing.T, ctx sdk.Context) { - t.Helper() bz := []byte{0, 0, 0, 0, 0, 0, 0, myCurrentBlockHeight, 1, 0, 0, 2} ctx.MultiStore().GetKVStore(keyWasm).Set(types.TXCounterPrefix, bz) }, @@ -64,7 +64,6 @@ func TestCountTxDecorator(t *testing.T) { }, "old height counter replaced": { setupDB: func(t *testing.T, ctx sdk.Context) { - t.Helper() previousHeight := byte(myCurrentBlockHeight - 1) bz := []byte{0, 0, 0, 0, 0, 0, 0, previousHeight, 0, 0, 0, 1} ctx.MultiStore().GetKVStore(keyWasm).Set(types.TXCounterPrefix, bz) @@ -81,7 +80,6 @@ func TestCountTxDecorator(t *testing.T) { }, "simulation not persisted": { setupDB: func(t *testing.T, ctx sdk.Context) { - t.Helper() }, simulate: true, nextAssertAnte: func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { @@ -96,7 +94,7 @@ func TestCountTxDecorator(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - ctx := sdk.NewContext(ms.CacheMultiStore(), tmproto.Header{ + ctx := sdk.NewContext(ms.CacheMultiStore(), cmtproto.Header{ Height: myCurrentBlockHeight, Time: time.Date(2021, time.September, 27, 12, 0, 0, 0, time.UTC), }, false, log.NewNopLogger()) @@ -105,7 +103,7 @@ func TestCountTxDecorator(t *testing.T) { var anyTx sdk.Tx // when - ante := keeper.NewCountTXDecorator(keyWasm) + ante := keeper.NewCountTXDecorator(runtime.NewKVStoreService(keyWasm)) _, gotErr := ante.AnteHandle(ctx, anyTx, spec.simulate, spec.nextAssertAnte) require.NoError(t, gotErr) }) @@ -114,12 +112,12 @@ func TestCountTxDecorator(t *testing.T) { func TestLimitSimulationGasDecorator(t *testing.T) { var ( - hundred sdk.Gas = 100 - zero sdk.Gas = 0 + hundred storetypes.Gas = 100 + zero storetypes.Gas = 0 ) specs := map[string]struct { - customLimit *sdk.Gas - consumeGas sdk.Gas + customLimit *storetypes.Gas + consumeGas storetypes.Gas maxBlockGas int64 simulation bool expErr interface{} @@ -129,13 +127,13 @@ func TestLimitSimulationGasDecorator(t *testing.T) { consumeGas: hundred + 1, maxBlockGas: -1, simulation: true, - expErr: sdk.ErrorOutOfGas{Descriptor: "testing"}, + expErr: storetypes.ErrorOutOfGas{Descriptor: "testing"}, }, "block limit set": { maxBlockGas: 100, consumeGas: hundred + 1, simulation: true, - expErr: sdk.ErrorOutOfGas{Descriptor: "testing"}, + expErr: storetypes.ErrorOutOfGas{Descriptor: "testing"}, }, "no limits set": { maxBlockGas: -1, @@ -163,9 +161,9 @@ func TestLimitSimulationGasDecorator(t *testing.T) { t.Run(name, func(t *testing.T) { nextAnte := consumeGasAnteHandler(spec.consumeGas) ctx := sdk.Context{}. - WithGasMeter(sdk.NewInfiniteGasMeter()). - WithConsensusParams(&tmproto.ConsensusParams{ - Block: &tmproto.BlockParams{MaxGas: spec.maxBlockGas}, + WithGasMeter(storetypes.NewInfiniteGasMeter()). + WithConsensusParams(cmtproto.ConsensusParams{ + Block: &cmtproto.BlockParams{MaxGas: spec.maxBlockGas}, }) // when if spec.expErr != nil { @@ -183,7 +181,7 @@ func TestLimitSimulationGasDecorator(t *testing.T) { } } -func consumeGasAnteHandler(gasToConsume sdk.Gas) sdk.AnteHandler { +func consumeGasAnteHandler(gasToConsume storetypes.Gas) sdk.AnteHandler { return func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { ctx.GasMeter().ConsumeGas(gasToConsume, "testing") return ctx, nil @@ -192,7 +190,7 @@ func consumeGasAnteHandler(gasToConsume sdk.Gas) sdk.AnteHandler { func TestGasRegisterDecorator(t *testing.T) { db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) + ms := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) specs := map[string]struct { simulate bool @@ -219,7 +217,7 @@ func TestGasRegisterDecorator(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - ctx := sdk.NewContext(ms, tmproto.Header{ + ctx := sdk.NewContext(ms, cmtproto.Header{ Height: 100, Time: time.Now(), }, false, log.NewNopLogger()) diff --git a/x/wasm/keeper/api.go b/x/wasm/keeper/api.go index 0a6f37c123..c25a63860c 100644 --- a/x/wasm/keeper/api.go +++ b/x/wasm/keeper/api.go @@ -1,8 +1,10 @@ package keeper import ( - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + "errors" + + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,6 +16,8 @@ const ( DefaultGasCostHumanAddress = 5 // DefaultGasCostCanonicalAddress is how much SDK gas we charge to convert to a canonical address format DefaultGasCostCanonicalAddress = 4 + // DefaultGasCostValidateAddress is how much SDK gas we charge to validate an address + DefaultGasCostValidateAddress = DefaultGasCostHumanAddress + DefaultGasCostCanonicalAddress // DefaultDeserializationCostPerByte The formula should be `len(data) * deserializationCostPerByte` DefaultDeserializationCostPerByte = 1 @@ -22,25 +26,39 @@ const ( var ( costHumanize = DefaultGasCostHumanAddress * types.DefaultGasMultiplier costCanonical = DefaultGasCostCanonicalAddress * types.DefaultGasMultiplier + costValidate = DefaultGasCostValidateAddress * types.DefaultGasMultiplier costJSONDeserialization = wasmvmtypes.UFraction{ Numerator: DefaultDeserializationCostPerByte * types.DefaultGasMultiplier, Denominator: 1, } ) -func humanAddress(canon []byte) (string, uint64, error) { +func humanizeAddress(canon []byte) (string, uint64, error) { if err := sdk.VerifyAddressFormat(canon); err != nil { return "", costHumanize, err } return sdk.AccAddress(canon).String(), costHumanize, nil } -func canonicalAddress(human string) ([]byte, uint64, error) { +func canonicalizeAddress(human string) ([]byte, uint64, error) { bz, err := sdk.AccAddressFromBech32(human) return bz, costCanonical, err } +func validateAddress(human string) (uint64, error) { + canonicalized, err := sdk.AccAddressFromBech32(human) + if err != nil { + return costValidate, err + } + // AccAddressFromBech32 already calls VerifyAddressFormat, so we can just humanize and compare + if canonicalized.String() != human { + return costValidate, errors.New("address not normalized") + } + return costValidate, nil +} + var cosmwasmAPI = wasmvm.GoAPI{ - HumanAddress: humanAddress, - CanonicalAddress: canonicalAddress, + HumanizeAddress: humanizeAddress, + CanonicalizeAddress: canonicalizeAddress, + ValidateAddress: validateAddress, } diff --git a/x/wasm/keeper/api_test.go b/x/wasm/keeper/api_test.go new file mode 100644 index 0000000000..752ac1dc4a --- /dev/null +++ b/x/wasm/keeper/api_test.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestValidateAddress(t *testing.T) { + specs := map[string]struct { + human string + valid bool + }{ + "valid address": { + human: RandomBech32AccountAddress(t), + valid: true, + }, + "invalid address": { + human: "cosmos1invalid", + valid: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + _, err := validateAddress(spec.human) + + if spec.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/wasm/keeper/bench_test.go b/x/wasm/keeper/bench_test.go index 500d97cc54..19bb7de44d 100644 --- a/x/wasm/keeper/bench_test.go +++ b/x/wasm/keeper/bench_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - dbm "github.com/cometbft/cometbft-db" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" diff --git a/x/wasm/keeper/capabilities.go b/x/wasm/keeper/capabilities.go new file mode 100644 index 0000000000..b8b53d03df --- /dev/null +++ b/x/wasm/keeper/capabilities.go @@ -0,0 +1,20 @@ +package keeper + +// BuiltInCapabilities returns all capabilities currently supported by this version of x/wasm. +// See also https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md. +// +// Use this directly or together with your chain's custom capabilities (if any): +// +// append(wasmkeeper.BuiltInCapabilities(), "token_factory") +func BuiltInCapabilities() []string { + return []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + "cosmwasm_2_0", + } +} diff --git a/x/wasm/keeper/contract_keeper.go b/x/wasm/keeper/contract_keeper.go index 2cd482970e..3faf459bdf 100644 --- a/x/wasm/keeper/contract_keeper.go +++ b/x/wasm/keeper/contract_keeper.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -10,10 +12,10 @@ var _ types.ContractOpsKeeper = PermissionedKeeper{} // decoratedKeeper contains a subset of the wasm keeper that are already or can be guarded by an authorization policy in the future type decoratedKeeper interface { - create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ types.AuthorizationPolicy) (codeID uint64, checksum []byte, err error) + create(ctx context.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ types.AuthorizationPolicy) (codeID uint64, checksum []byte, err error) instantiate( - ctx sdk.Context, + ctx context.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, @@ -23,14 +25,14 @@ type decoratedKeeper interface { authZ types.AuthorizationPolicy, ) (sdk.AccAddress, []byte, error) - migrate(ctx sdk.Context, contractAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ types.AuthorizationPolicy) ([]byte, error) - setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ types.AuthorizationPolicy) error - pinCode(ctx sdk.Context, codeID uint64) error - unpinCode(ctx sdk.Context, codeID uint64) error - execute(ctx sdk.Context, contractAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) - Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) - setContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error - setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, autz types.AuthorizationPolicy) error + migrate(ctx context.Context, contractAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ types.AuthorizationPolicy) ([]byte, error) + setContractAdmin(ctx context.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ types.AuthorizationPolicy) error + pinCode(ctx context.Context, codeID uint64) error + unpinCode(ctx context.Context, codeID uint64) error + execute(ctx context.Context, contractAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) + Sudo(ctx context.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) + setContractInfoExtension(ctx context.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error + setAccessConfig(ctx context.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, autz types.AuthorizationPolicy) error ClassicAddressGenerator() AddressGenerator } @@ -55,7 +57,7 @@ func (p PermissionedKeeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasm return p.nested.create(ctx, creator, wasmCode, instantiateAccess, p.authZPolicy) } -// AuthZActionInstantiate creates an instance of a WASM contract using the classic sequence based address generator +// Instantiate creates an instance of a WASM contract using the classic sequence based address generator func (p PermissionedKeeper) Instantiate( ctx sdk.Context, codeID uint64, diff --git a/x/wasm/keeper/contract_keeper_test.go b/x/wasm/keeper/contract_keeper_test.go index e816ac096b..e917367d20 100644 --- a/x/wasm/keeper/contract_keeper_test.go +++ b/x/wasm/keeper/contract_keeper_test.go @@ -10,6 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" @@ -18,7 +20,7 @@ import ( func TestInstantiate2(t *testing.T) { parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) - parentCtx = parentCtx.WithGasMeter(sdk.NewInfiniteGasMeter()) + parentCtx = parentCtx.WithGasMeter(storetypes.NewInfiniteGasMeter()) example := StoreHackatomExampleContract(t, parentCtx, keepers) otherExample := StoreReflectContract(t, parentCtx, keepers) @@ -37,7 +39,6 @@ func TestInstantiate2(t *testing.T) { ) // create instances for duplicate checks exampleContract := func(t *testing.T, ctx sdk.Context, fixMsg bool) { - t.Helper() _, _, err := keepers.ContractKeeper.Instantiate2( ctx, example.CodeID, @@ -52,11 +53,9 @@ func TestInstantiate2(t *testing.T) { require.NoError(t, err) } exampleWithFixMsg := func(t *testing.T, ctx sdk.Context) { - t.Helper() exampleContract(t, ctx, true) } exampleWithoutFixMsg := func(t *testing.T, ctx sdk.Context) { - t.Helper() exampleContract(t, ctx, false) } specs := map[string]struct { diff --git a/x/wasm/keeper/events.go b/x/wasm/keeper/events.go index b50719d461..5cfb075b2e 100644 --- a/x/wasm/keeper/events.go +++ b/x/wasm/keeper/events.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" errorsmod "cosmossdk.io/errors" @@ -28,7 +28,7 @@ func newWasmModuleEvent(customAttributes []wasmvmtypes.EventAttribute, contractA const eventTypeMinLength = 2 // newCustomEvents converts wasmvm events from a contract response to sdk type events -func newCustomEvents(evts wasmvmtypes.Events, contractAddr sdk.AccAddress) (sdk.Events, error) { +func newCustomEvents(evts wasmvmtypes.Array[wasmvmtypes.Event], contractAddr sdk.AccAddress) (sdk.Events, error) { events := make(sdk.Events, 0, len(evts)) for _, e := range evts { typ := strings.TrimSpace(e.Type) diff --git a/x/wasm/keeper/events_test.go b/x/wasm/keeper/events_test.go index f3e5cc73f2..6516703ec5 100644 --- a/x/wasm/keeper/events_test.go +++ b/x/wasm/keeper/events_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,12 +56,12 @@ func TestHasWasmModuleEvent(t *testing.T) { func TestNewCustomEvents(t *testing.T) { myContract := RandomAccountAddress(t) specs := map[string]struct { - src wasmvmtypes.Events + src wasmvmtypes.Array[wasmvmtypes.Event] exp sdk.Events isError bool }{ "all good": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myVal"}}, }}, @@ -70,7 +70,7 @@ func TestNewCustomEvents(t *testing.T) { sdk.NewAttribute("myKey", "myVal"))}, }, "multiple attributes": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{ {Key: "myKey", Value: "myVal"}, @@ -83,7 +83,7 @@ func TestNewCustomEvents(t *testing.T) { sdk.NewAttribute("myOtherKey", "myOtherVal"))}, }, "multiple events": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "myVal"}}, }, { @@ -100,14 +100,14 @@ func TestNewCustomEvents(t *testing.T) { }, }, "without attributes": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", }}, exp: sdk.Events{sdk.NewEvent("wasm-foo", sdk.NewAttribute("_contract_address", myContract.String()))}, }, "empty value can be solved": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: ""}}, }}, @@ -116,7 +116,7 @@ func TestNewCustomEvents(t *testing.T) { sdk.NewAttribute("myKey", ""))}, }, "good on whitespace value": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "myKey", Value: "\n\n\n"}}, }}, exp: sdk.Events{sdk.NewEvent("wasm-foo", @@ -124,20 +124,20 @@ func TestNewCustomEvents(t *testing.T) { sdk.NewAttribute("myKey", ""))}, }, "error on short event type": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "f", }}, isError: true, }, "error on _contract_address": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "foo", Attributes: []wasmvmtypes.EventAttribute{{Key: "_contract_address", Value: RandomBech32AccountAddress(t)}}, }}, isError: true, }, "error on reserved prefix": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "wasm", Attributes: []wasmvmtypes.EventAttribute{ {Key: "_reserved", Value: "is skipped"}, @@ -147,7 +147,7 @@ func TestNewCustomEvents(t *testing.T) { isError: true, }, "error on empty key": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "boom", Attributes: []wasmvmtypes.EventAttribute{ {Key: "some", Value: "data"}, @@ -157,7 +157,7 @@ func TestNewCustomEvents(t *testing.T) { isError: true, }, "error on whitespace type": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: " f ", Attributes: []wasmvmtypes.EventAttribute{ {Key: "some", Value: "data"}, @@ -166,7 +166,7 @@ func TestNewCustomEvents(t *testing.T) { isError: true, }, "error on only whitespace key": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: "boom", Attributes: []wasmvmtypes.EventAttribute{ {Key: "some", Value: "data"}, @@ -176,7 +176,7 @@ func TestNewCustomEvents(t *testing.T) { isError: true, }, "strip out whitespace": { - src: wasmvmtypes.Events{{ + src: wasmvmtypes.Array[wasmvmtypes.Event]{{ Type: " food\n", Attributes: []wasmvmtypes.EventAttribute{{Key: "my Key", Value: "\tmyVal"}}, }}, @@ -185,7 +185,7 @@ func TestNewCustomEvents(t *testing.T) { sdk.NewAttribute("my Key", "myVal"))}, }, "empty event elements": { - src: make(wasmvmtypes.Events, 10), + src: make(wasmvmtypes.Array[wasmvmtypes.Event], 10), isError: true, }, "nil": { diff --git a/x/wasm/keeper/genesis.go b/x/wasm/keeper/genesis.go index d2862c5b1a..2608770661 100644 --- a/x/wasm/keeper/genesis.go +++ b/x/wasm/keeper/genesis.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + abci "github.com/cometbft/cometbft/abci/types" errorsmod "cosmossdk.io/errors" @@ -13,7 +15,7 @@ import ( // ValidatorSetSource is a subset of the staking keeper type ValidatorSetSource interface { - ApplyAndReturnValidatorSetUpdates(sdk.Context) (updates []abci.ValidatorUpdate, err error) + ApplyAndReturnValidatorSetUpdates(context.Context) (updates []abci.ValidatorUpdate, err error) } // InitGenesis sets supply information for genesis. @@ -61,13 +63,19 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState, msgRo } // sanity check seq values - seqVal := keeper.PeekAutoIncrementID(ctx, types.KeySequenceCodeID) + seqVal, err := keeper.PeekAutoIncrementID(ctx, types.KeySequenceCodeID) + if err != nil { + return nil, err + } if seqVal <= maxCodeID { return nil, errorsmod.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeySequenceCodeID), seqVal, maxCodeID) } // ensure next classic address is unused so that we know the sequence is good rCtx, _ := ctx.CacheContext() - seqVal = keeper.PeekAutoIncrementID(rCtx, types.KeySequenceInstanceID) + seqVal, err = keeper.PeekAutoIncrementID(rCtx, types.KeySequenceInstanceID) + if err != nil { + return nil, err + } addr := keeper.ClassicAddressGenerator()(rCtx, seqVal, nil) if keeper.HasContractInfo(ctx, addr) { return nil, errorsmod.Wrapf(types.ErrInvalid, "value: %d for seq %s was used already", seqVal, string(types.KeySequenceInstanceID)) @@ -79,12 +87,12 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState, msgRo for _, genTx := range data.GenMsgs { msg := genTx.AsMsg() if msg == nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "unknown message") + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "unknown message") } handler := msgRouter.Handler(msg) _, err := handler(ctx, msg) if err != nil { - return nil, sdkerrors.Wrap(err, "genesis") + return nil, errorsmod.Wrap(err, "genesis") } } return nil, nil @@ -129,9 +137,13 @@ func ExportGenesis(ctx sdk.Context, keeper *Keeper) *types.GenesisState { }) for _, k := range [][]byte{types.KeySequenceCodeID, types.KeySequenceInstanceID} { + id, err := keeper.PeekAutoIncrementID(ctx, k) + if err != nil { + panic(err) + } genState.Sequences = append(genState.Sequences, types.Sequence{ IDKey: k, - Value: keeper.PeekAutoIncrementID(ctx, k), + Value: id, }) } diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 7516172b4f..41d983326e 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -11,18 +11,22 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - dbm "github.com/cometbft/cometbft-db" + wasmvm "github.com/CosmWasm/wasmvm/v2" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" fuzz "github.com/google/gofuzz" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + "cosmossdk.io/math" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -83,8 +87,8 @@ func TestGenesisExportImport(t *testing.T) { contract.CodeID = codeID contractAddr := wasmKeeper.ClassicAddressGenerator()(srcCtx, codeID, nil) - wasmKeeper.storeContractInfo(srcCtx, contractAddr, &contract) - wasmKeeper.appendToContractHistory(srcCtx, contractAddr, history...) + wasmKeeper.mustStoreContractInfo(srcCtx, contractAddr, &contract) + require.NoError(t, wasmKeeper.appendToContractHistory(srcCtx, contractAddr, history...)) err = wasmKeeper.importContractState(srcCtx, contractAddr, stateModels) require.NoError(t, err) } @@ -116,8 +120,10 @@ func TestGenesisExportImport(t *testing.T) { creatorAddress := sdk.MustAccAddressFromBech32(info.Creator) history := wasmKeeper.GetContractHistory(srcCtx, address) - wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, history[len(history)-1]) - wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, history[0].Updated, address) + err = wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, history[len(history)-1]) + require.NoError(t, err) + err = wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, history[0].Updated, address) + require.NoError(t, err) return false }) @@ -133,8 +139,10 @@ func TestGenesisExportImport(t *testing.T) { // compare whole DB - srcIT := srcCtx.KVStore(wasmKeeper.storeKey).Iterator(nil, nil) - dstIT := dstCtx.KVStore(dstKeeper.storeKey).Iterator(nil, nil) + srcIT, err := wasmKeeper.storeService.OpenKVStore(srcCtx).Iterator(nil, nil) + require.NoError(t, err) + dstIT, err := dstKeeper.storeService.OpenKVStore(dstCtx).Iterator(nil, nil) + require.NoError(t, err) t.Cleanup(func() { types.MaxWasmSize = originalMaxWasmSize @@ -143,9 +151,9 @@ func TestGenesisExportImport(t *testing.T) { }) for i := 0; srcIT.Valid(); i++ { - require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing: %x", wasmKeeper.storeKey.Name(), srcIT.Key()) + require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing", srcIT.Key()) require.Equal(t, srcIT.Key(), dstIT.Key(), i) - require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element (%d): %X", wasmKeeper.storeKey.Name(), i, srcIT.Key()) + require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element: %X", i, srcIT.Key()) dstIT.Next() srcIT.Next() } @@ -609,7 +617,7 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) { require.NoError(t, err) require.NoError(t, importState.ValidateBasic(), genesisStr) - ctx = ctx.WithBlockHeight(0).WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx = ctx.WithBlockHeight(0).WithGasMeter(storetypes.NewInfiniteGasMeter()) // when _, err = InitGenesis(ctx, keeper, importState, TestHandler(contractKeeper)) @@ -671,8 +679,12 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) { }, } assert.Equal(t, expHistory, keeper.GetContractHistory(ctx, contractAddr)) - assert.Equal(t, uint64(2), keeper.PeekAutoIncrementID(ctx, types.KeySequenceCodeID)) - assert.Equal(t, uint64(3), keeper.PeekAutoIncrementID(ctx, types.KeySequenceInstanceID)) + id, err := keeper.PeekAutoIncrementID(ctx, types.KeySequenceCodeID) + require.NoError(t, err) + assert.Equal(t, uint64(2), id) + id, err = keeper.PeekAutoIncrementID(ctx, types.KeySequenceInstanceID) + require.NoError(t, err) + assert.Equal(t, uint64(3), id) } func TestSupportedGenMsgTypes(t *testing.T) { @@ -705,7 +717,7 @@ func TestSupportedGenMsgTypes(t *testing.T) { Verifier: verifierAddress, Beneficiary: beneficiaryAddress, }.GetBytes(t), - Funds: sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(10))), + Funds: sdk.NewCoins(sdk.NewCoin(denom, math.NewInt(10))), }, }, }, @@ -723,8 +735,8 @@ func TestSupportedGenMsgTypes(t *testing.T) { require.NoError(t, importState.ValidateBasic()) ctx, keepers := CreateDefaultTestInput(t) keeper := keepers.WasmKeeper - ctx = ctx.WithBlockHeight(0).WithGasMeter(sdk.NewInfiniteGasMeter()) - keepers.Faucet.Fund(ctx, myAddress, sdk.NewCoin(denom, sdk.NewInt(100))) + ctx = ctx.WithBlockHeight(0).WithGasMeter(storetypes.NewInfiniteGasMeter()) + keepers.Faucet.Fund(ctx, myAddress, sdk.NewCoin(denom, math.NewInt(100))) // when _, err = InitGenesis(ctx, keeper, importState, TestHandler(keepers.ContractKeeper)) @@ -743,7 +755,7 @@ func TestSupportedGenMsgTypes(t *testing.T) { // verify contract executed gotBalance := keepers.BankKeeper.GetBalance(ctx, beneficiaryAddress, denom) - assert.Equal(t, sdk.NewCoin(denom, sdk.NewInt(10)), gotBalance) + assert.Equal(t, sdk.NewCoin(denom, math.NewInt(10)), gotBalance) } func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { @@ -752,14 +764,14 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { require.NoError(t, err) t.Cleanup(func() { os.RemoveAll(tempDir) }) - keyWasm := sdk.NewKVStoreKey(types.StoreKey) + keyWasm := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) + ms := store.NewCommitMultiStore(db, log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db) require.NoError(t, ms.LoadLatestVersion()) - ctx := sdk.NewContext(ms, tmproto.Header{ + ctx := sdk.NewContext(ms, cmtproto.Header{ Height: 1234567, Time: time.Date(2020, time.April, 22, 12, 0, 0, 0, time.UTC), }, false, log.NewNopLogger()) @@ -777,7 +789,7 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context) { srcKeeper := NewKeeper( encodingConfig.Codec, - keyWasm, + runtime.NewKVStoreService(keyWasm), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index e812411c51..50bd1a1b67 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -4,13 +4,14 @@ import ( "errors" "fmt" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -33,6 +34,7 @@ type MessageRouter interface { type SDKMessageHandler struct { router MessageRouter encoders msgEncoder + cdc codec.Codec } // NewDefaultMessageHandler constructor @@ -42,40 +44,42 @@ func NewDefaultMessageHandler( channelKeeper types.ChannelKeeper, capabilityKeeper types.CapabilityKeeper, bankKeeper types.Burner, - unpacker codectypes.AnyUnpacker, + cdc codec.Codec, portSource types.ICS20TransferPortSource, customEncoders ...*MessageEncoders, ) Messenger { - encoders := DefaultEncoders(unpacker, portSource) + encoders := DefaultEncoders(cdc, portSource) for _, e := range customEncoders { encoders = encoders.Merge(e) } return NewMessageHandlerChain( - NewSDKMessageHandler(router, encoders), + NewSDKMessageHandler(cdc, router, encoders), NewIBCRawPacketHandler(ics4Wrapper, channelKeeper, capabilityKeeper), NewBurnCoinMessageHandler(bankKeeper), ) } -func NewSDKMessageHandler(router MessageRouter, encoders msgEncoder) SDKMessageHandler { +func NewSDKMessageHandler(cdc codec.Codec, router MessageRouter, encoders msgEncoder) SDKMessageHandler { return SDKMessageHandler{ + cdc: cdc, router: router, encoders: encoders, } } -func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { +func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { sdkMsgs, err := h.encoders.Encode(ctx, contractAddr, contractIBCPortID, msg) if err != nil { - return nil, nil, err + return nil, nil, nil, err } for _, sdkMsg := range sdkMsgs { res, err := h.handleSdkMessage(ctx, contractAddr, sdkMsg) if err != nil { - return nil, nil, err + return nil, nil, nil, err } - // append data + // append data and msgResponses data = append(data, res.Data) + msgResponses = append(msgResponses, res.MsgResponses) // append events sdkEvents := make([]sdk.Event, len(res.Events)) for i := range res.Events { @@ -87,15 +91,24 @@ func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddr } func (h SDKMessageHandler) handleSdkMessage(ctx sdk.Context, contractAddr sdk.Address, msg sdk.Msg) (*sdk.Result, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err + // todo: this block needs proper review from sdk team + if m, ok := msg.(sdk.HasValidateBasic); ok { + if err := m.ValidateBasic(); err != nil { + return nil, err + } } + // make sure this account can send it - for _, acct := range msg.GetSigners() { - if !acct.Equals(contractAddr) { + signers, _, err := h.cdc.GetMsgV1Signers(msg) + if err != nil { + return nil, err + } + for _, acct := range signers { + if !contractAddr.Equals(sdk.AccAddress(acct)) { return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "contract doesn't have permission") } } + // --- end block // find the handler and execute it if handler := h.router.Handler(msg); handler != nil { @@ -130,19 +143,19 @@ func NewMessageHandlerChain(first Messenger, others ...Messenger) *MessageHandle // order to find the right one to process given message. If a handler cannot // process given message (returns ErrUnknownMsg), its result is ignored and the // next handler is executed. -func (m MessageHandlerChain) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) { +func (m MessageHandlerChain) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { for _, h := range m.handlers { - events, data, err := h.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) + events, data, msgResponses, err := h.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) switch { case err == nil: - return events, data, nil + return events, data, msgResponses, nil case errors.Is(err, types.ErrUnknownMsg): continue default: - return events, data, err + return events, data, msgResponses, err } } - return nil, nil, errorsmod.Wrap(types.ErrUnknownMsg, "no handler found") + return nil, nil, nil, errorsmod.Wrap(types.ErrUnknownMsg, "no handler found") } // IBCRawPacketHandler handles IBC.SendPacket messages which are published to an IBC channel. @@ -162,67 +175,72 @@ func NewIBCRawPacketHandler(ics4Wrapper types.ICS4Wrapper, channelKeeper types.C } // DispatchMsg publishes a raw IBC packet onto the channel. -func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) { +func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { if msg.IBC == nil || msg.IBC.SendPacket == nil { - return nil, nil, types.ErrUnknownMsg + return nil, nil, nil, types.ErrUnknownMsg } if contractIBCPortID == "" { - return nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc not supported") + return nil, nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc not supported") } contractIBCChannelID := msg.IBC.SendPacket.ChannelID if contractIBCChannelID == "" { - return nil, nil, errorsmod.Wrapf(types.ErrEmpty, "ibc channel") + return nil, nil, nil, errorsmod.Wrapf(types.ErrEmpty, "ibc channel") } channelCap, ok := h.capabilityKeeper.GetCapability(ctx, host.ChannelCapabilityPath(contractIBCPortID, contractIBCChannelID)) if !ok { - return nil, nil, errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") + return nil, nil, nil, errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") } seq, err := h.ics4Wrapper.SendPacket(ctx, channelCap, contractIBCPortID, contractIBCChannelID, ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block), msg.IBC.SendPacket.Timeout.Timestamp, msg.IBC.SendPacket.Data) if err != nil { - return nil, nil, errorsmod.Wrap(err, "channel") + return nil, nil, nil, errorsmod.Wrap(err, "channel") } moduleLogger(ctx).Debug("ibc packet set", "seq", seq) resp := &types.MsgIBCSendResponse{Sequence: seq} val, err := resp.Marshal() if err != nil { - return nil, nil, errorsmod.Wrap(err, "failed to marshal IBC send response") + return nil, nil, nil, errorsmod.Wrap(err, "failed to marshal IBC send response") + } + any, err := codectypes.NewAnyWithValue(resp) + if err != nil { + return nil, nil, nil, errorsmod.Wrap(err, "failed to convert IBC send response to Any") } + msgResponses := [][]*codectypes.Any{{any}} - return nil, [][]byte{val}, nil + return nil, [][]byte{val}, msgResponses, nil } var _ Messenger = MessageHandlerFunc(nil) // MessageHandlerFunc is a helper to construct a function based message handler. -type MessageHandlerFunc func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) +type MessageHandlerFunc func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) // DispatchMsg delegates dispatching of provided message into the MessageHandlerFunc. -func (m MessageHandlerFunc) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { +func (m MessageHandlerFunc) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { return m(ctx, contractAddr, contractIBCPortID, msg) } // NewBurnCoinMessageHandler handles wasmvm.BurnMsg messages func NewBurnCoinMessageHandler(burner types.Burner) MessageHandlerFunc { - return func(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + return func(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { if msg.Bank != nil && msg.Bank.Burn != nil { coins, err := ConvertWasmCoinsToSdkCoins(msg.Bank.Burn.Amount) if err != nil { - return nil, nil, err + return nil, nil, nil, err } if coins.IsZero() { - return nil, nil, types.ErrEmpty.Wrap("amount") + return nil, nil, nil, types.ErrEmpty.Wrap("amount") } if err := burner.SendCoinsFromAccountToModule(ctx, contractAddr, types.ModuleName, coins); err != nil { - return nil, nil, errorsmod.Wrap(err, "transfer to module") + return nil, nil, nil, errorsmod.Wrap(err, "transfer to module") } if err := burner.BurnCoins(ctx, types.ModuleName, coins); err != nil { - return nil, nil, errorsmod.Wrap(err, "burn coins") + return nil, nil, nil, errorsmod.Wrap(err, "burn coins") } moduleLogger(ctx).Info("Burned", "amount", coins) - return nil, nil, nil + return nil, nil, nil, nil } - return nil, nil, types.ErrUnknownMsg + return nil, nil, nil, types.ErrUnknownMsg } } diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go index 5e07ac7e69..5ae2313e9b 100644 --- a/x/wasm/keeper/handler_plugin_encoders.go +++ b/x/wasm/keeper/handler_plugin_encoders.go @@ -4,12 +4,13 @@ import ( "encoding/json" "fmt" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,7 +28,7 @@ type ( CustomEncoder func(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error) DistributionEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error) StakingEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error) - StargateEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error) + AnyEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.AnyMsg) ([]sdk.Msg, error) WasmEncoder func(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error) IBCEncoder func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *wasmvmtypes.IBCMsg) ([]sdk.Msg, error) ) @@ -38,7 +39,7 @@ type MessageEncoders struct { Distribution func(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error) IBC func(ctx sdk.Context, sender sdk.AccAddress, contractIBCPortID string, msg *wasmvmtypes.IBCMsg) ([]sdk.Msg, error) Staking func(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk.Msg, error) - Stargate func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error) + Any func(sender sdk.AccAddress, msg *wasmvmtypes.AnyMsg) ([]sdk.Msg, error) Wasm func(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg, error) Gov func(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error) } @@ -50,7 +51,7 @@ func DefaultEncoders(unpacker codectypes.AnyUnpacker, portSource types.ICS20Tran Distribution: EncodeDistributionMsg, IBC: EncodeIBCMsg(portSource), Staking: EncodeStakingMsg, - Stargate: EncodeStargateMsg(unpacker), + Any: EncodeAnyMsg(unpacker), Wasm: EncodeWasmMsg, Gov: EncodeGovMsg, } @@ -75,8 +76,8 @@ func (e MessageEncoders) Merge(o *MessageEncoders) MessageEncoders { if o.Staking != nil { e.Staking = o.Staking } - if o.Stargate != nil { - e.Stargate = o.Stargate + if o.Any != nil { + e.Any = o.Any } if o.Wasm != nil { e.Wasm = o.Wasm @@ -99,8 +100,8 @@ func (e MessageEncoders) Encode(ctx sdk.Context, contractAddr sdk.AccAddress, co return e.IBC(ctx, contractAddr, contractIBCPortID, msg.IBC) case msg.Staking != nil: return e.Staking(contractAddr, msg.Staking) - case msg.Stargate != nil: - return e.Stargate(contractAddr, msg.Stargate) + case msg.Any != nil: + return e.Any(contractAddr, msg.Any) case msg.Wasm != nil: return e.Wasm(contractAddr, msg.Wasm) case msg.Gov != nil: @@ -203,8 +204,8 @@ func EncodeStakingMsg(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk } } -func EncodeStargateMsg(unpacker codectypes.AnyUnpacker) StargateEncoder { - return func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error) { +func EncodeAnyMsg(unpacker codectypes.AnyUnpacker) AnyEncoder { + return func(sender sdk.AccAddress, msg *wasmvmtypes.AnyMsg) ([]sdk.Msg, error) { codecAny := codectypes.Any{ TypeUrl: msg.TypeURL, Value: msg.Value, @@ -316,6 +317,7 @@ func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context Receiver: msg.Transfer.ToAddress, TimeoutHeight: ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.Transfer.Timeout.Block), TimeoutTimestamp: msg.Transfer.Timeout.Timestamp, + Memo: msg.Transfer.Memo, } return []sdk.Msg{msg}, nil default: @@ -327,7 +329,7 @@ func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error) { switch { case msg.Vote != nil: - voteOption, err := convertVoteOption(msg.Vote.Vote) + voteOption, err := convertVoteOption(msg.Vote.Option) if err != nil { return nil, errorsmod.Wrap(err, "vote option") } @@ -336,7 +338,7 @@ func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, er case msg.VoteWeighted != nil: opts := make([]*v1.WeightedVoteOption, len(msg.VoteWeighted.Options)) for i, v := range msg.VoteWeighted.Options { - weight, err := sdk.NewDecFromStr(v.Weight) + weight, err := sdkmath.LegacyNewDecFromStr(v.Weight) if err != nil { return nil, errorsmod.Wrapf(err, "weight for vote %d", i+1) } @@ -394,7 +396,7 @@ func ConvertWasmCoinsToSdkCoins(coins []wasmvmtypes.Coin) (sdk.Coins, error) { // ConvertWasmCoinToSdkCoin converts a wasm vm type coin to sdk type coin func ConvertWasmCoinToSdkCoin(coin wasmvmtypes.Coin) (sdk.Coin, error) { - amount, ok := sdk.NewIntFromString(coin.Amount) + amount, ok := sdkmath.NewIntFromString(coin.Amount) if !ok { return sdk.Coin{}, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coin.Amount+coin.Denom) } diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go index 6ef32a3d53..6aded5f113 100644 --- a/x/wasm/keeper/handler_plugin_encoders_test.go +++ b/x/wasm/keeper/handler_plugin_encoders_test.go @@ -3,19 +3,21 @@ package keeper import ( "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cosmos/gogoproto/proto" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" @@ -49,7 +51,7 @@ func TestEncoding(t *testing.T) { msg, err := codectypes.NewAnyWithValue(types.MsgStoreCodeFixture()) require.NoError(t, err) - proposalMsg := &v1.MsgSubmitProposal{ + proposalMsg := &govv1.MsgSubmitProposal{ Proposer: addr1.String(), Messages: []*codectypes.Any{msg}, InitialDeposit: sdk.NewCoins(sdk.NewInt64Coin("uatom", 12345)), @@ -60,16 +62,12 @@ func TestEncoding(t *testing.T) { require.NoError(t, err) cases := map[string]struct { - sender sdk.AccAddress - srcMsg wasmvmtypes.CosmosMsg - srcContractIBCPort string - transferPortSource types.ICS20TransferPortSource + sender sdk.AccAddress + srcMsg wasmvmtypes.CosmosMsg // set if valid output []sdk.Msg // set if expect mapping fails expError bool - // set if sdk validate basic should fail - expInvalid bool }{ "simple send": { sender: addr1, @@ -133,8 +131,7 @@ func TestEncoding(t *testing.T) { }, }, }, - expError: false, // addresses are checked in the handler - expInvalid: true, + expError: false, // addresses are checked in the handler output: []sdk.Msg{ &banktypes.MsgSend{ FromAddress: addr1.String(), @@ -304,8 +301,7 @@ func TestEncoding(t *testing.T) { }, }, }, - expError: false, // fails in the handler - expInvalid: true, + expError: false, // fails in the handler output: []sdk.Msg{ &stakingtypes.MsgDelegate{ DelegatorAddress: addr1.String(), @@ -389,7 +385,7 @@ func TestEncoding(t *testing.T) { srcMsg: wasmvmtypes.CosmosMsg{ Distribution: &wasmvmtypes.DistributionMsg{ FundCommunityPool: &wasmvmtypes.FundCommunityPoolMsg{ - Amount: wasmvmtypes.Coins{ + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{ wasmvmtypes.NewCoin(200, "stones"), wasmvmtypes.NewCoin(200, "feathers"), }, @@ -409,7 +405,7 @@ func TestEncoding(t *testing.T) { "stargate encoded bank msg": { sender: addr2, srcMsg: wasmvmtypes.CosmosMsg{ - Stargate: &wasmvmtypes.StargateMsg{ + Any: &wasmvmtypes.AnyMsg{ TypeURL: "/cosmos.bank.v1beta1.MsgSend", Value: bankMsgBin, }, @@ -419,7 +415,7 @@ func TestEncoding(t *testing.T) { "stargate encoded msg with any type": { sender: addr2, srcMsg: wasmvmtypes.CosmosMsg{ - Stargate: &wasmvmtypes.StargateMsg{ + Any: &wasmvmtypes.AnyMsg{ TypeURL: "/cosmos.gov.v1.MsgSubmitProposal", Value: proposalMsgBin, }, @@ -429,13 +425,45 @@ func TestEncoding(t *testing.T) { "stargate encoded invalid typeUrl": { sender: addr2, srcMsg: wasmvmtypes.CosmosMsg{ - Stargate: &wasmvmtypes.StargateMsg{ + Any: &wasmvmtypes.AnyMsg{ TypeURL: "/cosmos.bank.v2.MsgSend", Value: bankMsgBin, }, }, expError: true, }, + } + encodingConfig := MakeEncodingConfig(t) + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + encoder := DefaultEncoders(encodingConfig.Codec, wasmtesting.MockIBCTransferKeeper{}) + res, err := encoder.Encode(sdk.Context{}, tc.sender, "", tc.srcMsg) + if tc.expError { + assert.Error(t, err) + return + } + require.NoError(t, err) + assert.Equal(t, tc.output, res) + }) + } +} + +func TestEncodeIbcMsg(t *testing.T) { + var ( + addr1 = RandomAccountAddress(t) + addr2 = RandomAccountAddress(t) + ) + + cases := map[string]struct { + sender sdk.AccAddress + srcMsg wasmvmtypes.CosmosMsg + srcContractIBCPort string + transferPortSource types.ICS20TransferPortSource + // set if valid + output []sdk.Msg + // set if expect mapping fails + expError bool + }{ "IBC transfer with block timeout": { sender: addr1, srcContractIBCPort: "myIBCPort", @@ -463,7 +491,7 @@ func TestEncoding(t *testing.T) { SourceChannel: "myChanID", Token: sdk.Coin{ Denom: "ALX", - Amount: sdk.NewInt(1), + Amount: sdkmath.NewInt(1), }, Sender: addr1.String(), Receiver: addr2.String(), @@ -496,7 +524,7 @@ func TestEncoding(t *testing.T) { SourceChannel: "myChanID", Token: sdk.Coin{ Denom: "ALX", - Amount: sdk.NewInt(1), + Amount: sdkmath.NewInt(1), }, Sender: addr1.String(), Receiver: addr2.String(), @@ -529,7 +557,7 @@ func TestEncoding(t *testing.T) { SourceChannel: "myChanID", Token: sdk.Coin{ Denom: "ALX", - Amount: sdk.NewInt(1), + Amount: sdkmath.NewInt(1), }, Sender: addr1.String(), Receiver: addr2.String(), @@ -538,6 +566,41 @@ func TestEncoding(t *testing.T) { }, }, }, + "IBC transfer with memo": { + sender: addr1, + srcContractIBCPort: "myIBCPort", + srcMsg: wasmvmtypes.CosmosMsg{ + IBC: &wasmvmtypes.IBCMsg{ + Transfer: &wasmvmtypes.TransferMsg{ + ChannelID: "myChanID", + ToAddress: addr2.String(), + Amount: wasmvmtypes.Coin{ + Denom: "ALX", + Amount: "1", + }, + Timeout: wasmvmtypes.IBCTimeout{Timestamp: 100}, + Memo: "myMemo", + }, + }, + }, + transferPortSource: wasmtesting.MockIBCTransferKeeper{GetPortFn: func(ctx sdk.Context) string { + return "myTransferPort" + }}, + output: []sdk.Msg{ + &ibctransfertypes.MsgTransfer{ + SourcePort: "myTransferPort", + SourceChannel: "myChanID", + Token: sdk.Coin{ + Denom: "ALX", + Amount: sdkmath.NewInt(1), + }, + Sender: addr1.String(), + Receiver: addr2.String(), + TimeoutTimestamp: 100, + Memo: "myMemo", + }, + }, + }, "IBC close channel": { sender: addr1, srcContractIBCPort: "myIBCPort", @@ -569,16 +632,6 @@ func TestEncoding(t *testing.T) { } require.NoError(t, err) assert.Equal(t, tc.output, res) - - // and valid sdk message - for _, v := range res { - gotErr := v.ValidateBasic() - if tc.expInvalid { - assert.Error(t, gotErr) - } else { - assert.NoError(t, gotErr) - } - } }) } } @@ -594,21 +647,19 @@ func TestEncodeGovMsg(t *testing.T) { output []sdk.Msg // set if expect mapping fails expError bool - // set if sdk validate basic should fail - expInvalid bool }{ "Gov vote: yes": { sender: myAddr, srcMsg: wasmvmtypes.CosmosMsg{ Gov: &wasmvmtypes.GovMsg{ - Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Vote: wasmvmtypes.Yes}, + Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Option: wasmvmtypes.Yes}, }, }, output: []sdk.Msg{ - &v1.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: myAddr.String(), - Option: v1.OptionYes, + Option: govv1.OptionYes, }, }, }, @@ -616,14 +667,14 @@ func TestEncodeGovMsg(t *testing.T) { sender: myAddr, srcMsg: wasmvmtypes.CosmosMsg{ Gov: &wasmvmtypes.GovMsg{ - Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Vote: wasmvmtypes.No}, + Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Option: wasmvmtypes.No}, }, }, output: []sdk.Msg{ - &v1.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: myAddr.String(), - Option: v1.OptionNo, + Option: govv1.OptionNo, }, }, }, @@ -631,14 +682,14 @@ func TestEncodeGovMsg(t *testing.T) { sender: myAddr, srcMsg: wasmvmtypes.CosmosMsg{ Gov: &wasmvmtypes.GovMsg{ - Vote: &wasmvmtypes.VoteMsg{ProposalId: 10, Vote: wasmvmtypes.Abstain}, + Vote: &wasmvmtypes.VoteMsg{ProposalId: 10, Option: wasmvmtypes.Abstain}, }, }, output: []sdk.Msg{ - &v1.MsgVote{ + &govv1.MsgVote{ ProposalId: 10, Voter: myAddr.String(), - Option: v1.OptionAbstain, + Option: govv1.OptionAbstain, }, }, }, @@ -646,14 +697,14 @@ func TestEncodeGovMsg(t *testing.T) { sender: myAddr, srcMsg: wasmvmtypes.CosmosMsg{ Gov: &wasmvmtypes.GovMsg{ - Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Vote: wasmvmtypes.NoWithVeto}, + Vote: &wasmvmtypes.VoteMsg{ProposalId: 1, Option: wasmvmtypes.NoWithVeto}, }, }, output: []sdk.Msg{ - &v1.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: myAddr.String(), - Option: v1.OptionNoWithVeto, + Option: govv1.OptionNoWithVeto, }, }, }, @@ -679,11 +730,11 @@ func TestEncodeGovMsg(t *testing.T) { }, }, output: []sdk.Msg{ - &v1.MsgVoteWeighted{ + &govv1.MsgVoteWeighted{ ProposalId: 1, Voter: myAddr.String(), - Options: []*v1.WeightedVoteOption{ - {Option: v1.OptionYes, Weight: sdk.NewDec(1).String()}, + Options: []*govv1.WeightedVoteOption{ + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDec(1).String()}, }, }, }, @@ -704,14 +755,14 @@ func TestEncodeGovMsg(t *testing.T) { }, }, output: []sdk.Msg{ - &v1.MsgVoteWeighted{ + &govv1.MsgVoteWeighted{ ProposalId: 1, Voter: myAddr.String(), - Options: []*v1.WeightedVoteOption{ - {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(23, 2).String()}, - {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(24, 2).String()}, - {Option: v1.OptionAbstain, Weight: sdk.NewDecWithPrec(26, 2).String()}, - {Option: v1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(27, 2).String()}, + Options: []*govv1.WeightedVoteOption{ + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDecWithPrec(23, 2).String()}, + {Option: govv1.OptionNo, Weight: sdkmath.LegacyNewDecWithPrec(24, 2).String()}, + {Option: govv1.OptionAbstain, Weight: sdkmath.LegacyNewDecWithPrec(26, 2).String()}, + {Option: govv1.OptionNoWithVeto, Weight: sdkmath.LegacyNewDecWithPrec(27, 2).String()}, }, }, }, @@ -730,16 +781,15 @@ func TestEncodeGovMsg(t *testing.T) { }, }, output: []sdk.Msg{ - &v1.MsgVoteWeighted{ + &govv1.MsgVoteWeighted{ ProposalId: 1, Voter: myAddr.String(), - Options: []*v1.WeightedVoteOption{ - {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(5, 1).String()}, - {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(5, 1).String()}, + Options: []*govv1.WeightedVoteOption{ + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDecWithPrec(5, 1).String()}, + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDecWithPrec(5, 1).String()}, }, }, }, - expInvalid: true, }, "Gov weighted vote: weight sum exceeds 1- invalid": { sender: myAddr, @@ -755,16 +805,15 @@ func TestEncodeGovMsg(t *testing.T) { }, }, output: []sdk.Msg{ - &v1.MsgVoteWeighted{ + &govv1.MsgVoteWeighted{ ProposalId: 1, Voter: myAddr.String(), - Options: []*v1.WeightedVoteOption{ - {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(51, 2).String()}, - {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(5, 1).String()}, + Options: []*govv1.WeightedVoteOption{ + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDecWithPrec(51, 2).String()}, + {Option: govv1.OptionNo, Weight: sdkmath.LegacyNewDecWithPrec(5, 1).String()}, }, }, }, - expInvalid: true, }, "Gov weighted vote: weight sum less than 1 - invalid": { sender: myAddr, @@ -780,16 +829,15 @@ func TestEncodeGovMsg(t *testing.T) { }, }, output: []sdk.Msg{ - &v1.MsgVoteWeighted{ + &govv1.MsgVoteWeighted{ ProposalId: 1, Voter: myAddr.String(), - Options: []*v1.WeightedVoteOption{ - {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(49, 2).String()}, - {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(5, 1).String()}, + Options: []*govv1.WeightedVoteOption{ + {Option: govv1.OptionYes, Weight: sdkmath.LegacyNewDecWithPrec(49, 2).String()}, + {Option: govv1.OptionNo, Weight: sdkmath.LegacyNewDecWithPrec(5, 1).String()}, }, }, }, - expInvalid: true, }, } encodingConfig := MakeEncodingConfig(t) @@ -804,16 +852,6 @@ func TestEncodeGovMsg(t *testing.T) { } require.NoError(t, gotEncErr) assert.Equal(t, tc.output, res) - - // and valid sdk message - for _, v := range res { - gotErr := v.ValidateBasic() - if tc.expInvalid { - assert.Error(t, gotErr) - } else { - assert.NoError(t, gotErr) - } - } }) } } @@ -829,7 +867,7 @@ func TestConvertWasmCoinToSdkCoin(t *testing.T) { Denom: "foo", Amount: "1", }, - expVal: sdk.NewCoin("foo", sdk.NewIntFromUint64(1)), + expVal: sdk.NewCoin("foo", sdkmath.NewIntFromUint64(1)), }, "negative amount": { src: wasmvmtypes.Coin{ @@ -885,7 +923,7 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { }, "single coin": { src: []wasmvmtypes.Coin{{Denom: "foo", Amount: "1"}}, - exp: sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1))), + exp: sdk.NewCoins(sdk.NewCoin("foo", sdkmath.NewInt(1))), }, "multiple coins": { src: []wasmvmtypes.Coin{ @@ -893,8 +931,8 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { {Denom: "bar", Amount: "2"}, }, exp: sdk.NewCoins( - sdk.NewCoin("bar", sdk.NewInt(2)), - sdk.NewCoin("foo", sdk.NewInt(1)), + sdk.NewCoin("bar", sdkmath.NewInt(2)), + sdk.NewCoin("foo", sdkmath.NewInt(1)), ), }, "sorted": { @@ -904,9 +942,9 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { {Denom: "bar", Amount: "1"}, }, exp: []sdk.Coin{ - sdk.NewCoin("bar", sdk.NewInt(1)), - sdk.NewCoin("foo", sdk.NewInt(1)), - sdk.NewCoin("other", sdk.NewInt(1)), + sdk.NewCoin("bar", sdkmath.NewInt(1)), + sdk.NewCoin("foo", sdkmath.NewInt(1)), + sdk.NewCoin("other", sdkmath.NewInt(1)), }, }, "zero amounts dropped": { @@ -915,7 +953,7 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { {Denom: "bar", Amount: "0"}, }, exp: sdk.NewCoins( - sdk.NewCoin("foo", sdk.NewInt(1)), + sdk.NewCoin("foo", sdkmath.NewInt(1)), ), }, "duplicate denoms merged": { @@ -923,14 +961,14 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { {Denom: "foo", Amount: "1"}, {Denom: "foo", Amount: "1"}, }, - exp: []sdk.Coin{sdk.NewCoin("foo", sdk.NewInt(2))}, + exp: []sdk.Coin{sdk.NewCoin("foo", sdkmath.NewInt(2))}, }, "duplicate denoms with one 0 amount does not fail": { src: []wasmvmtypes.Coin{ {Denom: "foo", Amount: "0"}, {Denom: "foo", Amount: "1"}, }, - exp: []sdk.Coin{sdk.NewCoin("foo", sdk.NewInt(1))}, + exp: []sdk.Coin{sdk.NewCoin("foo", sdkmath.NewInt(1))}, }, "empty denom rejected": { src: []wasmvmtypes.Coin{{Denom: "", Amount: "1"}}, diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index 9fc666b101..01d23ccd39 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -4,21 +4,23 @@ import ( "encoding/json" "testing" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - "github.com/cometbft/cometbft/libs/log" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/baseapp" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -28,13 +30,13 @@ func TestMessageHandlerChainDispatch(t *testing.T) { capturingHandler, gotMsgs := wasmtesting.NewCapturingMessageHandler() alwaysUnknownMsgHandler := &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, types.ErrUnknownMsg + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, types.ErrUnknownMsg }, } assertNotCalledHandler := &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { t.Fatal("not expected to be called") return }, @@ -57,8 +59,8 @@ func TestMessageHandlerChainDispatch(t *testing.T) { }, "stops iteration on handler error": { handlers: []Messenger{&wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, types.ErrInvalidMsg + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, types.ErrInvalidMsg }, }, assertNotCalledHandler}, expErr: types.ErrInvalidMsg, @@ -66,9 +68,9 @@ func TestMessageHandlerChainDispatch(t *testing.T) { "return events when handle": { handlers: []Messenger{ &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - _, data, _ = capturingHandler.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) - return []sdk.Event{sdk.NewEvent("myEvent", sdk.NewAttribute("foo", "bar"))}, data, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + _, data, msgResponses, _ = capturingHandler.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) + return []sdk.Event{sdk.NewEvent("myEvent", sdk.NewAttribute("foo", "bar"))}, data, msgResponses, nil }, }, }, @@ -85,7 +87,7 @@ func TestMessageHandlerChainDispatch(t *testing.T) { // when h := MessageHandlerChain{spec.handlers} - gotEvents, gotData, gotErr := h.DispatchMsg(sdk.Context{}, RandomAccountAddress(t), "anyPort", myMsg) + gotEvents, gotData, gotMsgResponses, gotErr := h.DispatchMsg(sdk.Context{}, RandomAccountAddress(t), "anyPort", myMsg) // then require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr) @@ -94,6 +96,7 @@ func TestMessageHandlerChainDispatch(t *testing.T) { } assert.Equal(t, []wasmvmtypes.CosmosMsg{myMsg}, *gotMsgs) assert.Equal(t, [][]byte{{1}}, gotData) // {1} is default in capturing handler + assert.Equal(t, [][]*codectypes.Any{}, gotMsgResponses) assert.Equal(t, spec.expEvents, gotEvents) }) } @@ -206,8 +209,8 @@ func TestSDKMessageHandlerDispatch(t *testing.T) { // when ctx := sdk.Context{} - h := NewSDKMessageHandler(spec.srcRoute, MessageEncoders{Custom: spec.srcEncoder}) - gotEvents, gotData, gotErr := h.DispatchMsg(ctx, myContractAddr, "myPort", myContractMessage) + h := NewSDKMessageHandler(MakeTestCodec(t), spec.srcRoute, MessageEncoders{Custom: spec.srcEncoder}) + gotEvents, gotData, gotMsgResponses, gotErr := h.DispatchMsg(ctx, myContractAddr, "myPort", myContractMessage) // then require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr) @@ -216,9 +219,11 @@ func TestSDKMessageHandlerDispatch(t *testing.T) { return } assert.Len(t, gotMsg, spec.expMsgDispatched) + assert.Len(t, gotMsgResponses, spec.expMsgDispatched) for i := 0; i < spec.expMsgDispatched; i++ { assert.Equal(t, myEvent, gotEvents[i]) assert.Equal(t, []byte(myData), gotData[i]) + assert.Equal(t, []*codectypes.Any(nil), gotMsgResponses[i]) } }) } @@ -226,7 +231,7 @@ func TestSDKMessageHandlerDispatch(t *testing.T) { func TestIBCRawPacketHandler(t *testing.T) { ibcPort := "contractsIBCPort" - ctx := sdk.Context{}.WithLogger(log.TestingLogger()) + ctx := sdk.Context{}.WithLogger(log.NewTestLogger(t)) type CapturedPacket struct { sourcePort string @@ -307,7 +312,7 @@ func TestIBCRawPacketHandler(t *testing.T) { capturedPacket = nil // when h := NewIBCRawPacketHandler(capturePacketsSenderMock, spec.chanKeeper, spec.capKeeper) - evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}}) //nolint:gosec + evts, data, msgResponses, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}}) //nolint:gosec // then require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr) if spec.expErr != nil { @@ -316,6 +321,8 @@ func TestIBCRawPacketHandler(t *testing.T) { assert.Nil(t, evts) require.NotNil(t, data) + assert.Len(t, msgResponses, 1) + assert.Equal(t, "/cosmwasm.wasm.v1.MsgIBCSendResponse", msgResponses[0][0].TypeUrl) expMsg := types.MsgIBCSendResponse{Sequence: 1} @@ -335,12 +342,12 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { // picks the message in the default handler chain ctx, keepers := CreateDefaultTestInput(t) // set some supply - keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewCoin("denom", sdk.NewInt(10_000_000))) + keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewCoin("denom", sdkmath.NewInt(10_000_000))) k := keepers.WasmKeeper example := InstantiateHackatomExampleContract(t, ctx, keepers) // with deposit of 100 stake - before, err := keepers.BankKeeper.TotalSupply(sdk.WrapSDKContext(ctx), &banktypes.QueryTotalSupplyRequest{}) + before, err := keepers.BankKeeper.TotalSupply(ctx, &banktypes.QueryTotalSupplyRequest{}) require.NoError(t, err) specs := map[string]struct { @@ -349,7 +356,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { }{ "all good": { msg: wasmvmtypes.BurnMsg{ - Amount: wasmvmtypes.Coins{{ + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{{ Denom: "denom", Amount: "100", }}, @@ -357,7 +364,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { }, "not enough funds in contract": { msg: wasmvmtypes.BurnMsg{ - Amount: wasmvmtypes.Coins{{ + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{{ Denom: "denom", Amount: "101", }}, @@ -366,7 +373,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { }, "zero amount rejected": { msg: wasmvmtypes.BurnMsg{ - Amount: wasmvmtypes.Coins{{ + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{{ Denom: "denom", Amount: "0", }}, @@ -375,7 +382,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { }, "unknown denom - insufficient funds": { msg: wasmvmtypes.BurnMsg{ - Amount: wasmvmtypes.Coins{{ + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{{ Denom: "unknown", Amount: "1", }}, @@ -387,10 +394,12 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { ctx, _ = parentCtx.CacheContext() - k.wasmVM = &wasmtesting.MockWasmEngine{ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, //nolint:gosec + k.wasmVM = &wasmtesting.MockWasmEngine{ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, //nolint:gosec + }, }, }, 0, nil }} @@ -406,10 +415,10 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { require.NoError(t, err) // and total supply reduced by burned amount - after, err := keepers.BankKeeper.TotalSupply(sdk.WrapSDKContext(ctx), &banktypes.QueryTotalSupplyRequest{}) + after, err := keepers.BankKeeper.TotalSupply(ctx, &banktypes.QueryTotalSupplyRequest{}) require.NoError(t, err) diff := before.Supply.Sub(after.Supply...) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(100))), diff) + assert.Equal(t, sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(100))), diff) }) } diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go index ac31dfac66..b0e1d05e1f 100644 --- a/x/wasm/keeper/ibc.go +++ b/x/wasm/keeper/ibc.go @@ -3,12 +3,12 @@ package keeper import ( "strings" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/ibc_test.go b/x/wasm/keeper/ibc_test.go index 01ed35b3fa..99627a6beb 100644 --- a/x/wasm/keeper/ibc_test.go +++ b/x/wasm/keeper/ibc_test.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/json" "fmt" "testing" @@ -24,9 +25,10 @@ func TestBindingPortForIBCContractOnInstantiate(t *testing.T) { require.NoError(t, err) require.Equal(t, "wasm", owner) - initMsgBz := IBCReflectInitMsg{ + initMsgBz, err := json.Marshal(IBCReflectInitMsg{ ReflectCodeID: example.ReflectCodeID, - }.GetBytes(t) + }) + require.NoError(t, err) // create a second contract should give yet another portID (and different address) creator := RandomAccountAddress(t) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 6c8d45dc91..443de1b601 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "context" "encoding/binary" "encoding/hex" "fmt" @@ -11,15 +12,18 @@ import ( "strings" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - "github.com/cometbft/cometbft/libs/log" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + "cosmossdk.io/collections" + corestoretypes "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -56,7 +60,7 @@ type AccountPruner interface { // CleanupExistingAccount handles the cleanup process for balances and data of the given account. The persisted account // type is already reset to base account at this stage. // The method returns true when the account address can be reused. Unsupported account types are rejected by returning false - CleanupExistingAccount(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) + CleanupExistingAccount(ctx sdk.Context, existingAccount sdk.AccountI) (handled bool, err error) } // WasmVMResponseHandler is an extension point to handles the response data returned by a contract call. @@ -79,7 +83,8 @@ var defaultAcceptedAccountTypes = map[reflect.Type]struct{}{ // Keeper will have a reference to Wasm Engine with it's own data directory. type Keeper struct { - storeKey storetypes.StoreKey + // The (unexposed) keys used to access the stores from the Context. + storeService corestoretypes.KVStoreService cdc codec.Codec accountKeeper types.AccountKeeper bank CoinTransferrer @@ -95,6 +100,7 @@ type Keeper struct { maxQueryStackSize uint32 acceptedAccountTypes map[reflect.Type]struct{} accountPruner AccountPruner + params collections.Item[types.Params] // propagate gov authZ to sub-messages propagateGovAuthorization map[types.AuthorizationPolicyAction]struct{} @@ -103,41 +109,26 @@ type Keeper struct { authority string } -func (k Keeper) getUploadAccessConfig(ctx sdk.Context) types.AccessConfig { +func (k Keeper) getUploadAccessConfig(ctx context.Context) types.AccessConfig { return k.GetParams(ctx).CodeUploadAccess } -func (k Keeper) getInstantiateAccessConfig(ctx sdk.Context) types.AccessType { +func (k Keeper) getInstantiateAccessConfig(ctx context.Context) types.AccessType { return k.GetParams(ctx).InstantiateDefaultPermission } // GetParams returns the total set of wasm parameters. -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - var params types.Params - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKey) - if bz == nil { - return params +func (k Keeper) GetParams(ctx context.Context) types.Params { + p, err := k.params.Get(ctx) + if err != nil { + panic(err) } - - k.cdc.MustUnmarshal(bz, ¶ms) - return params + return p } // SetParams sets all wasm parameters. -func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) error { - if err := ps.ValidateBasic(); err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(&ps) - if err != nil { - return err - } - store.Set(types.ParamsKey, bz) - - return nil +func (k Keeper) SetParams(ctx context.Context, ps types.Params) error { + return k.params.Set(ctx, ps) } // GetAuthority returns the x/wasm module's authority. @@ -150,19 +141,19 @@ func (k Keeper) GetGasRegister() types.GasRegister { return k.gasRegister } -func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ types.AuthorizationPolicy) (codeID uint64, checksum []byte, err error) { +func (k Keeper) create(ctx context.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ types.AuthorizationPolicy) (codeID uint64, checksum []byte, err error) { if creator == nil { return 0, checksum, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "cannot be nil") } - + sdkCtx := sdk.UnwrapSDKContext(ctx) // figure out proper instantiate access - defaultAccessConfig := k.getInstantiateAccessConfig(ctx).With(creator) + defaultAccessConfig := k.getInstantiateAccessConfig(sdkCtx).With(creator) if instantiateAccess == nil { instantiateAccess = &defaultAccessConfig } chainConfigs := types.ChainAccessConfigs{ Instantiate: defaultAccessConfig, - Upload: k.getUploadAccessConfig(ctx), + Upload: k.getUploadAccessConfig(sdkCtx), } if !authZ.CanCreateCode(chainConfigs, creator, *instantiateAccess) { @@ -170,15 +161,16 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, } if ioutils.IsGzip(wasmCode) { - ctx.GasMeter().ConsumeGas(k.gasRegister.UncompressCosts(len(wasmCode)), "Uncompress gzip bytecode") + sdkCtx.GasMeter().ConsumeGas(k.gasRegister.UncompressCosts(len(wasmCode)), "Uncompress gzip bytecode") wasmCode, err = ioutils.Uncompress(wasmCode, int64(types.MaxWasmSize)) if err != nil { return 0, checksum, types.ErrCreateFailed.Wrap(errorsmod.Wrap(err, "uncompress wasm archive").Error()) } } - ctx.GasMeter().ConsumeGas(k.gasRegister.CompileCosts(len(wasmCode)), "Compiling wasm bytecode") - checksum, err = k.wasmVM.StoreCode(wasmCode) + gasLeft := k.runtimeGasForContract(sdkCtx) + checksum, gasUsed, err := k.wasmVM.StoreCode(wasmCode, gasLeft) + k.consumeRuntimeGas(sdkCtx, gasUsed) if err != nil { return 0, checksum, errorsmod.Wrap(types.ErrCreateFailed, err.Error()) } @@ -186,10 +178,10 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, if err != nil { return 0, checksum, errorsmod.Wrap(types.ErrCreateFailed, err.Error()) } - codeID = k.autoIncrementID(ctx, types.KeySequenceCodeID) - k.Logger(ctx).Debug("storing new contract", "capabilities", report.RequiredCapabilities, "code_id", codeID) + codeID = k.mustAutoIncrementID(sdkCtx, types.KeySequenceCodeID) + k.Logger(sdkCtx).Debug("storing new contract", "capabilities", report.RequiredCapabilities, "code_id", codeID) codeInfo := types.NewCodeInfo(checksum, creator, *instantiateAccess) - k.storeCodeInfo(ctx, codeID, codeInfo) + k.mustStoreCodeInfo(sdkCtx, codeID, codeInfo) evt := sdk.NewEvent( types.EventTypeStoreCode, @@ -199,18 +191,21 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, for _, f := range strings.Split(report.RequiredCapabilities, ",") { evt.AppendAttributes(sdk.NewAttribute(types.AttributeKeyRequiredCapability, strings.TrimSpace(f))) } - ctx.EventManager().EmitEvent(evt) + sdkCtx.EventManager().EmitEvent(evt) return codeID, checksum, nil } -func (k Keeper) storeCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) mustStoreCodeInfo(ctx context.Context, codeID uint64, codeInfo types.CodeInfo) { + store := k.storeService.OpenKVStore(ctx) // 0x01 | codeID (uint64) -> ContractInfo - store.Set(types.GetCodeKey(codeID), k.cdc.MustMarshal(&codeInfo)) + err := store.Set(types.GetCodeKey(codeID), k.cdc.MustMarshal(&codeInfo)) + if err != nil { + panic(err) + } } -func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo, wasmCode []byte) error { +func (k Keeper) importCode(ctx context.Context, codeID uint64, codeInfo types.CodeInfo, wasmCode []byte) error { if ioutils.IsGzip(wasmCode) { var err error wasmCode, err = ioutils.Uncompress(wasmCode, math.MaxInt64) @@ -226,18 +221,21 @@ func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeIn return errorsmod.Wrap(types.ErrInvalid, "code hashes not same") } - store := ctx.KVStore(k.storeKey) + store := k.storeService.OpenKVStore(ctx) key := types.GetCodeKey(codeID) - if store.Has(key) { + ok, err := store.Has(key) + if err != nil { + return errorsmod.Wrap(err, "has code-id key") + } + if ok { return errorsmod.Wrapf(types.ErrDuplicate, "duplicate code: %d", codeID) } // 0x01 | codeID (uint64) -> ContractInfo - store.Set(key, k.cdc.MustMarshal(&codeInfo)) - return nil + return store.Set(key, k.cdc.MustMarshal(&codeInfo)) } func (k Keeper) instantiate( - ctx sdk.Context, + ctx context.Context, codeID uint64, creator, admin sdk.AccAddress, rawInitMsg []byte, @@ -250,14 +248,15 @@ func (k Keeper) instantiate( initMsg, err := ioutils.CompactMsg(rawInitMsg) if err != nil { - return nil, nil, sdkerrors.Wrapf(types.ErrInvalidMsg, "failed to compact init msg: %s", err.Error()) + return nil, nil, errorsmod.Wrapf(types.ErrInvalidMsg, "failed to compact init msg: %s", err.Error()) } if creator == nil { return nil, nil, types.ErrEmpty.Wrap("creator") } - instanceCosts := k.gasRegister.NewContractInstanceCosts(k.IsPinnedCode(ctx, codeID), len(initMsg)) - ctx.GasMeter().ConsumeGas(instanceCosts, "Loading CosmWasm module: instantiate") + sdkCtx := sdk.UnwrapSDKContext(ctx) + setupCost := k.gasRegister.SetupContractCost(k.IsPinnedCode(sdkCtx, codeID), len(initMsg)) + sdkCtx.GasMeter().ConsumeGas(setupCost, "Loading CosmWasm module: instantiate") codeInfo := k.GetCodeInfo(ctx, codeID) if codeInfo == nil { @@ -268,7 +267,10 @@ func (k Keeper) instantiate( } contractAddress := addressGenerator(ctx, codeID, codeInfo.CodeHash) if k.HasContractInfo(ctx, contractAddress) { - return nil, nil, types.ErrDuplicate.Wrap("instance with this code id, sender and label exists: try a different label") + // This case must only happen for instantiate2 because instantiate is based on a counter in state. + // So we create an instantiate2 specific error message here even though technically this function + // is used for both cases. + return nil, nil, types.ErrDuplicate.Wrap("contract address already exists, try a different combination of creator, checksum and salt") } // check account @@ -277,21 +279,21 @@ func (k Keeper) instantiate( // But not all account types of other modules are known or may make sense for contracts, therefore we kept this // decision logic also very flexible and extendable. We provide new options to overwrite the default settings via WithAcceptedAccountTypesOnContractInstantiation and // WithPruneAccountTypesOnContractInstantiation as constructor arguments - existingAcct := k.accountKeeper.GetAccount(ctx, contractAddress) + existingAcct := k.accountKeeper.GetAccount(sdkCtx, contractAddress) if existingAcct != nil { if existingAcct.GetSequence() != 0 || existingAcct.GetPubKey() != nil { return nil, nil, types.ErrAccountExists.Wrap("address is claimed by external account") } if _, accept := k.acceptedAccountTypes[reflect.TypeOf(existingAcct)]; accept { // keep account and balance as it is - k.Logger(ctx).Info("instantiate contract with existing account", "address", contractAddress.String()) + k.Logger(sdkCtx).Info("instantiate contract with existing account", "address", contractAddress.String()) } else { // consider an account in the wasmd namespace spam and overwrite it. - k.Logger(ctx).Info("pruning existing account for contract instantiation", "address", contractAddress.String()) - contractAccount := k.accountKeeper.NewAccountWithAddress(ctx, contractAddress) - k.accountKeeper.SetAccount(ctx, contractAccount) + k.Logger(sdkCtx).Info("pruning existing account for contract instantiation", "address", contractAddress.String()) + contractAccount := k.accountKeeper.NewAccountWithAddress(sdkCtx, contractAddress) + k.accountKeeper.SetAccount(sdkCtx, contractAccount) // also handle balance to not open cases where these accounts are abused and become liquid - switch handled, err := k.accountPruner.CleanupExistingAccount(ctx, existingAcct); { + switch handled, err := k.accountPruner.CleanupExistingAccount(sdkCtx, existingAcct); { case err != nil: return nil, nil, errorsmod.Wrap(err, "prune balance") case !handled: @@ -300,48 +302,55 @@ func (k Keeper) instantiate( } } else { // create an empty account (so we don't have issues later) - contractAccount := k.accountKeeper.NewAccountWithAddress(ctx, contractAddress) - k.accountKeeper.SetAccount(ctx, contractAccount) + contractAccount := k.accountKeeper.NewAccountWithAddress(sdkCtx, contractAddress) + k.accountKeeper.SetAccount(sdkCtx, contractAccount) } // deposit initial contract funds if !deposit.IsZero() { - if err := k.bank.TransferCoins(ctx, creator, contractAddress, deposit); err != nil { + if err := k.bank.TransferCoins(sdkCtx, creator, contractAddress, deposit); err != nil { return nil, nil, err } } // prepare params for contract instantiate call - env := types.NewEnv(ctx, contractAddress) + env := types.NewEnv(sdkCtx, contractAddress) info := types.NewInfo(creator, deposit) // create prefixed data store // 0x03 | BuildContractAddressClassic (sdk.AccAddress) prefixStoreKey := types.GetContractStorePrefix(contractAddress) - vmStore := types.NewStoreAdapter(prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey)) + vmStore := types.NewStoreAdapter(prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(sdkCtx)), prefixStoreKey)) // prepare querier - querier := k.newQueryHandler(ctx, contractAddress) + querier := k.newQueryHandler(sdkCtx, contractAddress) // instantiate wasm contract - gas := k.runtimeGasForContract(ctx) - res, gasUsed, err := k.wasmVM.Instantiate(codeInfo.CodeHash, env, info, initMsg, vmStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) - k.consumeRuntimeGas(ctx, gasUsed) + gasLeft := k.runtimeGasForContract(sdkCtx) + res, gasUsed, err := k.wasmVM.Instantiate(codeInfo.CodeHash, env, info, initMsg, vmStore, cosmwasmAPI, querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) + k.consumeRuntimeGas(sdkCtx, gasUsed) if err != nil { - return nil, nil, errorsmod.Wrap(types.ErrInstantiateFailed, err.Error()) + return nil, nil, errorsmod.Wrap(types.ErrVMError, err.Error()) + } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return nil, nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrInstantiateFailed, res.Err)) } // persist instance first - createdAt := types.NewAbsoluteTxPosition(ctx) + createdAt := types.NewAbsoluteTxPosition(sdkCtx) contractInfo := types.NewContractInfo(codeID, creator, admin, label, createdAt) // check for IBC flag report, err := k.wasmVM.AnalyzeCode(codeInfo.CodeHash) if err != nil { - return nil, nil, errorsmod.Wrap(types.ErrInstantiateFailed, err.Error()) + return nil, nil, errorsmod.Wrap(types.ErrVMError, err.Error()) } if report.HasIBCEntryPoints { // register IBC port - ibcPort, err := k.ensureIbcPort(ctx, contractAddress) + ibcPort, err := k.ensureIbcPort(sdkCtx, contractAddress) if err != nil { return nil, nil, err } @@ -350,19 +359,29 @@ func (k Keeper) instantiate( // store contract before dispatch so that contract could be called back historyEntry := contractInfo.InitialHistory(initMsg) - k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) - k.addToContractCreatorSecondaryIndex(ctx, creator, historyEntry.Updated, contractAddress) - k.appendToContractHistory(ctx, contractAddress, historyEntry) - k.storeContractInfo(ctx, contractAddress, &contractInfo) + err = k.addToContractCodeSecondaryIndex(sdkCtx, contractAddress, historyEntry) + if err != nil { + return nil, nil, err + } + err = k.addToContractCreatorSecondaryIndex(sdkCtx, creator, historyEntry.Updated, contractAddress) + if err != nil { + return nil, nil, err + } + err = k.appendToContractHistory(sdkCtx, contractAddress, historyEntry) + if err != nil { + return nil, nil, err + } - ctx.EventManager().EmitEvent(sdk.NewEvent( + k.mustStoreContractInfo(sdkCtx, contractAddress, &contractInfo) + + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeInstantiate, sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)), )) - ctx = types.WithSubMsgAuthzPolicy(ctx, authPolicy.SubMessageAuthorizationPolicy(types.AuthZActionInstantiate)) - data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events) + sdkCtx = types.WithSubMsgAuthzPolicy(sdkCtx, authPolicy.SubMessageAuthorizationPolicy(types.AuthZActionInstantiate)) + data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) if err != nil { return nil, nil, errorsmod.Wrap(err, "dispatch") } @@ -371,41 +390,49 @@ func (k Keeper) instantiate( } // Execute executes the contract instance -func (k Keeper) execute(ctx sdk.Context, contractAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) { +func (k Keeper) execute(ctx context.Context, contractAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "execute") + sdkCtx := sdk.UnwrapSDKContext(ctx) contractInfo, codeInfo, prefixStore, err := k.contractInstance(ctx, contractAddress) if err != nil { return nil, err } - executeCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) - ctx.GasMeter().ConsumeGas(executeCosts, "Loading CosmWasm module: execute") + setupCost := k.gasRegister.SetupContractCost(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) + sdkCtx.GasMeter().ConsumeGas(setupCost, "Loading CosmWasm module: execute") // add more funds if !coins.IsZero() { - if err := k.bank.TransferCoins(ctx, caller, contractAddress, coins); err != nil { + if err := k.bank.TransferCoins(sdkCtx, caller, contractAddress, coins); err != nil { return nil, err } } - env := types.NewEnv(ctx, contractAddress) + env := types.NewEnv(sdkCtx, contractAddress) info := types.NewInfo(caller, coins) // prepare querier - querier := k.newQueryHandler(ctx, contractAddress) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Execute(codeInfo.CodeHash, env, info, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) - k.consumeRuntimeGas(ctx, gasUsed) + querier := k.newQueryHandler(sdkCtx, contractAddress) + gasLeft := k.runtimeGasForContract(sdkCtx) + res, gasUsed, execErr := k.wasmVM.Execute(codeInfo.CodeHash, env, info, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) + k.consumeRuntimeGas(sdkCtx, gasUsed) if execErr != nil { - return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, execErr.Error()) + } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) } - ctx.EventManager().EmitEvent(sdk.NewEvent( + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeExecute, sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), )) - data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events) + data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) if err != nil { return nil, errorsmod.Wrap(err, "dispatch") } @@ -414,7 +441,7 @@ func (k Keeper) execute(ctx sdk.Context, contractAddress, caller sdk.AccAddress, } func (k Keeper) migrate( - ctx sdk.Context, + ctx context.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, @@ -425,11 +452,12 @@ func (k Keeper) migrate( msg, err := ioutils.CompactMsg(rawMsg) if err != nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidMsg, "failed to compact migrate msg: %s", err.Error()) + return nil, errorsmod.Wrapf(types.ErrInvalidMsg, "failed to compact migrate msg: %s", err.Error()) } - migrateSetupCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, newCodeID), len(msg)) - ctx.GasMeter().ConsumeGas(migrateSetupCosts, "Loading CosmWasm module: migrate") + sdkCtx := sdk.UnwrapSDKContext(ctx) + setupCost := k.gasRegister.SetupContractCost(k.IsPinnedCode(ctx, newCodeID), len(msg)) + sdkCtx.GasMeter().ConsumeGas(setupCost, "Loading CosmWasm module: migrate") contractInfo := k.GetContractInfo(ctx, contractAddress) if contractInfo == nil { @@ -451,48 +479,64 @@ func (k Keeper) migrate( // check for IBC flag switch report, err := k.wasmVM.AnalyzeCode(newCodeInfo.CodeHash); { case err != nil: - return nil, errorsmod.Wrap(types.ErrMigrationFailed, err.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, err.Error()) case !report.HasIBCEntryPoints && contractInfo.IBCPortID != "": // prevent update to non ibc contract return nil, errorsmod.Wrap(types.ErrMigrationFailed, "requires ibc callbacks") case report.HasIBCEntryPoints && contractInfo.IBCPortID == "": // add ibc port - ibcPort, err := k.ensureIbcPort(ctx, contractAddress) + ibcPort, err := k.ensureIbcPort(sdkCtx, contractAddress) if err != nil { return nil, err } contractInfo.IBCPortID = ibcPort } - env := types.NewEnv(ctx, contractAddress) + env := types.NewEnv(sdkCtx, contractAddress) // prepare querier - querier := k.newQueryHandler(ctx, contractAddress) + querier := k.newQueryHandler(sdkCtx, contractAddress) prefixStoreKey := types.GetContractStorePrefix(contractAddress) - vmStore := types.NewStoreAdapter(prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey)) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, vmStore, cosmwasmAPI, &querier, k.gasMeter(ctx), gas, costJSONDeserialization) - k.consumeRuntimeGas(ctx, gasUsed) + vmStore := types.NewStoreAdapter(prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(sdkCtx)), prefixStoreKey)) + gasLeft := k.runtimeGasForContract(sdkCtx) + res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, vmStore, cosmwasmAPI, &querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) + k.consumeRuntimeGas(sdkCtx, gasUsed) if err != nil { - return nil, errorsmod.Wrap(types.ErrMigrationFailed, err.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, err.Error()) + } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrMigrationFailed, res.Err)) } // delete old secondary index entry - k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress)) + err = k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.mustGetLastContractHistoryEntry(sdkCtx, contractAddress)) + if err != nil { + return nil, err + } // persist migration updates - historyEntry := contractInfo.AddMigration(ctx, newCodeID, msg) - k.appendToContractHistory(ctx, contractAddress, historyEntry) - k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) - k.storeContractInfo(ctx, contractAddress, contractInfo) + historyEntry := contractInfo.AddMigration(sdkCtx, newCodeID, msg) + err = k.appendToContractHistory(ctx, contractAddress, historyEntry) + if err != nil { + return nil, err + } + err = k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) + if err != nil { + return nil, err + } + k.mustStoreContractInfo(ctx, contractAddress, contractInfo) - ctx.EventManager().EmitEvent(sdk.NewEvent( + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeMigrate, sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(newCodeID, 10)), sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), )) - ctx = types.WithSubMsgAuthzPolicy(ctx, authZ.SubMessageAuthorizationPolicy(types.AuthZActionMigrateContract)) - data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events) + sdkCtx = types.WithSubMsgAuthzPolicy(sdkCtx, authZ.SubMessageAuthorizationPolicy(types.AuthZActionMigrateContract)) + data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) if err != nil { return nil, errorsmod.Wrap(err, "dispatch") } @@ -508,34 +552,43 @@ func (k Keeper) migrate( // customized though by passing a new policy with the context. See types.WithSubMsgAuthzPolicy. // The policy will be read in msgServer.selectAuthorizationPolicy and used for sub-message executions. // This is an extension point for some very advanced scenarios only. Use with care! -func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) { +func (k Keeper) Sudo(ctx context.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "sudo") + contractInfo, codeInfo, prefixStore, err := k.contractInstance(ctx, contractAddress) if err != nil { return nil, err } - sudoSetupCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) - ctx.GasMeter().ConsumeGas(sudoSetupCosts, "Loading CosmWasm module: sudo") + setupCost := k.gasRegister.SetupContractCost(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.GasMeter().ConsumeGas(setupCost, "Loading CosmWasm module: sudo") - env := types.NewEnv(ctx, contractAddress) + env := types.NewEnv(sdkCtx, contractAddress) // prepare querier - querier := k.newQueryHandler(ctx, contractAddress) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Sudo(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) - k.consumeRuntimeGas(ctx, gasUsed) + querier := k.newQueryHandler(sdkCtx, contractAddress) + gasLeft := k.runtimeGasForContract(sdkCtx) + res, gasUsed, execErr := k.wasmVM.Sudo(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(sdkCtx), gasLeft, costJSONDeserialization) + k.consumeRuntimeGas(sdkCtx, gasUsed) if execErr != nil { - return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, execErr.Error()) + } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) } - ctx.EventManager().EmitEvent(sdk.NewEvent( + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeSudo, sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), )) // sudo submessages are executed with the default authorization policy - data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events) + data, err := k.handleContractResponse(sdkCtx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) if err != nil { return nil, errorsmod.Wrap(err, "dispatch") } @@ -558,12 +611,19 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was // prepare querier querier := k.newQueryHandler(ctx, contractAddress) - gas := k.runtimeGasForContract(ctx) + gasLeft := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { - return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, execErr.Error()) + } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return nil, types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) } ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -571,7 +631,7 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), )) - data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events) + data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Data, res.Ok.Events) if err != nil { return nil, errorsmod.Wrap(err, "dispatch") } @@ -580,25 +640,25 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was } // addToContractCodeSecondaryIndex adds element to the index for contracts-by-codeid queries -func (k Keeper) addToContractCodeSecondaryIndex(ctx sdk.Context, contractAddress sdk.AccAddress, entry types.ContractCodeHistoryEntry) { - store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry), []byte{}) +func (k Keeper) addToContractCodeSecondaryIndex(ctx context.Context, contractAddress sdk.AccAddress, entry types.ContractCodeHistoryEntry) error { + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry), []byte{}) } // removeFromContractCodeSecondaryIndex removes element to the index for contracts-by-codeid queries -func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAddress sdk.AccAddress, entry types.ContractCodeHistoryEntry) { - ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry)) +func (k Keeper) removeFromContractCodeSecondaryIndex(ctx context.Context, contractAddress sdk.AccAddress, entry types.ContractCodeHistoryEntry) error { + return k.storeService.OpenKVStore(ctx).Delete(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry)) } // addToContractCreatorSecondaryIndex adds element to the index for contracts-by-creator queries -func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, position.Bytes(), contractAddress), []byte{}) +func (k Keeper) addToContractCreatorSecondaryIndex(ctx context.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress) error { + store := k.storeService.OpenKVStore(ctx) + return store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, position.Bytes(), contractAddress), []byte{}) } // IterateContractsByCreator iterates over all contracts with given creator address in order of creation time asc. -func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) +func (k Keeper) IterateContractsByCreator(ctx context.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() if cb(key[types.AbsoluteTxPositionLen:]) { @@ -608,8 +668,8 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres } // IterateContractsByCode iterates over all contracts with given codeID ASC on code update time. -func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractByCodeIDSecondaryIndexPrefix(codeID)) +func (k Keeper) IterateContractsByCode(ctx context.Context, codeID uint64, cb func(address sdk.AccAddress) bool) { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.GetContractByCodeIDSecondaryIndexPrefix(codeID)) iter := prefixStore.Iterator(nil, nil) defer iter.Close() @@ -621,8 +681,9 @@ func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(a } } -func (k Keeper) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ types.AuthorizationPolicy) error { - contractInfo := k.GetContractInfo(ctx, contractAddress) +func (k Keeper) setContractAdmin(ctx context.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ types.AuthorizationPolicy) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + contractInfo := k.GetContractInfo(sdkCtx, contractAddress) if contractInfo == nil { return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract") } @@ -631,8 +692,8 @@ func (k Keeper) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAd } newAdminStr := newAdmin.String() contractInfo.Admin = newAdminStr - k.storeContractInfo(ctx, contractAddress, contractInfo) - ctx.EventManager().EmitEvent(sdk.NewEvent( + k.mustStoreContractInfo(sdkCtx, contractAddress, contractInfo) + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeUpdateContractAdmin, sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), sdk.NewAttribute(types.AttributeKeyNewAdmin, newAdminStr), @@ -641,8 +702,9 @@ func (k Keeper) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAd return nil } -func (k Keeper) setContractLabel(ctx sdk.Context, contractAddress, caller sdk.AccAddress, newLabel string, authZ types.AuthorizationPolicy) error { - contractInfo := k.GetContractInfo(ctx, contractAddress) +func (k Keeper) setContractLabel(ctx context.Context, contractAddress, caller sdk.AccAddress, newLabel string, authZ types.AuthorizationPolicy) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + contractInfo := k.GetContractInfo(sdkCtx, contractAddress) if contractInfo == nil { return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract") } @@ -650,8 +712,8 @@ func (k Keeper) setContractLabel(ctx sdk.Context, contractAddress, caller sdk.Ac return errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not modify contract") } contractInfo.Label = newLabel - k.storeContractInfo(ctx, contractAddress, contractInfo) - ctx.EventManager().EmitEvent(sdk.NewEvent( + k.mustStoreContractInfo(sdkCtx, contractAddress, contractInfo) + sdkCtx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeUpdateContractLabel, sdk.NewAttribute(types.AttributeKeyContractAddr, contractAddress.String()), sdk.NewAttribute(types.AttributeKeyNewLabel, newLabel), @@ -660,11 +722,11 @@ func (k Keeper) setContractLabel(ctx sdk.Context, contractAddress, caller sdk.Ac return nil } -func (k Keeper) appendToContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress, newEntries ...types.ContractCodeHistoryEntry) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) appendToContractHistory(ctx context.Context, contractAddr sdk.AccAddress, newEntries ...types.ContractCodeHistoryEntry) error { + store := k.storeService.OpenKVStore(ctx) // find last element position var pos uint64 - prefixStore := prefix.NewStore(store, types.GetContractCodeHistoryElementPrefix(contractAddr)) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(store), types.GetContractCodeHistoryElementPrefix(contractAddr)) iter := prefixStore.ReverseIterator(nil, nil) defer iter.Close() @@ -678,12 +740,15 @@ func (k Keeper) appendToContractHistory(ctx sdk.Context, contractAddr sdk.AccAdd for _, e := range newEntries { pos++ key := types.GetContractCodeHistoryElementKey(contractAddr, pos) - store.Set(key, k.cdc.MustMarshal(&e)) //nolint:gosec + if err := store.Set(key, k.cdc.MustMarshal(&e)); err != nil { //nolint:gosec + return err + } } + return nil } -func (k Keeper) GetContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress) []types.ContractCodeHistoryEntry { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractCodeHistoryElementPrefix(contractAddr)) +func (k Keeper) GetContractHistory(ctx context.Context, contractAddr sdk.AccAddress) []types.ContractCodeHistoryEntry { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.GetContractCodeHistoryElementPrefix(contractAddr)) r := make([]types.ContractCodeHistoryEntry, 0) iter := prefixStore.Iterator(nil, nil) defer iter.Close() @@ -700,9 +765,9 @@ func (k Keeper) GetContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress) return r } -// getLastContractHistoryEntry returns the last element from history. To be used internally only as it panics when none exists -func (k Keeper) getLastContractHistoryEntry(ctx sdk.Context, contractAddr sdk.AccAddress) types.ContractCodeHistoryEntry { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractCodeHistoryElementPrefix(contractAddr)) +// mustGetLastContractHistoryEntry returns the last element from history. To be used internally only as it panics when none exists +func (k Keeper) mustGetLastContractHistoryEntry(ctx context.Context, contractAddr sdk.AccAddress) types.ContractCodeHistoryEntry { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.GetContractCodeHistoryElementPrefix(contractAddr)) iter := prefixStore.ReverseIterator(nil, nil) defer iter.Close() @@ -718,36 +783,38 @@ func (k Keeper) getLastContractHistoryEntry(ctx sdk.Context, contractAddr sdk.Ac } // QuerySmart queries the smart contract itself. -func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) { +func (k Keeper) QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "query-smart") - // checks and increase query stack size - ctx, err := checkAndIncreaseQueryStackSize(ctx, k.maxQueryStackSize) + sdkCtx, err := checkAndIncreaseQueryStackSize(sdk.UnwrapSDKContext(ctx), k.maxQueryStackSize) if err != nil { return nil, err } - contractInfo, codeInfo, prefixStore, err := k.contractInstance(ctx, contractAddr) + contractInfo, codeInfo, prefixStore, err := k.contractInstance(sdkCtx, contractAddr) if err != nil { return nil, err } - smartQuerySetupCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, contractInfo.CodeID), len(req)) - ctx.GasMeter().ConsumeGas(smartQuerySetupCosts, "Loading CosmWasm module: query") + setupCost := k.gasRegister.SetupContractCost(k.IsPinnedCode(sdkCtx, contractInfo.CodeID), len(req)) + sdkCtx.GasMeter().ConsumeGas(setupCost, "Loading CosmWasm module: query") // prepare querier - querier := k.newQueryHandler(ctx, contractAddr) + querier := k.newQueryHandler(sdkCtx, contractAddr) - env := types.NewEnv(ctx, contractAddr) - queryResult, gasUsed, qErr := k.wasmVM.Query(codeInfo.CodeHash, env, req, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), k.runtimeGasForContract(ctx), costJSONDeserialization) - k.consumeRuntimeGas(ctx, gasUsed) + env := types.NewEnv(sdkCtx, contractAddr) + queryResult, gasUsed, qErr := k.wasmVM.Query(codeInfo.CodeHash, env, req, prefixStore, cosmwasmAPI, querier, k.gasMeter(sdkCtx), k.runtimeGasForContract(sdkCtx), costJSONDeserialization) + k.consumeRuntimeGas(sdkCtx, gasUsed) if qErr != nil { - return nil, errorsmod.Wrap(types.ErrQueryFailed, qErr.Error()) + return nil, errorsmod.Wrap(types.ErrVMError, qErr.Error()) } - return queryResult, nil + if queryResult.Err != "" { + return nil, errorsmod.Wrap(types.ErrQueryFailed, queryResult.Err) + } + return queryResult.Ok, nil } -func checkAndIncreaseQueryStackSize(ctx sdk.Context, maxQueryStackSize uint32) (sdk.Context, error) { +func checkAndIncreaseQueryStackSize(ctx context.Context, maxQueryStackSize uint32) (sdk.Context, error) { var queryStackSize uint32 = 0 if size, ok := types.QueryStackSize(ctx); ok { queryStackSize = size @@ -758,29 +825,32 @@ func checkAndIncreaseQueryStackSize(ctx sdk.Context, maxQueryStackSize uint32) ( // did we go too far? if queryStackSize > maxQueryStackSize { - return ctx, types.ErrExceedMaxQueryStackSize + return sdk.Context{}, types.ErrExceedMaxQueryStackSize } // set updated stack size - return types.WithQueryStackSize(ctx, queryStackSize), nil + return types.WithQueryStackSize(sdk.UnwrapSDKContext(ctx), queryStackSize), nil } // QueryRaw returns the contract's state for give key. Returns `nil` when key is `nil`. -func (k Keeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte { +func (k Keeper) QueryRaw(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "query-raw") if key == nil { return nil } prefixStoreKey := types.GetContractStorePrefix(contractAddress) - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) return prefixStore.Get(key) } // internal helper function -func (k Keeper) contractInstance(ctx sdk.Context, contractAddress sdk.AccAddress) (types.ContractInfo, types.CodeInfo, wasmvm.KVStore, error) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) contractInstance(ctx context.Context, contractAddress sdk.AccAddress) (types.ContractInfo, types.CodeInfo, wasmvm.KVStore, error) { + store := k.storeService.OpenKVStore(ctx) - contractBz := store.Get(types.GetContractAddressKey(contractAddress)) + contractBz, err := store.Get(types.GetContractAddressKey(contractAddress)) + if err != nil { + return types.ContractInfo{}, types.CodeInfo{}, nil, err + } if contractBz == nil { return types.ContractInfo{}, types.CodeInfo{}, nil, types.ErrNoSuchContractFn(contractAddress.String()). Wrapf("address %s", contractAddress.String()) @@ -788,7 +858,11 @@ func (k Keeper) contractInstance(ctx sdk.Context, contractAddress sdk.AccAddress var contractInfo types.ContractInfo k.cdc.MustUnmarshal(contractBz, &contractInfo) - codeInfoBz := store.Get(types.GetCodeKey(contractInfo.CodeID)) + codeInfoBz, err := store.Get(types.GetCodeKey(contractInfo.CodeID)) + if err != nil { + return types.ContractInfo{}, types.CodeInfo{}, nil, err + } + if codeInfoBz == nil { return contractInfo, types.CodeInfo{}, nil, types.ErrNoSuchCodeFn(contractInfo.CodeID). Wrapf("code id %d", contractInfo.CodeID) @@ -796,14 +870,17 @@ func (k Keeper) contractInstance(ctx sdk.Context, contractAddress sdk.AccAddress var codeInfo types.CodeInfo k.cdc.MustUnmarshal(codeInfoBz, &codeInfo) prefixStoreKey := types.GetContractStorePrefix(contractAddress) - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) return contractInfo, codeInfo, types.NewStoreAdapter(prefixStore), nil } -func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetContractInfo(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + store := k.storeService.OpenKVStore(ctx) var contract types.ContractInfo - contractBz := store.Get(types.GetContractAddressKey(contractAddress)) + contractBz, err := store.Get(types.GetContractAddressKey(contractAddress)) + if err != nil { + panic(err) + } if contractBz == nil { return nil } @@ -811,19 +888,26 @@ func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) return &contract } -func (k Keeper) HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.GetContractAddressKey(contractAddress)) +func (k Keeper) HasContractInfo(ctx context.Context, contractAddress sdk.AccAddress) bool { + store := k.storeService.OpenKVStore(ctx) + ok, err := store.Has(types.GetContractAddressKey(contractAddress)) + if err != nil { + panic(err) + } + return ok } -// storeContractInfo persists the ContractInfo. No secondary index updated here. -func (k Keeper) storeContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress, contract *types.ContractInfo) { - store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractAddressKey(contractAddress), k.cdc.MustMarshal(contract)) +// mustStoreContractInfo persists the ContractInfo. No secondary index updated here. +func (k Keeper) mustStoreContractInfo(ctx context.Context, contractAddress sdk.AccAddress, contract *types.ContractInfo) { + store := k.storeService.OpenKVStore(ctx) + err := store.Set(types.GetContractAddressKey(contractAddress), k.cdc.MustMarshal(contract)) + if err != nil { + panic(err) + } } -func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ContractKeyPrefix) +func (k Keeper) IterateContractInfo(ctx context.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.ContractKeyPrefix) iter := prefixStore.Iterator(nil, nil) defer iter.Close() @@ -839,9 +923,9 @@ func (k Keeper) IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, typ // IterateContractState iterates through all elements of the key value store for the given contract address and passes // them to the provided callback function. The callback method can return true to abort early. -func (k Keeper) IterateContractState(ctx sdk.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool) { +func (k Keeper) IterateContractState(ctx context.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool) { prefixStoreKey := types.GetContractStorePrefix(contractAddress) - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) iter := prefixStore.Iterator(nil, nil) defer iter.Close() @@ -852,9 +936,9 @@ func (k Keeper) IterateContractState(ctx sdk.Context, contractAddress sdk.AccAdd } } -func (k Keeper) importContractState(ctx sdk.Context, contractAddress sdk.AccAddress, models []types.Model) error { +func (k Keeper) importContractState(ctx context.Context, contractAddress sdk.AccAddress, models []types.Model) error { prefixStoreKey := types.GetContractStorePrefix(contractAddress) - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) for _, model := range models { if model.Value == nil { model.Value = []byte{} @@ -867,10 +951,13 @@ func (k Keeper) importContractState(ctx sdk.Context, contractAddress sdk.AccAddr return nil } -func (k Keeper) GetCodeInfo(ctx sdk.Context, codeID uint64) *types.CodeInfo { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetCodeInfo(ctx context.Context, codeID uint64) *types.CodeInfo { + store := k.storeService.OpenKVStore(ctx) var codeInfo types.CodeInfo - codeInfoBz := store.Get(types.GetCodeKey(codeID)) + codeInfoBz, err := store.Get(types.GetCodeKey(codeID)) + if err != nil { + panic(err) + } if codeInfoBz == nil { return nil } @@ -878,13 +965,17 @@ func (k Keeper) GetCodeInfo(ctx sdk.Context, codeID uint64) *types.CodeInfo { return &codeInfo } -func (k Keeper) containsCodeInfo(ctx sdk.Context, codeID uint64) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.GetCodeKey(codeID)) +func (k Keeper) containsCodeInfo(ctx context.Context, codeID uint64) bool { + store := k.storeService.OpenKVStore(ctx) + ok, err := store.Has(types.GetCodeKey(codeID)) + if err != nil { + panic(err) + } + return ok } -func (k Keeper) IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.CodeKeyPrefix) +func (k Keeper) IterateCodeInfos(ctx context.Context, cb func(uint64, types.CodeInfo) bool) { + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.CodeKeyPrefix) iter := prefixStore.Iterator(nil, nil) defer iter.Close() @@ -898,10 +989,13 @@ func (k Keeper) IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo } } -func (k Keeper) GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetByteCode(ctx context.Context, codeID uint64) ([]byte, error) { + store := k.storeService.OpenKVStore(ctx) var codeInfo types.CodeInfo - codeInfoBz := store.Get(types.GetCodeKey(codeID)) + codeInfoBz, err := store.Get(types.GetCodeKey(codeID)) + if err != nil { + return nil, err + } if codeInfoBz == nil { return nil, nil } @@ -910,7 +1004,7 @@ func (k Keeper) GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error) { } // PinCode pins the wasm contract in wasmvm cache -func (k Keeper) pinCode(ctx sdk.Context, codeID uint64) error { +func (k Keeper) pinCode(ctx context.Context, codeID uint64) error { codeInfo := k.GetCodeInfo(ctx, codeID) if codeInfo == nil { return types.ErrNoSuchCodeFn(codeID).Wrapf("code id %d", codeID) @@ -919,11 +1013,14 @@ func (k Keeper) pinCode(ctx sdk.Context, codeID uint64) error { if err := k.wasmVM.Pin(codeInfo.CodeHash); err != nil { return errorsmod.Wrap(types.ErrPinContractFailed, err.Error()) } - store := ctx.KVStore(k.storeKey) + store := k.storeService.OpenKVStore(ctx) // store 1 byte to not run into `nil` debugging issues - store.Set(types.GetPinnedCodeIndexPrefix(codeID), []byte{1}) + err := store.Set(types.GetPinnedCodeIndexPrefix(codeID), []byte{1}) + if err != nil { + return err + } - ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(sdk.NewEvent( types.EventTypePinCode, sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)), )) @@ -931,7 +1028,7 @@ func (k Keeper) pinCode(ctx sdk.Context, codeID uint64) error { } // UnpinCode removes the wasm contract from wasmvm cache -func (k Keeper) unpinCode(ctx sdk.Context, codeID uint64) error { +func (k Keeper) unpinCode(ctx context.Context, codeID uint64) error { codeInfo := k.GetCodeInfo(ctx, codeID) if codeInfo == nil { return types.ErrNoSuchCodeFn(codeID).Wrapf("code id %d", codeID) @@ -940,10 +1037,13 @@ func (k Keeper) unpinCode(ctx sdk.Context, codeID uint64) error { return errorsmod.Wrap(types.ErrUnpinContractFailed, err.Error()) } - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetPinnedCodeIndexPrefix(codeID)) + store := k.storeService.OpenKVStore(ctx) + err := store.Delete(types.GetPinnedCodeIndexPrefix(codeID)) + if err != nil { + return err + } - ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(sdk.NewEvent( types.EventTypeUnpinCode, sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)), )) @@ -951,14 +1051,18 @@ func (k Keeper) unpinCode(ctx sdk.Context, codeID uint64) error { } // IsPinnedCode returns true when codeID is pinned in wasmvm cache -func (k Keeper) IsPinnedCode(ctx sdk.Context, codeID uint64) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.GetPinnedCodeIndexPrefix(codeID)) +func (k Keeper) IsPinnedCode(ctx context.Context, codeID uint64) bool { + store := k.storeService.OpenKVStore(ctx) + ok, err := store.Has(types.GetPinnedCodeIndexPrefix(codeID)) + if err != nil { + panic(err) + } + return ok } // InitializePinnedCodes updates wasmvm to pin to cache all contracts marked as pinned -func (k Keeper) InitializePinnedCodes(ctx sdk.Context) error { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PinnedCodeIndexPrefix) +func (k Keeper) InitializePinnedCodes(ctx context.Context) error { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.PinnedCodeIndexPrefix) iter := store.Iterator(nil, nil) defer iter.Close() @@ -976,7 +1080,7 @@ func (k Keeper) InitializePinnedCodes(ctx sdk.Context) error { } // setContractInfoExtension updates the extension point data that is stored with the contract info -func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAddress, ext types.ContractInfoExtension) error { +func (k Keeper) setContractInfoExtension(ctx context.Context, contractAddr sdk.AccAddress, ext types.ContractInfoExtension) error { info := k.GetContractInfo(ctx, contractAddr) if info == nil { return types.ErrNoSuchContractFn(contractAddr.String()). @@ -985,12 +1089,12 @@ func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAd if err := info.SetExtension(ext); err != nil { return err } - k.storeContractInfo(ctx, contractAddr, info) + k.mustStoreContractInfo(ctx, contractAddr, info) return nil } // setAccessConfig updates the access config of a code id. -func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, authz types.AuthorizationPolicy) error { +func (k Keeper) setAccessConfig(ctx context.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, authz types.AuthorizationPolicy) error { info := k.GetCodeInfo(ctx, codeID) if info == nil { return types.ErrNoSuchCodeFn(codeID).Wrapf("code id %d", codeID) @@ -1001,7 +1105,7 @@ func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAd } info.InstantiateConfig = newConfig - k.storeCodeInfo(ctx, codeID, *info) + k.mustStoreCodeInfo(ctx, codeID, *info) evt := sdk.NewEvent( types.EventTypeUpdateCodeAccessConfig, sdk.NewAttribute(types.AttributeKeyCodePermission, newConfig.Permission.String()), @@ -1011,7 +1115,7 @@ func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAd attr := sdk.NewAttribute(types.AttributeKeyAuthorizedAddresses, strings.Join(addrs, ",")) evt.Attributes = append(evt.Attributes, attr.ToKVPair()) } - ctx.EventManager().EmitEvent(evt) + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent(evt) return nil } @@ -1023,7 +1127,7 @@ func (k *Keeper) handleContractResponse( msgs []wasmvmtypes.SubMsg, attrs []wasmvmtypes.EventAttribute, data []byte, - evts wasmvmtypes.Events, + evts wasmvmtypes.Array[wasmvmtypes.Event], ) ([]byte, error) { attributeGasCost := k.gasRegister.EventCosts(attrs, evts) ctx.GasMeter().ConsumeGas(attributeGasCost, "Custom contract event attributes") @@ -1061,60 +1165,84 @@ func (k Keeper) consumeRuntimeGas(ctx sdk.Context, gas uint64) { ctx.GasMeter().ConsumeGas(consumed, "wasm contract") // throw OutOfGas error if we ran out (got exactly to zero due to better limit enforcing) if ctx.GasMeter().IsOutOfGas() { - panic(sdk.ErrorOutOfGas{Descriptor: "Wasm engine function execution"}) + panic(storetypes.ErrorOutOfGas{Descriptor: "Wasm engine function execution"}) } } -func (k Keeper) autoIncrementID(ctx sdk.Context, sequenceKey []byte) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get(sequenceKey) +func (k Keeper) mustAutoIncrementID(ctx context.Context, sequenceKey []byte) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(sequenceKey) + if err != nil { + panic(err) + } id := uint64(1) if bz != nil { id = binary.BigEndian.Uint64(bz) } bz = sdk.Uint64ToBigEndian(id + 1) - store.Set(sequenceKey, bz) + err = store.Set(sequenceKey, bz) + if err != nil { + panic(err) + } return id } // PeekAutoIncrementID reads the current value without incrementing it. -func (k Keeper) PeekAutoIncrementID(ctx sdk.Context, sequenceKey []byte) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get(sequenceKey) +func (k Keeper) PeekAutoIncrementID(ctx context.Context, sequenceKey []byte) (uint64, error) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(sequenceKey) + if err != nil { + return 0, errorsmod.Wrap(err, "sequence key") + } id := uint64(1) if bz != nil { id = binary.BigEndian.Uint64(bz) } - return id + return id, nil } -func (k Keeper) importAutoIncrementID(ctx sdk.Context, sequenceKey []byte, val uint64) error { - store := ctx.KVStore(k.storeKey) - if store.Has(sequenceKey) { +func (k Keeper) importAutoIncrementID(ctx context.Context, sequenceKey []byte, val uint64) error { + store := k.storeService.OpenKVStore(ctx) + ok, err := store.Has(sequenceKey) + if err != nil { + return errorsmod.Wrap(err, "sequence key") + } + if ok { return errorsmod.Wrapf(types.ErrDuplicate, "autoincrement id: %s", string(sequenceKey)) } bz := sdk.Uint64ToBigEndian(val) - store.Set(sequenceKey, bz) - return nil + return store.Set(sequenceKey, bz) } -func (k Keeper) importContract(ctx sdk.Context, contractAddr sdk.AccAddress, c *types.ContractInfo, state []types.Model, entries []types.ContractCodeHistoryEntry) error { +func (k Keeper) importContract(ctx context.Context, contractAddr sdk.AccAddress, c *types.ContractInfo, state []types.Model, historyEntries []types.ContractCodeHistoryEntry) error { if !k.containsCodeInfo(ctx, c.CodeID) { return types.ErrNoSuchCodeFn(c.CodeID).Wrapf("code id %d", c.CodeID) } if k.HasContractInfo(ctx, contractAddr) { return errorsmod.Wrapf(types.ErrDuplicate, "contract: %s", contractAddr) } + if len(historyEntries) == 0 { + return types.ErrEmpty.Wrap("contract history") + } creatorAddress, err := sdk.AccAddressFromBech32(c.Creator) if err != nil { return err } - k.appendToContractHistory(ctx, contractAddr, entries...) - k.storeContractInfo(ctx, contractAddr, c) - k.addToContractCodeSecondaryIndex(ctx, contractAddr, entries[len(entries)-1]) - k.addToContractCreatorSecondaryIndex(ctx, creatorAddress, entries[0].Updated, contractAddr) + err = k.appendToContractHistory(ctx, contractAddr, historyEntries...) + if err != nil { + return err + } + k.mustStoreContractInfo(ctx, contractAddr, c) + err = k.addToContractCodeSecondaryIndex(ctx, contractAddr, historyEntries[len(historyEntries)-1]) + if err != nil { + return err + } + err = k.addToContractCreatorSecondaryIndex(ctx, creatorAddress, historyEntries[0].Updated, contractAddr) + if err != nil { + return err + } return k.importContractState(ctx, contractAddr, state) } @@ -1124,17 +1252,17 @@ func (k Keeper) newQueryHandler(ctx sdk.Context, contractAddress sdk.AccAddress) // MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier type MultipliedGasMeter struct { - originalMeter sdk.GasMeter + originalMeter storetypes.GasMeter GasRegister types.GasRegister } -func NewMultipliedGasMeter(originalMeter sdk.GasMeter, gr types.GasRegister) MultipliedGasMeter { +func NewMultipliedGasMeter(originalMeter storetypes.GasMeter, gr types.GasRegister) MultipliedGasMeter { return MultipliedGasMeter{originalMeter: originalMeter, GasRegister: gr} } var _ wasmvm.GasMeter = MultipliedGasMeter{} -func (m MultipliedGasMeter) GasConsumed() sdk.Gas { +func (m MultipliedGasMeter) GasConsumed() storetypes.Gas { return m.GasRegister.ToWasmVMGas(m.originalMeter.GasConsumed()) } @@ -1153,11 +1281,11 @@ func moduleLogger(ctx sdk.Context) log.Logger { // Querier creates a new grpc querier instance func Querier(k *Keeper) *GrpcQuerier { - return NewGrpcQuerier(k.cdc, k.storeKey, k, k.queryGasLimit) + return NewGrpcQuerier(k.cdc, k.storeService, k, k.queryGasLimit) } // QueryGasLimit returns the gas limit for smart queries. -func (k Keeper) QueryGasLimit() sdk.Gas { +func (k Keeper) QueryGasLimit() storetypes.Gas { return k.queryGasLimit } @@ -1215,13 +1343,13 @@ func NewVestingCoinBurner(bank types.BankKeeper) VestingCoinBurner { // CleanupExistingAccount accepts only vesting account types to burns all their original vesting coin balances. // Other account types will be rejected and returned as unhandled. -func (b VestingCoinBurner) CleanupExistingAccount(ctx sdk.Context, existingAcc authtypes.AccountI) (handled bool, err error) { +func (b VestingCoinBurner) CleanupExistingAccount(ctx sdk.Context, existingAcc sdk.AccountI) (handled bool, err error) { v, ok := existingAcc.(vestingexported.VestingAccount) if !ok { return false, nil } - ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx = ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) coinsToBurn := sdk.NewCoins() for _, orig := range v.GetOriginalVesting() { // focus on the coin denoms that were setup originally; getAllBalances has some issues coinsToBurn = append(coinsToBurn, b.bank.GetBalance(ctx, existingAcc.GetAddress(), orig.Denom)) diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go index 743ac64de4..020fef834d 100644 --- a/x/wasm/keeper/keeper_cgo.go +++ b/x/wasm/keeper/keeper_cgo.go @@ -5,10 +5,12 @@ package keeper import ( "path/filepath" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" + + "cosmossdk.io/collections" + corestoretypes "cosmossdk.io/core/store" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -17,7 +19,7 @@ import ( // If customEncoders is non-nil, we can use this to override some of the message handler, especially custom func NewKeeper( cdc codec.Codec, - storeKey storetypes.StoreKey, + storeService corestoretypes.KVStoreService, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, @@ -31,12 +33,13 @@ func NewKeeper( _ GRPCQueryRouter, homeDir string, wasmConfig types.WasmConfig, - availableCapabilities string, + availableCapabilities []string, authority string, opts ...Option, ) Keeper { + sb := collections.NewSchemaBuilder(storeService) keeper := &Keeper{ - storeKey: storeKey, + storeService: storeService, cdc: cdc, wasmVM: nil, accountKeeper: accountKeeper, @@ -49,6 +52,7 @@ func NewKeeper( gasRegister: types.NewDefaultWasmGasRegister(), maxQueryStackSize: types.DefaultMaxQueryStackSize, acceptedAccountTypes: defaultAcceptedAccountTypes, + params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), propagateGovAuthorization: map[types.AuthorizationPolicyAction]struct{}{ types.AuthZActionInstantiate: {}, }, diff --git a/x/wasm/keeper/keeper_no_cgo.go b/x/wasm/keeper/keeper_no_cgo.go index 4a5db265a6..261b2bad2a 100644 --- a/x/wasm/keeper/keeper_no_cgo.go +++ b/x/wasm/keeper/keeper_no_cgo.go @@ -3,8 +3,9 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index c55e738d5c..1ff9c720d0 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -21,10 +21,11 @@ import ( "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - stypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -42,7 +43,9 @@ import ( //go:embed testdata/hackatom.wasm var hackatomWasm []byte -const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4" +var AvailableCapabilities = []string{ + "iterator", "staking", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", +} func TestNewKeeper(t *testing.T) { _, keepers := CreateTestInput(t, false, AvailableCapabilities) @@ -306,7 +309,7 @@ func TestCreateWithSimulation(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) ctx = ctx.WithBlockHeader(tmproto.Header{Height: 1}). - WithGasMeter(stypes.NewInfiniteGasMeter()) + WithGasMeter(storetypes.NewInfiniteGasMeter()) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) @@ -318,7 +321,7 @@ func TestCreateWithSimulation(t *testing.T) { // then try to create it in non-simulation mode (should not fail) ctx, keepers = CreateTestInput(t, false, AvailableCapabilities) - ctx = ctx.WithGasMeter(sdk.NewGasMeter(10_000_000)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(10_000_000)) creator = keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) contractID, _, err = keepers.ContractKeeper.Create(ctx, creator, hackatomWasm, nil) @@ -337,15 +340,15 @@ func TestIsSimulationMode(t *testing.T) { exp bool }{ "genesis block": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{}).WithGasMeter(stypes.NewInfiniteGasMeter()), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{}).WithGasMeter(storetypes.NewInfiniteGasMeter()), exp: false, }, "any regular block": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(stypes.NewGasMeter(10000000)), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(storetypes.NewGasMeter(10000000)), exp: false, }, "simulation": { - ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(stypes.NewInfiniteGasMeter()), + ctx: sdk.Context{}.WithBlockHeader(tmproto.Header{Height: 1}).WithGasMeter(storetypes.NewInfiniteGasMeter()), exp: true, }, } @@ -385,12 +388,12 @@ func TestCreateWithBrokenGzippedPayload(t *testing.T) { wasmCode, err := os.ReadFile("./testdata/broken_crc.gzip") require.NoError(t, err, "reading gzipped WASM code") - gm := sdk.NewInfiniteGasMeter() + gm := storetypes.NewInfiniteGasMeter() codeID, checksum, err := keeper.Create(ctx.WithGasMeter(gm), creator, wasmCode, nil) require.Error(t, err) assert.Empty(t, codeID) assert.Empty(t, checksum) - assert.GreaterOrEqual(t, gm.GasConsumed(), sdk.Gas(121384)) // 809232 * 0.15 (default uncompress costs) = 121384 + assert.GreaterOrEqual(t, gm.GasConsumed(), storetypes.Gas(121384)) // 809232 * 0.15 (default uncompress costs) = 121384 } func TestInstantiate(t *testing.T) { @@ -418,7 +421,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1b5bd), gasAfter-gasBefore) + require.Equal(t, uint64(0x1bc64), gasAfter-gasBefore) } // ensure it is stored properly @@ -573,11 +576,11 @@ func TestInstantiateWithAccounts(t *testing.T) { specs := map[string]struct { option Option - account authtypes.AccountI + account sdk.AccountI initBalance sdk.Coin deposit sdk.Coins expErr error - expAccount authtypes.AccountI + expAccount sdk.AccountI expBalance sdk.Coins }{ "unused BaseAccount exists": { @@ -600,60 +603,60 @@ func TestInstantiateWithAccounts(t *testing.T) { }, "no account existed before create with deposit": { expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+1, 0), // +1 for next seq - deposit: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), - expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), + deposit: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), + expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), }, "prunable DelayedVestingAccount gets overwritten": { - account: vestingtypes.NewDelayedVestingAccount( + account: must(vestingtypes.NewDelayedVestingAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix()), - initBalance: sdk.NewCoin("denom", sdk.NewInt(1_000)), - deposit: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1))), + sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix())), + initBalance: sdk.NewCoin("denom", sdkmath.NewInt(1_000)), + deposit: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created - expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1))), + expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), }, "prunable ContinuousVestingAccount gets overwritten": { - account: vestingtypes.NewContinuousVestingAccount( + account: must(vestingtypes.NewContinuousVestingAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(time.Hour).Unix(), time.Now().Add(2*time.Hour).Unix()), - initBalance: sdk.NewCoin("denom", sdk.NewInt(1_000)), - deposit: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1))), + sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), time.Now().Add(time.Hour).Unix(), time.Now().Add(2*time.Hour).Unix())), + initBalance: sdk.NewCoin("denom", sdkmath.NewInt(1_000)), + deposit: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created - expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1))), - }, - "prunable account without balance gets overwritten": { - account: vestingtypes.NewContinuousVestingAccount( - authtypes.NewBaseAccount(contractAddr, nil, 0, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(0))), time.Now().Add(time.Hour).Unix(), time.Now().Add(2*time.Hour).Unix()), - expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created - expBalance: sdk.NewCoins(), - }, + expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), + }, + // "prunable account without balance gets overwritten": { // todo : can not initialize vesting with empty balance + // account: must(vestingtypes.NewContinuousVestingAccount( + // authtypes.NewBaseAccount(contractAddr, nil, 0, 0), + // sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(0))), time.Now().Add(time.Hour).Unix(), time.Now().Add(2*time.Hour).Unix())), + // expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+2, 0), // +1 for next seq, +1 for spec.account created + // expBalance: sdk.NewCoins(), + // }, "unknown account type is rejected with error": { account: authtypes.NewModuleAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), "testing", ), - initBalance: sdk.NewCoin("denom", sdk.NewInt(1_000)), + initBalance: sdk.NewCoin("denom", sdkmath.NewInt(1_000)), expErr: types.ErrAccountExists, }, "with option used to set non default type to accept list": { option: WithAcceptedAccountTypesOnContractInstantiation(&vestingtypes.DelayedVestingAccount{}), - account: vestingtypes.NewDelayedVestingAccount( + account: must(vestingtypes.NewDelayedVestingAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix()), - initBalance: sdk.NewCoin("denom", sdk.NewInt(1_000)), - deposit: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1))), - expAccount: vestingtypes.NewDelayedVestingAccount(authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+1, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix()), - expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_001))), + sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix())), + initBalance: sdk.NewCoin("denom", sdkmath.NewInt(1_000)), + deposit: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1))), + expAccount: must(vestingtypes.NewDelayedVestingAccount(authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+1, 0), + sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix())), + expBalance: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_001))), }, "pruning account fails": { - option: WithAccountPruner(wasmtesting.AccountPrunerMock{CleanupExistingAccountFn: func(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) { + option: WithAccountPruner(wasmtesting.AccountPrunerMock{CleanupExistingAccountFn: func(ctx sdk.Context, existingAccount sdk.AccountI) (handled bool, err error) { return false, types.ErrUnsupportedForContract.Wrap("testing") }}), - account: vestingtypes.NewDelayedVestingAccount( + account: must(vestingtypes.NewDelayedVestingAccount( authtypes.NewBaseAccount(contractAddr, nil, 0, 0), - sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix()), + sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix())), expErr: types.ErrUnsupportedForContract, }, } @@ -709,12 +712,100 @@ func TestInstantiateWithNonExistingCodeID(t *testing.T) { require.Nil(t, addr) } +func TestContractErrorRedacting(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + + deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) + creator := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) + keepers.Faucet.Fund(ctx, creator, deposit...) + example := StoreHackatomExampleContract(t, ctx, keepers) + + initMsg := HackatomExampleInitMsg{ + Verifier: []byte{1, 2, 3}, // invalid length + Beneficiary: RandomAccountAddress(t), + } + initMsgBz, err := json.Marshal(initMsg) + require.NoError(t, err) + + em := sdk.NewEventManager() + + _, _, err = keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil) + require.Error(t, err) + require.Contains(t, err.Error(), "addr_validate errored: invalid address") + + err = redactError(err) + // contract error should not be redacted + require.Contains(t, err.Error(), "addr_validate errored: invalid address") +} + +func TestContractErrorGetsForwarded(t *testing.T) { + // This test makes sure that a contract gets the error message from its submessage execution + // in a non-redacted form if that error comes from the contract in the submessage. + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + + reflect1 := InstantiateReflectExampleContract(t, ctx, keepers) + // reflect2 will be the contract that errors. It is owned by the other reflect contract. + // This is necessary because the reflect contract only accepts messages from its owner. + reflect2, _, err := keepers.ContractKeeper.Instantiate(ctx, reflect1.CodeID, reflect1.Contract, reflect1.Contract, []byte("{}"), "reflect2", sdk.NewCoins()) + require.NoError(t, err) + + const SubMsgID = 1 + // Make the reflect1 contract send a submessage to reflect2. That sub-message will error. + execMsg := testdata.ReflectHandleMsg{ + ReflectSubMsg: &testdata.ReflectSubPayload{ + Msgs: []wasmvmtypes.SubMsg{ + { + ID: SubMsgID, + Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{ + Execute: &wasmvmtypes.ExecuteMsg{ + ContractAddr: reflect2.String(), + // This message will error in the reflect contract as an empty "msgs" array is not allowed + Msg: mustMarshal(t, testdata.ReflectHandleMsg{ + Reflect: &testdata.ReflectPayload{ + Msgs: []wasmvmtypes.CosmosMsg{}, + }, + }), + }, + }, + }, + ReplyOn: wasmvmtypes.ReplyError, // we want to see the error + }, + }, + }, + } + execMsgBz := mustMarshal(t, execMsg) + + em := sdk.NewEventManager() + _, err = keepers.ContractKeeper.Execute( + ctx.WithEventManager(em), + reflect1.Contract, + reflect1.CreatorAddr, + execMsgBz, + nil, + ) + require.NoError(t, err) + + // now query the submessage reply + queryMsgBz := mustMarshal(t, testdata.ReflectQueryMsg{ + SubMsgResult: &testdata.SubCall{ + ID: SubMsgID, + }, + }) + queryResponse, err := keepers.WasmKeeper.QuerySmart(ctx, reflect1.Contract, queryMsgBz) + require.NoError(t, err) + var submsgReply wasmvmtypes.Reply + mustUnmarshal(t, queryResponse, &submsgReply) + + assert.Equal(t, "Messages empty. Must reflect at least one message: execute wasm contract failed", submsgReply.Result.Err) +} + func TestInstantiateWithContractDataResponse(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) wasmEngineMock := &wasmtesting.MockWasmEngine{ - InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{Data: []byte("my-response-data")}, 0, nil + InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Data: []byte("my-response-data")}}, 0, nil }, AnalyzeCodeFn: wasmtesting.WithoutIBCAnalyzeFn, StoreCodeFn: wasmtesting.NoOpStoreCodeFn, @@ -738,10 +829,10 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) { keeper := keepers.WasmKeeper var instantiationCount int - callbacks := make([]func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error), 2) + callbacks := make([]func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error), 2) wasmEngineMock := &wasmtesting.MockWasmEngine{ // dispatch instantiation calls to callbacks - InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { require.Greater(t, len(callbacks), instantiationCount, "unexpected call to instantiation") do := callbacks[instantiationCount] instantiationCount++ @@ -761,24 +852,29 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) { example := StoreRandomContract(t, ctx, keepers, wasmEngineMock) // factory contract - callbacks[0] = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + callbacks[0] = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { t.Log("called factory") - return &wasmvmtypes.Response{Data: []byte("parent"), Messages: []wasmvmtypes.SubMsg{ - { - ID: 1, ReplyOn: wasmvmtypes.ReplyNever, - Msg: wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{ - Instantiate: &wasmvmtypes.InstantiateMsg{CodeID: example.CodeID, Msg: []byte(`{}`), Label: "child"}, + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Data: []byte("parent"), + Messages: []wasmvmtypes.SubMsg{ + { + ID: 1, ReplyOn: wasmvmtypes.ReplyNever, + Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{ + Instantiate: &wasmvmtypes.InstantiateMsg{CodeID: example.CodeID, Msg: []byte(`{}`), Label: "child"}, + }, + }, }, }, }, - }}, 0, nil + }, 0, nil } // child contract var capturedSenderAddr string var capturedCodeInfo []byte - callbacks[1] = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + callbacks[1] = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { t.Log("called child") capturedSenderAddr = info.Sender var err error @@ -788,7 +884,7 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) { }, }, gasLimit) require.NoError(t, err) - return &wasmvmtypes.Response{Data: []byte("child")}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Data: []byte("child")}}, 0, nil } // when @@ -843,7 +939,7 @@ func TestExecute(t *testing.T) { assert.Equal(t, deposit, bankKeeper.GetAllBalances(ctx, contractAcct.GetAddress())) // unauthorized - trialCtx so we don't change state - trialCtx := ctx.WithMultiStore(ctx.MultiStore().CacheWrap().(sdk.MultiStore)) + trialCtx := ctx.WithMultiStore(ctx.MultiStore().CacheWrap().(storetypes.MultiStore)) _, err = keepers.ContractKeeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil) require.Error(t, err) require.True(t, errors.Is(err, types.ErrExecuteFailed)) @@ -862,7 +958,7 @@ func TestExecute(t *testing.T) { // make sure gas is properly deducted from ctx gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1a155), gasAfter-gasBefore) + require.Equal(t, uint64(0x1ac6a), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) @@ -1016,9 +1112,9 @@ func TestExecuteWithPanic(t *testing.T) { // let's make sure we get a reasonable error, no panic/crash _, err = keepers.ContractKeeper.Execute(ctx, addr, fred, []byte(`{"panic":{}}`), topUp) require.Error(t, err) - require.True(t, errors.Is(err, types.ErrExecuteFailed)) + require.True(t, errors.Is(err, types.ErrVMError)) // test with contains as "Display" implementation of the Wasmer "RuntimeError" is different for Mac and Linux - assert.Contains(t, err.Error(), "Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: Aborted: panicked at 'This page intentionally faulted', src/contract.rs:169:5: execute wasm contract failed") + assert.Contains(t, err.Error(), "Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: Aborted: panicked at 'This page intentionally faulted', src/contract.rs:169:5: wasmvm error") } func TestExecuteWithCpuLoop(t *testing.T) { @@ -1047,14 +1143,14 @@ func TestExecuteWithCpuLoop(t *testing.T) { // make sure we set a limit before calling var gasLimit uint64 = 400_000 - ctx = ctx.WithGasMeter(sdk.NewGasMeter(gasLimit)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(gasLimit)) require.Equal(t, uint64(0), ctx.GasMeter().GasConsumed()) // ensure we get an out of gas panic defer func() { r := recover() require.NotNil(t, r) - _, ok := r.(sdk.ErrorOutOfGas) + _, ok := r.(storetypes.ErrorOutOfGas) require.True(t, ok, "%v", r) }() @@ -1090,14 +1186,14 @@ func TestExecuteWithStorageLoop(t *testing.T) { // make sure we set a limit before calling var gasLimit uint64 = 400_002 - ctx = ctx.WithGasMeter(sdk.NewGasMeter(gasLimit)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(gasLimit)) require.Equal(t, uint64(0), ctx.GasMeter().GasConsumed()) // ensure we get an out of gas panic defer func() { r := recover() require.NotNil(t, r) - _, ok := r.(sdk.ErrorOutOfGas) + _, ok := r.(storetypes.ErrorOutOfGas) require.True(t, ok, "%v", r) }() @@ -1244,7 +1340,7 @@ func TestMigrate(t *testing.T) { initMsg: initMsgBz, fromCodeID: originalCodeID, toCodeID: originalCodeID, - expErr: types.ErrMigrationFailed, + expErr: types.ErrVMError, }, "fail when no IBC callbacks": { admin: fred, @@ -1310,21 +1406,22 @@ func TestMigrateReplacesTheSecondIndex(t *testing.T) { example := InstantiateHackatomExampleContract(t, ctx, keepers) // then assert a second index exists - store := ctx.KVStore(keepers.WasmKeeper.storeKey) + store := keepers.WasmKeeper.storeService.OpenKVStore(ctx) oldContractInfo := keepers.WasmKeeper.GetContractInfo(ctx, example.Contract) require.NotNil(t, oldContractInfo) createHistoryEntry := types.ContractCodeHistoryEntry{ CodeID: example.CodeID, Updated: types.NewAbsoluteTxPosition(ctx), } - exists := store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, createHistoryEntry)) + exists, err := store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, createHistoryEntry)) + require.NoError(t, err) require.True(t, exists) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) // increment for different block // when do migrate newCodeExample := StoreBurnerExampleContract(t, ctx, keepers) migMsgBz := BurnerExampleInitMsg{Payout: example.CreatorAddr}.GetBytes(t) - _, err := keepers.ContractKeeper.Migrate(ctx, example.Contract, example.CreatorAddr, newCodeExample.CodeID, migMsgBz) + _, err = keepers.ContractKeeper.Migrate(ctx, example.Contract, example.CreatorAddr, newCodeExample.CodeID, migMsgBz) require.NoError(t, err) // then the new index exists @@ -1332,10 +1429,12 @@ func TestMigrateReplacesTheSecondIndex(t *testing.T) { CodeID: newCodeExample.CodeID, Updated: types.NewAbsoluteTxPosition(ctx), } - exists = store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, migrateHistoryEntry)) + exists, err = store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, migrateHistoryEntry)) + require.NoError(t, err) require.True(t, exists) // and the old index was removed - exists = store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, createHistoryEntry)) + exists, err = store.Has(types.GetContractByCreatedSecondaryIndexKey(example.Contract, createHistoryEntry)) + require.NoError(t, err) require.False(t, exists) } @@ -1468,8 +1567,8 @@ func TestIterateContractsByCode(t *testing.T) { func TestIterateContractsByCodeWithMigration(t *testing.T) { // mock migration so that it does not fail when migrate example1 to example2.codeID - mockWasmVM := wasmtesting.MockWasmEngine{MigrateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{}, 1, nil + mockWasmVM := wasmtesting.MockWasmEngine{MigrateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 1, nil }} wasmtesting.MakeInstantiable(&mockWasmVM) ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithWasmEngine(&mockWasmVM)) @@ -1506,8 +1605,8 @@ type sudoMsg struct { } type stealFundsMsg struct { - Recipient string `json:"recipient"` - Amount wasmvmtypes.Coins `json:"amount"` + Recipient string `json:"recipient"` + Amount wasmvmtypes.Array[wasmvmtypes.Coin] `json:"amount"` } func TestSudo(t *testing.T) { @@ -1545,7 +1644,7 @@ func TestSudo(t *testing.T) { // to end users (via Tx/Execute). StealFunds: stealFundsMsg{ Recipient: community.String(), - Amount: wasmvmtypes.Coins{wasmvmtypes.NewCoin(76543, "denom")}, + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{wasmvmtypes.NewCoin(76543, "denom")}, }, } sudoMsg, err := json.Marshal(msg) @@ -1838,18 +1937,20 @@ func TestPinnedContractLoops(t *testing.T) { require.NoError(t, k.pinCode(ctx, example.CodeID)) var loops int anyMsg := []byte(`{}`) - mock.ExecuteFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + mock.ExecuteFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { loops++ - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - { - ID: 1, - ReplyOn: wasmvmtypes.ReplyNever, - Msg: wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{ - Execute: &wasmvmtypes.ExecuteMsg{ - ContractAddr: example.Contract.String(), - Msg: anyMsg, + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + { + ID: 1, + ReplyOn: wasmvmtypes.ReplyNever, + Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{ + Execute: &wasmvmtypes.ExecuteMsg{ + ContractAddr: example.Contract.String(), + Msg: anyMsg, + }, }, }, }, @@ -1857,8 +1958,8 @@ func TestPinnedContractLoops(t *testing.T) { }, }, 0, nil } - ctx = ctx.WithGasMeter(sdk.NewGasMeter(20000)) - require.PanicsWithValue(t, sdk.ErrorOutOfGas{Descriptor: "ReadFlat"}, func() { + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(30_000)) + require.PanicsWithValue(t, storetypes.ErrorOutOfGas{Descriptor: "ReadFlat"}, func() { _, err := k.execute(ctx, example.Contract, RandomAccountAddress(t), anyMsg, nil) require.NoError(t, err) }) @@ -2001,7 +2102,12 @@ func TestReply(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - mock.ReplyFn = spec.replyFn + mock.ReplyFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + resp, gasUsed, err := spec.replyFn(codeID, env, reply, store, goapi, querier, gasMeter, gasLimit, deserCost) + return &wasmvmtypes.ContractResult{ + Ok: resp, + }, gasUsed, err + } em := sdk.NewEventManager() gotData, gotErr := k.reply(ctx.WithEventManager(em), example.Contract, wasmvmtypes.Reply{}) if spec.expErr { @@ -2027,23 +2133,25 @@ func TestQueryIsolation(t *testing.T) { return other.HandleQuery(ctx, caller, request) } // here we write to DB which should not be persisted - ctx.KVStore(k.storeKey).Set([]byte(`set_in_query`), []byte(`this_is_allowed`)) - return nil, nil + err := k.storeService.OpenKVStore(ctx).Set([]byte(`set_in_query`), []byte(`this_is_allowed`)) + return nil, err }) }).apply(k) // when - mock.ReplyFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + mock.ReplyFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { _, err := querier.Query(wasmvmtypes.QueryRequest{ Custom: []byte(`{}`), }, 10000*types.DefaultGasMultiplier) require.NoError(t, err) - return &wasmvmtypes.Response{}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 0, nil } em := sdk.NewEventManager() _, gotErr := k.reply(ctx.WithEventManager(em), example.Contract, wasmvmtypes.Reply{}) require.NoError(t, gotErr) - assert.Nil(t, ctx.KVStore(k.storeKey).Get([]byte(`set_in_query`))) + got, err := k.storeService.OpenKVStore(ctx).Get([]byte(`set_in_query`)) + require.NoError(t, err) + assert.Nil(t, got) } func TestSetAccessConfig(t *testing.T) { @@ -2147,7 +2255,7 @@ func TestSetAccessConfig(t *testing.T) { err := k.SetParams(ctx, newParams) require.NoError(t, err) - k.storeCodeInfo(ctx, codeID, types.NewCodeInfo(nil, creatorAddr, types.AllowNobody)) + k.mustStoreCodeInfo(ctx, codeID, types.NewCodeInfo(nil, creatorAddr, types.AllowNobody)) // when gotErr := k.setAccessConfig(ctx, codeID, spec.caller, spec.newConfig, spec.authz) if spec.expErr { @@ -2194,7 +2302,7 @@ func TestAppendToContractHistory(t *testing.T) { for i := 0; i < 10; i++ { var entry types.ContractCodeHistoryEntry f.RandSource(sRandom).Fuzz(&entry) - k.appendToContractHistory(ctx, addr, entry) + require.NoError(t, k.appendToContractHistory(ctx, addr, entry)) orderedEntries[j] = append(orderedEntries[j], entry) } } @@ -2202,7 +2310,7 @@ func TestAppendToContractHistory(t *testing.T) { for j, addr := range variableLengthAddresses { gotHistory := k.GetContractHistory(ctx, addr) assert.Equal(t, orderedEntries[j], gotHistory, "%d: %X", j, addr) - assert.Equal(t, orderedEntries[j][len(orderedEntries[j])-1], k.getLastContractHistoryEntry(ctx, addr)) + assert.Equal(t, orderedEntries[j][len(orderedEntries[j])-1], k.mustGetLastContractHistoryEntry(ctx, addr)) } }) } @@ -2216,40 +2324,35 @@ func TestCoinBurnerPruneBalances(t *testing.T) { // create vesting account var vestingAddr sdk.AccAddress = rand.Bytes(types.ContractAddrLen) msgCreateVestingAccount := vestingtypes.NewMsgCreateVestingAccount(senderAddr, vestingAddr, amts, time.Now().Add(time.Minute).Unix(), false) - _, err := vesting.NewMsgServerImpl(keepers.AccountKeeper, keepers.BankKeeper).CreateVestingAccount(sdk.WrapSDKContext(parentCtx), msgCreateVestingAccount) + _, err := vesting.NewMsgServerImpl(keepers.AccountKeeper, keepers.BankKeeper).CreateVestingAccount(parentCtx, msgCreateVestingAccount) require.NoError(t, err) myVestingAccount := keepers.AccountKeeper.GetAccount(parentCtx, vestingAddr) require.NotNil(t, myVestingAccount) specs := map[string]struct { - setupAcc func(t *testing.T, ctx sdk.Context) authtypes.AccountI + setupAcc func(t *testing.T, ctx sdk.Context) sdk.AccountI expBalances sdk.Coins expHandled bool expErr *errorsmod.Error }{ "vesting account - all removed": { - setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.AccountI { - t.Helper() - return myVestingAccount - }, + setupAcc: func(t *testing.T, ctx sdk.Context) sdk.AccountI { return myVestingAccount }, expBalances: sdk.NewCoins(), expHandled: true, }, "vesting account with other tokens - only original denoms removed": { - setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.AccountI { - t.Helper() - keepers.Faucet.Fund(ctx, vestingAddr, sdk.NewCoin("other", sdk.NewInt(2))) + setupAcc: func(t *testing.T, ctx sdk.Context) sdk.AccountI { + keepers.Faucet.Fund(ctx, vestingAddr, sdk.NewCoin("other", sdkmath.NewInt(2))) return myVestingAccount }, - expBalances: sdk.NewCoins(sdk.NewCoin("other", sdk.NewInt(2))), + expBalances: sdk.NewCoins(sdk.NewCoin("other", sdkmath.NewInt(2))), expHandled: true, }, "non vesting account - not handled": { - setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.AccountI { - t.Helper() + setupAcc: func(t *testing.T, ctx sdk.Context) sdk.AccountI { return &authtypes.BaseAccount{Address: myVestingAccount.GetAddress().String()} }, - expBalances: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(100))), + expBalances: sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(100))), expHandled: false, }, } @@ -2261,7 +2364,7 @@ func TestCoinBurnerPruneBalances(t *testing.T) { keepers.AccountKeeper.SetAccount(ctx, keepers.AccountKeeper.NewAccountWithAddress(ctx, vestingAddr)) // when - noGasCtx := ctx.WithGasMeter(sdk.NewGasMeter(0)) // should not use callers gas + noGasCtx := ctx.WithGasMeter(storetypes.NewGasMeter(0)) // should not use callers gas gotHandled, gotErr := NewVestingCoinBurner(keepers.BankKeeper).CleanupExistingAccount(noGasCtx, existingAccount) // then if spec.expErr != nil { @@ -2318,7 +2421,7 @@ func TestIteratorContractByCreator(t *testing.T) { Beneficiary: mockAddress1, }.GetBytes(t) - depositContract := sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))) + depositContract := sdk.NewCoins(sdk.NewCoin("denom", sdkmath.NewInt(1_000))) gotAddr1, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, mockAddress1, nil, initMsgBz, "label", depositContract) ctx := parentCtx.WithBlockHeight(parentCtx.BlockHeight() + 1) @@ -2435,38 +2538,38 @@ func TestSetContractAdmin(t *testing.T) { func TestGasConsumed(t *testing.T) { specs := map[string]struct { - originalMeter stypes.GasMeter + originalMeter storetypes.GasMeter gasRegister types.WasmGasRegister - consumeGas sdk.Gas + consumeGas storetypes.Gas expPanic bool expMultipliedGasConsumed uint64 }{ "all good": { - originalMeter: sdk.NewGasMeter(100), + originalMeter: storetypes.NewGasMeter(100), gasRegister: types.NewWasmGasRegister(types.DefaultGasRegisterConfig()), - consumeGas: sdk.Gas(1), - expMultipliedGasConsumed: 140000000, + consumeGas: storetypes.Gas(1), + expMultipliedGasConsumed: 140000, }, "consumeGas = limit": { - originalMeter: sdk.NewGasMeter(1), + originalMeter: storetypes.NewGasMeter(1), gasRegister: types.NewWasmGasRegister(types.DefaultGasRegisterConfig()), - consumeGas: sdk.Gas(1), - expMultipliedGasConsumed: 140000000, + consumeGas: storetypes.Gas(1), + expMultipliedGasConsumed: 140000, }, "consumeGas > limit": { - originalMeter: sdk.NewGasMeter(10), + originalMeter: storetypes.NewGasMeter(10), gasRegister: types.NewWasmGasRegister(types.DefaultGasRegisterConfig()), - consumeGas: sdk.Gas(11), + consumeGas: storetypes.Gas(11), expPanic: true, }, "nil original meter": { gasRegister: types.NewWasmGasRegister(types.DefaultGasRegisterConfig()), - consumeGas: sdk.Gas(1), + consumeGas: storetypes.Gas(1), expPanic: true, }, "nil gas register": { - originalMeter: sdk.NewGasMeter(100), - consumeGas: sdk.Gas(1), + originalMeter: storetypes.NewGasMeter(100), + consumeGas: storetypes.Gas(1), expPanic: true, }, } @@ -2558,3 +2661,10 @@ func attrsToStringMap(attrs []abci.EventAttribute) map[string]string { } return r } + +func must[t any](s t, err error) t { + if err != nil { + panic(err) + } + return s +} diff --git a/x/wasm/keeper/metrics.go b/x/wasm/keeper/metrics.go index 93f88581ca..37d7cd4300 100644 --- a/x/wasm/keeper/metrics.go +++ b/x/wasm/keeper/metrics.go @@ -1,7 +1,7 @@ package keeper import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/prometheus/client_golang/prometheus" ) diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index a7209035fc..5188c5bb2a 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -28,11 +28,11 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error { // Migrate2to3 migrates the x/wasm module state from the consensus // version 2 to version 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v2.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc) + return v2.MigrateStore(ctx, m.keeper.storeService, m.legacySubspace, m.keeper.cdc) } // Migrate3to4 migrates the x/wasm module state from the consensus // version 3 to version 4. func (m Migrator) Migrate3to4(ctx sdk.Context) error { - return v3.NewMigrator(m.keeper, m.keeper.storeCodeInfo).Migrate3to4(ctx, m.keeper.storeKey, m.keeper.cdc) + return v3.NewMigrator(m.keeper, m.keeper.mustStoreCodeInfo).Migrate3to4(ctx, m.keeper.storeService, m.keeper.cdc) } diff --git a/x/wasm/keeper/migrations_integration_test.go b/x/wasm/keeper/migrations_integration_test.go index 5cd5a78283..0962a79977 100644 --- a/x/wasm/keeper/migrations_integration_test.go +++ b/x/wasm/keeper/migrations_integration_test.go @@ -3,20 +3,24 @@ package keeper_test import ( "testing" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cometbft/cometbft/libs/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + upgradetypes "cosmossdk.io/x/upgrade/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/CosmWasm/wasmd/app" + v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2" "github.com/CosmWasm/wasmd/x/wasm/types" ) func TestModuleMigrations(t *testing.T) { wasmApp := app.Setup(t) + myAddress := sdk.AccAddress(rand.Bytes(address.Len)) upgradeHandler := func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { //nolint:unparam return wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM) @@ -30,11 +34,19 @@ func TestModuleMigrations(t *testing.T) { "with legacy params migrated": { startVersion: 1, setup: func(ctx sdk.Context) { - params := types.Params{ - CodeUploadAccess: types.AllowNobody, - InstantiateDefaultPermission: types.AccessTypeNobody, + params := v2.Params{ + CodeUploadAccess: v2.AccessConfig{Permission: v2.AccessTypeNobody}, + InstantiateDefaultPermission: v2.AccessTypeNobody, } + + // upgrade code shipped with v0.40 + // https://github.com/CosmWasm/wasmd/blob/v0.40.0/app/upgrades.go#L66 sp, _ := wasmApp.ParamsKeeper.GetSubspace(types.ModuleName) + keyTable := v2.ParamKeyTable() + if !sp.HasKeyTable() { + sp.WithKeyTable(keyTable) + } + sp.SetParamSet(ctx, ¶ms) }, exp: types.Params{ @@ -42,6 +54,29 @@ func TestModuleMigrations(t *testing.T) { InstantiateDefaultPermission: types.AccessTypeNobody, }, }, + "with legacy one address type replaced": { + startVersion: 1, + setup: func(ctx sdk.Context) { + params := v2.Params{ + CodeUploadAccess: v2.AccessConfig{Permission: v2.AccessTypeOnlyAddress, Address: myAddress.String()}, + InstantiateDefaultPermission: v2.AccessTypeNobody, + } + + // upgrade code shipped with v0.40 + // https://github.com/CosmWasm/wasmd/blob/v0.40.0/app/upgrades.go#L66 + sp, _ := wasmApp.ParamsKeeper.GetSubspace(types.ModuleName) + keyTable := v2.ParamKeyTable() + if !sp.HasKeyTable() { + sp.WithKeyTable(keyTable) + } + + sp.SetParamSet(ctx, ¶ms) + }, + exp: types.Params{ + CodeUploadAccess: types.AccessTypeAnyOfAddresses.With(myAddress), + InstantiateDefaultPermission: types.AccessTypeNobody, + }, + }, "fresh from genesis": { startVersion: wasmApp.ModuleManager.GetVersionMap()[types.ModuleName], // latest setup: func(ctx sdk.Context) {}, @@ -50,12 +85,13 @@ func TestModuleMigrations(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - ctx, _ := wasmApp.BaseApp.NewContext(false, tmproto.Header{}).CacheContext() + ctx, _ := wasmApp.BaseApp.NewContext(false).CacheContext() spec.setup(ctx) - fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx) + fromVM, err := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx) + require.NoError(t, err) fromVM[types.ModuleName] = spec.startVersion - _, err := upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM) + _, err = upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM) require.NoError(t, err) // when @@ -82,7 +118,7 @@ func TestAccessConfigMigrations(t *testing.T) { return wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM) } - ctx, _ := wasmApp.BaseApp.NewContext(false, tmproto.Header{}).CacheContext() + ctx, _ := wasmApp.BaseApp.NewContext(false).CacheContext() // any address permission code1, err := storeCode(ctx, wasmApp, types.AccessTypeAnyOfAddresses.With(address)) @@ -96,7 +132,8 @@ func TestAccessConfigMigrations(t *testing.T) { code3, err := storeCode(ctx, wasmApp, types.AllowNobody) require.NoError(t, err) - fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx) + fromVM, err := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx) + require.NoError(t, err) fromVM[types.ModuleName] = wasmApp.ModuleManager.GetVersionMap()[types.ModuleName] _, err = upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM) require.NoError(t, err) diff --git a/x/wasm/keeper/msg_dispatcher.go b/x/wasm/keeper/msg_dispatcher.go index c9f5c9b864..19f6687a84 100644 --- a/x/wasm/keeper/msg_dispatcher.go +++ b/x/wasm/keeper/msg_dispatcher.go @@ -6,21 +6,30 @@ import ( "sort" "strings" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" ) +var ( + _ Messenger = &wasmtesting.MockMessageHandler{} + _ Messenger = MessageHandlerChain{} + _ Messenger = SDKMessageHandler{} +) + // Messenger is an extension point for custom wasmd message handling type Messenger interface { // DispatchMsg encodes the wasmVM message and dispatches it. - DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) + DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) } // replyer is a subset of keeper that can handle replies to submessages @@ -42,7 +51,7 @@ func NewMessageDispatcher(messenger Messenger, keeper replyer) *MessageDispatche // DispatchMessages sends all messages. func (d MessageDispatcher) DispatchMessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []wasmvmtypes.CosmosMsg) error { for _, msg := range msgs { - events, _, err := d.messenger.DispatchMsg(ctx, contractAddr, ibcPort, msg) + events, _, _, err := d.messenger.DispatchMsg(ctx, contractAddr, ibcPort, msg) if err != nil { return err } @@ -53,15 +62,15 @@ func (d MessageDispatcher) DispatchMessages(ctx sdk.Context, contractAddr sdk.Ac } // dispatchMsgWithGasLimit sends a message with gas limit applied -func (d MessageDispatcher) dispatchMsgWithGasLimit(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msg wasmvmtypes.CosmosMsg, gasLimit uint64) (events []sdk.Event, data [][]byte, err error) { - limitedMeter := sdk.NewGasMeter(gasLimit) +func (d MessageDispatcher) dispatchMsgWithGasLimit(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msg wasmvmtypes.CosmosMsg, gasLimit uint64) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + limitedMeter := storetypes.NewGasMeter(gasLimit) subCtx := ctx.WithGasMeter(limitedMeter) // catch out of gas panic and just charge the entire gas limit defer func() { if r := recover(); r != nil { // if it's not an OutOfGas error, raise it again - if _, ok := r.(sdk.ErrorOutOfGas); !ok { + if _, ok := r.(storetypes.ErrorOutOfGas); !ok { // log it to get the original stack trace somewhere (as panic(r) keeps message but stacktrace to here moduleLogger(ctx).Info("SubMsg rethrowing panic: %#v", r) panic(r) @@ -70,13 +79,13 @@ func (d MessageDispatcher) dispatchMsgWithGasLimit(ctx sdk.Context, contractAddr err = errorsmod.Wrap(sdkerrors.ErrOutOfGas, "SubMsg hit gas limit") } }() - events, data, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg) + events, data, msgResponses, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg) // make sure we charge the parent what was spent spent := subCtx.GasMeter().GasConsumed() ctx.GasMeter().ConsumeGas(spent, "From limited Sub-Message") - return events, data, err + return events, data, msgResponses, err } // DispatchSubmessages builds a sandbox to execute these messages and returns the execution result to the contract @@ -101,10 +110,11 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk var err error var events []sdk.Event var data [][]byte + var msgResponses [][]*codectypes.Any if limitGas { - events, data, err = d.dispatchMsgWithGasLimit(subCtx, contractAddr, ibcPort, msg.Msg, *msg.GasLimit) + events, data, msgResponses, err = d.dispatchMsgWithGasLimit(subCtx, contractAddr, ibcPort, msg.Msg, *msg.GasLimit) } else { - events, data, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg.Msg) + events, data, msgResponses, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg.Msg) } // if it succeeds, commit state changes from submessage, and pass on events to Event Manager @@ -142,15 +152,31 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk if len(data) > 0 { responseData = data[0] } + + // For msgResponses we flatten the nested list into a flat list. In the majority of cases + // we only expect one message to be emitted and one response per message. But it might be possible + // to create multiple SDK messages from one CosmWasm message or we have multiple responses for one message. + // See https://github.com/CosmWasm/cosmwasm/issues/2009 for more information. + var msgResponsesFlattened []wasmvmtypes.MsgResponse + for _, singleMsgResponses := range msgResponses { + for _, singleMsgResponse := range singleMsgResponses { + msgResponsesFlattened = append(msgResponsesFlattened, wasmvmtypes.MsgResponse{ + TypeURL: singleMsgResponse.TypeUrl, + Value: singleMsgResponse.Value, + }) + } + } + result = wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ - Events: sdkEventsToWasmVMEvents(filteredEvents), - Data: responseData, + Events: sdkEventsToWasmVMEvents(filteredEvents), + Data: responseData, + MsgResponses: msgResponsesFlattened, }, } } else { // Issue #759 - we don't return error string for worries of non-determinism - moduleLogger(ctx).Info("Redacting submessage error", "cause", err) + moduleLogger(ctx).Debug("Redacting submessage error", "cause", err) result = wasmvmtypes.SubMsgResult{ Err: redactError(err).Error(), } @@ -158,8 +184,9 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk // now handle the reply, we use the parent context, and abort on error reply := wasmvmtypes.Reply{ - ID: msg.ID, - Result: result, + ID: msg.ID, + Result: result, + Payload: msg.Payload, } // we can ignore any result returned as there is nothing to do with the data @@ -183,6 +210,13 @@ func redactError(err error) error { return err } + // If it is a DeterministicError, we can safely return it without redaction. + // We only check the top level error to avoid changes in the error chain becoming + // consensus-breaking. + if _, ok := err.(types.DeterministicError); ok { + return err + } + // FIXME: do we want to hardcode some constant string mappings here as well? // Or better document them? (SDK error string may change on a patch release to fix wording) // sdk/11 is out of gas diff --git a/x/wasm/keeper/msg_dispatcher_test.go b/x/wasm/keeper/msg_dispatcher_test.go index 54a316a2cc..73aa8d6b68 100644 --- a/x/wasm/keeper/msg_dispatcher_test.go +++ b/x/wasm/keeper/msg_dispatcher_test.go @@ -3,14 +3,18 @@ package keeper import ( "errors" "fmt" + "reflect" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" @@ -32,8 +36,8 @@ func TestDispatchSubmessages(t *testing.T) { msgs: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyError}}, replyer: noReplyCalled, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, [][]byte{[]byte("myData")}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{true}, @@ -42,8 +46,8 @@ func TestDispatchSubmessages(t *testing.T) { msgs: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplySuccess}}, replyer: noReplyCalled, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("test, ignore") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("test, ignore") }, }, expCommits: []bool{false}, @@ -59,8 +63,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, [][]byte{[]byte("myData")}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil }, }, expData: []byte("myReplyData"), @@ -76,8 +80,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("my error") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("my error") }, }, expData: []byte("myReplyData"), @@ -94,9 +98,9 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}} - return myEvents, [][]byte{[]byte("myData")}, nil + return myEvents, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil }, }, expData: []byte("myReplyData"), @@ -115,10 +119,10 @@ func TestDispatchSubmessages(t *testing.T) { }}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}} ctx.EventManager().EmitEvents(myEvents) - return nil, nil, nil + return nil, nil, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{true}, @@ -133,10 +137,10 @@ func TestDispatchSubmessages(t *testing.T) { }}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}} ctx.EventManager().EmitEvents(myEvents) - return nil, nil, errors.New("testing") + return nil, nil, [][]*codectypes.Any{}, errors.New("testing") }, }, expCommits: []bool{false}, @@ -152,8 +156,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{false}, @@ -170,9 +174,9 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - ctx.GasMeter().ConsumeGas(sdk.Gas(101), "testing") - return nil, [][]byte{[]byte("someData")}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + ctx.GasMeter().ConsumeGas(storetypes.Gas(101), "testing") + return nil, [][]byte{[]byte("someData")}, [][]*codectypes.Any{}, nil }, }, expData: []byte("myReplyData"), @@ -185,9 +189,9 @@ func TestDispatchSubmessages(t *testing.T) { }}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - ctx.GasMeter().ConsumeGas(sdk.Gas(1), "testing") - return nil, [][]byte{[]byte("someData")}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + ctx.GasMeter().ConsumeGas(storetypes.Gas(1), "testing") + return nil, [][]byte{[]byte("someData")}, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{true}, @@ -196,8 +200,8 @@ func TestDispatchSubmessages(t *testing.T) { msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, [][]byte{nil}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, [][]byte{nil}, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{true, true}, @@ -206,8 +210,8 @@ func TestDispatchSubmessages(t *testing.T) { msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, [][]byte{{}}, nil + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, [][]byte{{}}, [][]*codectypes.Any{}, nil }, }, expCommits: []bool{true, true}, @@ -216,8 +220,8 @@ func TestDispatchSubmessages(t *testing.T) { msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, replyer: &mockReplyer{}, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, [][]byte{{}}, errors.New("testing") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, [][]byte{{}}, [][]*codectypes.Any{}, errors.New("testing") }, }, expCommits: []bool{false, false}, @@ -231,8 +235,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("my error") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("my error") }, }, expData: []byte("myReplyData:2"), @@ -249,8 +253,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("my error") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("my error") }, }, expData: []byte("myReplyData:1"), @@ -267,8 +271,8 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("my error") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("my error") }, }, expData: []byte{}, @@ -284,12 +288,12 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { myEvents := []sdk.Event{ sdk.NewEvent("message"), sdk.NewEvent("execute", sdk.NewAttribute("foo", "bar")), } - return myEvents, [][]byte{[]byte("myData")}, nil + return myEvents, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil }, }, expData: nil, @@ -326,14 +330,14 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { events = []sdk.Event{ sdk.NewEvent("message", sdk.NewAttribute("_contract_address", contractAddr.String())), // we don't know what the contarctAddr will be so we can't use it in the final tests sdk.NewEvent("execute", sdk.NewAttribute("_contract_address", "placeholder-random-addr")), sdk.NewEvent("wasm", sdk.NewAttribute("random", "data")), } - return events, [][]byte{[]byte("subData")}, nil + return events, [][]byte{[]byte("subData")}, [][]*codectypes.Any{}, nil }, }, expData: []byte("subData"), @@ -344,9 +348,34 @@ func TestDispatchSubmessages(t *testing.T) { sdk.NewEvent("wasm-reply"), }, }, + "wasm reply gets payload": { + // put fake wasmmsg in here to show where it comes from + msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Payload: []byte("payloadData"), Msg: wasmvmtypes.CosmosMsg{Wasm: &wasmvmtypes.WasmMsg{}}}}, + replyer: &mockReplyer{ + replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { + if reply.Result.Err != "" { + return nil, errors.New(reply.Result.Err) + } + + // ensure we got the payload + if !reflect.DeepEqual(reply.Payload, []byte("payloadData")) { + return nil, fmt.Errorf("payload mismatch: %s != 'payloadData'", reply.Payload) + } + + // update data from what we got in + return reply.Result.Ok.Data, nil + }, + }, + msgHandler: &wasmtesting.MockMessageHandler{ + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, nil + }, + }, + expCommits: []bool{true}, + }, "non-wasm reply events get filtered": { // show events from a stargate message gets filtered out - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Msg: wasmvmtypes.CosmosMsg{Stargate: &wasmvmtypes.StargateMsg{}}}}, + msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Msg: wasmvmtypes.CosmosMsg{Any: &wasmvmtypes.AnyMsg{}}}}, replyer: &mockReplyer{ replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { if reply.Result.Err != "" { @@ -368,7 +397,7 @@ func TestDispatchSubmessages(t *testing.T) { }, }, msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { events = []sdk.Event{ // this is filtered out sdk.NewEvent("message", sdk.NewAttribute("stargate", "something-something")), @@ -376,7 +405,7 @@ func TestDispatchSubmessages(t *testing.T) { sdk.NewEvent("non-determinstic"), sdk.NewEvent("message", sdk.NewAttribute("module", "ibc_channel")), } - return events, [][]byte{[]byte("subData")}, nil + return events, [][]byte{[]byte("subData")}, [][]*codectypes.Any{}, nil }, }, expData: []byte("subData"), @@ -394,8 +423,8 @@ func TestDispatchSubmessages(t *testing.T) { var mockStore wasmtesting.MockCommitMultiStore em := sdk.NewEventManager() ctx := sdk.Context{}.WithMultiStore(&mockStore). - WithGasMeter(sdk.NewGasMeter(100)). - WithEventManager(em).WithLogger(log.TestingLogger()) + WithGasMeter(storetypes.NewGasMeter(100)). + WithEventManager(em).WithLogger(log.NewTestLogger(t)) d := NewMessageDispatcher(spec.msgHandler, spec.replyer) // run the test diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index 06963f9083..691ffa445c 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -23,11 +23,10 @@ func NewMsgServerImpl(k *Keeper) types.MsgServer { } // StoreCode stores a new wasm code on chain -func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) { +func (m msgServer) StoreCode(ctx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -47,11 +46,10 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t } // InstantiateContract instantiate a new contract with classic sequence based address generation -func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInstantiateContract) (*types.MsgInstantiateContractResponse, error) { +func (m msgServer) InstantiateContract(ctx context.Context, msg *types.MsgInstantiateContract) (*types.MsgInstantiateContractResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -78,11 +76,10 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst } // InstantiateContract2 instantiate a new contract with predicatable address generated -func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgInstantiateContract2) (*types.MsgInstantiateContract2Response, error) { +func (m msgServer) InstantiateContract2(ctx context.Context, msg *types.MsgInstantiateContract2) (*types.MsgInstantiateContract2Response, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -110,12 +107,11 @@ func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgIns }, nil } -func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { +func (m msgServer) ExecuteContract(ctx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -135,12 +131,11 @@ func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteC }, nil } -func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateContract) (*types.MsgMigrateContractResponse, error) { +func (m msgServer) MigrateContract(ctx context.Context, msg *types.MsgMigrateContract) (*types.MsgMigrateContractResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -162,12 +157,11 @@ func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateC }, nil } -func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin) (*types.MsgUpdateAdminResponse, error) { +func (m msgServer) UpdateAdmin(ctx context.Context, msg *types.MsgUpdateAdmin) (*types.MsgUpdateAdminResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -190,12 +184,11 @@ func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin) return &types.MsgUpdateAdminResponse{}, nil } -func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) (*types.MsgClearAdminResponse, error) { +func (m msgServer) ClearAdmin(ctx context.Context, msg *types.MsgClearAdmin) (*types.MsgClearAdminResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -214,12 +207,11 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) ( return &types.MsgClearAdminResponse{}, nil } -func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.MsgUpdateInstantiateConfig) (*types.MsgUpdateInstantiateConfigResponse, error) { +func (m msgServer) UpdateInstantiateConfig(ctx context.Context, msg *types.MsgUpdateInstantiateConfig) (*types.MsgUpdateInstantiateConfigResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") @@ -234,7 +226,7 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg } // UpdateParams updates the module parameters -func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (m msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if err := req.ValidateBasic(); err != nil { return nil, err } @@ -243,7 +235,6 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := m.keeper.SetParams(ctx, req.Params); err != nil { return nil, err } @@ -252,7 +243,7 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam } // PinCodes pins a set of code ids in the wasmvm cache. -func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*types.MsgPinCodesResponse, error) { +func (m msgServer) PinCodes(ctx context.Context, req *types.MsgPinCodes) (*types.MsgPinCodesResponse, error) { if err := req.ValidateBasic(); err != nil { return nil, err } @@ -262,7 +253,6 @@ func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*typ return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) for _, codeID := range req.CodeIDs { if err := m.keeper.pinCode(ctx, codeID); err != nil { return nil, err @@ -273,7 +263,7 @@ func (m msgServer) PinCodes(goCtx context.Context, req *types.MsgPinCodes) (*typ } // UnpinCodes unpins a set of code ids in the wasmvm cache. -func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) (*types.MsgUnpinCodesResponse, error) { +func (m msgServer) UnpinCodes(ctx context.Context, req *types.MsgUnpinCodes) (*types.MsgUnpinCodesResponse, error) { if err := req.ValidateBasic(); err != nil { return nil, err } @@ -283,7 +273,6 @@ func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) ( return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) for _, codeID := range req.CodeIDs { if err := m.keeper.unpinCode(ctx, codeID); err != nil { return nil, err @@ -294,7 +283,7 @@ func (m msgServer) UnpinCodes(goCtx context.Context, req *types.MsgUnpinCodes) ( } // SudoContract calls sudo on a contract. -func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContract) (*types.MsgSudoContractResponse, error) { +func (m msgServer) SudoContract(ctx context.Context, req *types.MsgSudoContract) (*types.MsgSudoContractResponse, error) { if err := req.ValidateBasic(); err != nil { return nil, err } @@ -308,7 +297,6 @@ func (m msgServer) SudoContract(goCtx context.Context, req *types.MsgSudoContrac return nil, errorsmod.Wrap(err, "contract") } - ctx := sdk.UnwrapSDKContext(goCtx) data, err := m.keeper.Sudo(ctx, contractAddr, req.Msg) if err != nil { return nil, err @@ -429,7 +417,7 @@ func contains[T comparable](src []T, o T) bool { return false } -func (m msgServer) selectAuthorizationPolicy(ctx sdk.Context, actor string) types.AuthorizationPolicy { +func (m msgServer) selectAuthorizationPolicy(ctx context.Context, actor string) types.AuthorizationPolicy { if actor == m.keeper.GetAuthority() { return newGovAuthorizationPolicy(m.keeper.propagateGovAuthorization) } @@ -475,12 +463,11 @@ func (m msgServer) StoreAndMigrateContract(goCtx context.Context, req *types.Msg }, nil } -func (m msgServer) UpdateContractLabel(goCtx context.Context, msg *types.MsgUpdateContractLabel) (*types.MsgUpdateContractLabelResponse, error) { +func (m msgServer) UpdateContractLabel(ctx context.Context, msg *types.MsgUpdateContractLabel) (*types.MsgUpdateContractLabelResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, errorsmod.Wrap(err, "sender") diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go index 27b73400fb..fad2b112b6 100644 --- a/x/wasm/keeper/msg_server_integration_test.go +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -20,7 +20,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) -//go:embed testdata/reflect.wasm +//go:embed testdata/reflect_1_5.wasm var wasmContract []byte //go:embed testdata/hackatom.wasm @@ -28,7 +28,7 @@ var hackatomContract []byte func TestStoreCode(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) _, _, sender := testdata.KeyTestPubAddr() msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { m.WASMByteCode = wasmContract @@ -57,7 +57,7 @@ func TestStoreCode(t *testing.T) { func TestUpdateParams(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -147,7 +147,7 @@ func TestUpdateParams(t *testing.T) { func TestAddCodeUploadParamsAddresses(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -243,7 +243,7 @@ func TestAddCodeUploadParamsAddresses(t *testing.T) { func TestRemoveCodeUploadParamsAddresses(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -339,7 +339,7 @@ func TestRemoveCodeUploadParamsAddresses(t *testing.T) { func TestPinCodes(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -396,7 +396,7 @@ func TestPinCodes(t *testing.T) { func TestUnpinCodes(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + ctx := wasmApp.BaseApp.NewContext(false) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -461,7 +461,7 @@ func TestUnpinCodes(t *testing.T) { func TestSudoContract(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -552,7 +552,7 @@ func TestSudoContract(t *testing.T) { func TestStoreAndInstantiateContract(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -612,7 +612,7 @@ func TestStoreAndInstantiateContract(t *testing.T) { func TestUpdateAdmin(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -677,7 +677,7 @@ func TestUpdateAdmin(t *testing.T) { func TestClearAdmin(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -739,7 +739,7 @@ func TestClearAdmin(t *testing.T) { func TestMigrateContract(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -826,7 +826,7 @@ func TestMigrateContract(t *testing.T) { func TestInstantiateContract(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -898,7 +898,7 @@ func TestInstantiateContract(t *testing.T) { func TestInstantiateContract2(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -977,7 +977,7 @@ func TestInstantiateContract2(t *testing.T) { func TestUpdateInstantiateConfig(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( creator sdk.AccAddress = make([]byte, types.ContractAddrLen) @@ -1051,7 +1051,7 @@ func TestUpdateInstantiateConfig(t *testing.T) { func TestStoreAndMigrateContract(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) checksum, err := wasmvm.CreateChecksum(hackatomContract) require.NoError(t, err) @@ -1147,7 +1147,7 @@ func TestStoreAndMigrateContract(t *testing.T) { func TestUpdateContractLabel(t *testing.T) { wasmApp := app.Setup(t) - ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()}) + ctx := wasmApp.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()}) var ( myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen) diff --git a/x/wasm/keeper/msg_server_test.go b/x/wasm/keeper/msg_server_test.go index 61d05f65b1..ff34162ccf 100644 --- a/x/wasm/keeper/msg_server_test.go +++ b/x/wasm/keeper/msg_server_test.go @@ -3,11 +3,14 @@ package keeper import ( "testing" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/assert" - "github.com/cosmos/cosmos-sdk/store" + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -22,7 +25,9 @@ func TestSelectAuthorizationPolicy(t *testing.T) { }, authority: myGovAuthority.String(), }} - ctx := sdk.NewContext(store.NewCommitMultiStore(nil), tmproto.Header{}, false, log.NewNopLogger()) + + ms := store.NewCommitMultiStore(dbm.NewMemDB(), log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) + ctx := sdk.NewContext(ms, tmproto.Header{}, false, log.NewNopLogger()) specs := map[string]struct { ctx sdk.Context diff --git a/x/wasm/keeper/options.go b/x/wasm/keeper/options.go index 7ccf7d9e52..234197be8d 100644 --- a/x/wasm/keeper/options.go +++ b/x/wasm/keeper/options.go @@ -6,7 +6,7 @@ import ( "github.com/prometheus/client_golang/prometheus" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -162,7 +162,7 @@ func WithMaxQueryStackSize(m uint32) Option { // when they exist for an address on contract instantiation. // // Values should be references and contain the `*authtypes.BaseAccount` as default bank account type. -func WithAcceptedAccountTypesOnContractInstantiation(accts ...authtypes.AccountI) Option { +func WithAcceptedAccountTypesOnContractInstantiation(accts ...sdk.AccountI) Option { m := asTypeMap(accts) return optsFn(func(k *Keeper) { k.acceptedAccountTypes = m @@ -183,7 +183,7 @@ func WitGovSubMsgAuthZPropagated(entries ...types.AuthorizationPolicyAction) Opt }) } -func asTypeMap(accts []authtypes.AccountI) map[reflect.Type]struct{} { +func asTypeMap(accts []sdk.AccountI) map[reflect.Type]struct{} { m := make(map[reflect.Type]struct{}, len(accts)) for _, a := range accts { if a == nil { diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go index b26e1af7c2..1ac311c14c 100644 --- a/x/wasm/keeper/options_test.go +++ b/x/wasm/keeper/options_test.go @@ -4,11 +4,14 @@ import ( "reflect" "testing" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/runtime" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -20,6 +23,9 @@ import ( ) func TestConstructorOptions(t *testing.T) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + codec := MakeEncodingConfig(t).Codec + specs := map[string]struct { srcOpt Option verify func(*testing.T, Keeper) @@ -28,7 +34,6 @@ func TestConstructorOptions(t *testing.T) { "wasm engine": { srcOpt: WithWasmEngine(&wasmtesting.MockWasmEngine{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockWasmEngine{}, k.wasmVM) }, }, @@ -47,7 +52,6 @@ func TestConstructorOptions(t *testing.T) { return &wasmtesting.MockWasmEngine{} }), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockWasmEngine{}, k.wasmVM) }, isPostOpt: true, @@ -55,14 +59,12 @@ func TestConstructorOptions(t *testing.T) { "message handler": { srcOpt: WithMessageHandler(&wasmtesting.MockMessageHandler{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockMessageHandler{}, k.messenger) }, }, "query plugins": { srcOpt: WithQueryHandler(&wasmtesting.MockQueryHandler{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockQueryHandler{}, k.wasmVMQueryHandler) }, }, @@ -72,7 +74,6 @@ func TestConstructorOptions(t *testing.T) { return &wasmtesting.MockMessageHandler{} }), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockMessageHandler{}, k.messenger) }, isPostOpt: true, @@ -83,7 +84,6 @@ func TestConstructorOptions(t *testing.T) { return &wasmtesting.MockQueryHandler{} }), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockQueryHandler{}, k.wasmVMQueryHandler) }, isPostOpt: true, @@ -91,21 +91,18 @@ func TestConstructorOptions(t *testing.T) { "coin transferrer": { srcOpt: WithCoinTransferrer(&wasmtesting.MockCoinTransferrer{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockCoinTransferrer{}, k.bank) }, }, "costs": { srcOpt: WithGasRegister(&wasmtesting.MockGasRegister{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, &wasmtesting.MockGasRegister{}, k.gasRegister) }, }, "api costs": { srcOpt: WithAPICosts(1, 2), verify: func(t *testing.T, k Keeper) { - t.Helper() t.Cleanup(setAPIDefaults) assert.Equal(t, uint64(1), costHumanize) assert.Equal(t, uint64(2), costCanonical) @@ -114,14 +111,12 @@ func TestConstructorOptions(t *testing.T) { "max recursion query limit": { srcOpt: WithMaxQueryStackSize(1), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.IsType(t, uint32(1), k.maxQueryStackSize) }, }, "accepted account types": { srcOpt: WithAcceptedAccountTypesOnContractInstantiation(&authtypes.BaseAccount{}, &vestingtypes.ContinuousVestingAccount{}), verify: func(t *testing.T, k Keeper) { - t.Helper() exp := map[reflect.Type]struct{}{ reflect.TypeOf(&authtypes.BaseAccount{}): {}, reflect.TypeOf(&vestingtypes.ContinuousVestingAccount{}): {}, @@ -132,14 +127,12 @@ func TestConstructorOptions(t *testing.T) { "account pruner": { srcOpt: WithAccountPruner(VestingCoinBurner{}), verify: func(t *testing.T, k Keeper) { - t.Helper() assert.Equal(t, VestingCoinBurner{}, k.accountPruner) }, }, "gov propagation": { srcOpt: WitGovSubMsgAuthZPropagated(types.AuthZActionInstantiate, types.AuthZActionMigrateContract), verify: func(t *testing.T, k Keeper) { - t.Helper() exp := map[types.AuthorizationPolicyAction]struct{}{ types.AuthZActionInstantiate: {}, types.AuthZActionMigrateContract: {}, @@ -150,10 +143,11 @@ func TestConstructorOptions(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { + tempDir := t.TempDir() opt := spec.srcOpt _, gotPostOptMarker := opt.(postOptsFn) require.Equal(t, spec.isPostOpt, gotPostOptMarker) - k := NewKeeper(nil, nil, authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, "", opt) + k := NewKeeper(codec, runtime.NewKVStoreService(storeKey), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, nil, tempDir, types.DefaultWasmConfig(), AvailableCapabilities, "", spec.srcOpt) spec.verify(t, k) }) } diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go index 2d2d0faf14..c228424180 100644 --- a/x/wasm/keeper/proposal_integration_test.go +++ b/x/wasm/keeper/proposal_integration_test.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -23,7 +23,10 @@ import ( ) func TestLoadStoredGovV1Beta1LegacyTypes(t *testing.T) { - pCtx, keepers := CreateTestInput(t, false, ReflectFeatures+",iterator") + capabilities := make([]string, len(ReflectCapabilities)+1) + copy(capabilities, ReflectCapabilities) + capabilities = append(capabilities, "iterator") + pCtx, keepers := CreateTestInput(t, false, capabilities) k := keepers.WasmKeeper keepers.GovKeeper.SetLegacyRouter(v1beta1.NewRouter(). AddRoute(types.ModuleName, NewLegacyWasmProposalHandler(k, types.EnableAllProposals)), @@ -181,9 +184,9 @@ func TestLoadStoredGovV1Beta1LegacyTypes(t *testing.T) { ctx, _ := pCtx.CacheContext() propID := mustSubmitAndExecuteLegacyProposal(t, ctx, spec.legacyContent, myAddress.String(), keepers) // when - proposal, exists := keepers.GovKeeper.GetProposal(ctx, propID) + proposal, err := keepers.GovKeeper.Proposals.Get(ctx, propID) // then - require.True(t, exists) + require.NoError(t, err) require.Len(t, proposal.Messages, 1) assert.NotNil(t, proposal.Messages[0].GetCachedValue()) }) @@ -216,6 +219,7 @@ func submitLegacyProposal(t *testing.T, ctx sdk.Context, content v1beta1.Content "", content.GetTitle(), content.GetDescription(), + false, ) require.NoError(t, err) @@ -223,11 +227,3 @@ func submitLegacyProposal(t *testing.T, ctx sdk.Context, content v1beta1.Content rsp, err := msgServer.SubmitProposal(ctx, proposal) return contentMsg, rsp, err } - -// for test code only -func must[t any](s t, err error) t { - if err != nil { - panic(err) - } - return s -} diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 3cc80d2d6e..f6eb47fcb2 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -3,16 +3,20 @@ package keeper import ( "context" "encoding/binary" + "encoding/hex" + "fmt" "runtime/debug" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + corestoretypes "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" @@ -24,14 +28,14 @@ var _ types.QueryServer = &GrpcQuerier{} type GrpcQuerier struct { cdc codec.Codec - storeKey storetypes.StoreKey + storeService corestoretypes.KVStoreService keeper types.ViewKeeper - queryGasLimit sdk.Gas + queryGasLimit storetypes.Gas } // NewGrpcQuerier constructor -func NewGrpcQuerier(cdc codec.Codec, storeKey storetypes.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *GrpcQuerier { - return &GrpcQuerier{cdc: cdc, storeKey: storeKey, keeper: keeper, queryGasLimit: queryGasLimit} +func NewGrpcQuerier(cdc codec.Codec, storeService corestoretypes.KVStoreService, keeper types.ViewKeeper, queryGasLimit storetypes.Gas) *GrpcQuerier { + return &GrpcQuerier{cdc: cdc, storeService: storeService, keeper: keeper, queryGasLimit: queryGasLimit} } func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error) { @@ -68,7 +72,8 @@ func (q GrpcQuerier) ContractHistory(c context.Context, req *types.QueryContract ctx := sdk.UnwrapSDKContext(c) r := make([]types.ContractCodeHistoryEntry, 0) - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractCodeHistoryElementPrefix(contractAddr)) + + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.GetContractCodeHistoryElementPrefix(contractAddr)) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, value []byte, accumulate bool) (bool, error) { if accumulate { var e types.ContractCodeHistoryEntry @@ -103,7 +108,8 @@ func (q GrpcQuerier) ContractsByCode(c context.Context, req *types.QueryContract ctx := sdk.UnwrapSDKContext(c) r := make([]string, 0) - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractByCodeIDSecondaryIndexPrefix(req.CodeId)) + + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.GetContractByCodeIDSecondaryIndexPrefix(req.CodeId)) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, value []byte, accumulate bool) (bool, error) { if accumulate { var contractAddr sdk.AccAddress = key[types.AbsoluteTxPositionLen:] @@ -141,7 +147,7 @@ func (q GrpcQuerier) AllContractState(c context.Context, req *types.QueryAllCont } r := make([]types.Model, 0) - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractStorePrefix(contractAddr)) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.GetContractStorePrefix(contractAddr)) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, value []byte, accumulate bool) (bool, error) { if accumulate { r = append(r, types.Model{ @@ -190,12 +196,12 @@ func (q GrpcQuerier) SmartContractState(c context.Context, req *types.QuerySmart if err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(c).WithGasMeter(sdk.NewGasMeter(q.queryGasLimit)) + ctx := sdk.UnwrapSDKContext(c).WithGasMeter(storetypes.NewGasMeter(q.queryGasLimit)) // recover from out-of-gas panic defer func() { if r := recover(); r != nil { switch rType := r.(type) { - case sdk.ErrorOutOfGas: + case storetypes.ErrorOutOfGas: err = errorsmod.Wrapf(sdkerrors.ErrOutOfGas, "out of gas in location: %v; gasWanted: %d, gasUsed: %d", rType.Descriptor, ctx.GasMeter().Limit(), ctx.GasMeter().GasConsumed(), @@ -254,7 +260,7 @@ func (q GrpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*ty ctx := sdk.UnwrapSDKContext(c) r := make([]types.CodeInfoResponse, 0) - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.CodeKeyPrefix) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.CodeKeyPrefix) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, value []byte, accumulate bool) (bool, error) { if accumulate { var c types.CodeInfo @@ -323,7 +329,8 @@ func (q GrpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesR ctx := sdk.UnwrapSDKContext(c) r := make([]uint64, 0) - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.PinnedCodeIndexPrefix) + + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.PinnedCodeIndexPrefix) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, _ []byte, accumulate bool) (bool, error) { if accumulate { r = append(r, sdk.BigEndianToUint64(key)) @@ -362,7 +369,7 @@ func (q GrpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContr if err != nil { return nil, err } - prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractsByCreatorPrefix(creatorAddress)) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), types.GetContractsByCreatorPrefix(creatorAddress)) pageRes, err := query.FilteredPaginate(prefixStore, paginationParams, func(key, _ []byte, accumulate bool) (bool, error) { if accumulate { accAddres := sdk.AccAddress(key[types.AbsoluteTxPositionLen:]) @@ -401,3 +408,36 @@ func ensurePaginationParams(req *query.PageRequest) (*query.PageRequest, error) } return req, nil } + +func (q GrpcQuerier) BuildAddress(c context.Context, req *types.QueryBuildAddressRequest) (*types.QueryBuildAddressResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + codeHash, err := hex.DecodeString(req.CodeHash) + if err != nil { + return nil, fmt.Errorf("invalid code hash: %w", err) + } + creator, err := sdk.AccAddressFromBech32(req.CreatorAddress) + if err != nil { + return nil, fmt.Errorf("invalid creator address: %w", err) + } + salt, err := hex.DecodeString(req.Salt) + if err != nil { + return nil, fmt.Errorf("invalid salt: %w", err) + } + if len(salt) == 0 { + return nil, status.Error(codes.InvalidArgument, "empty salt") + } + if req.InitArgs == nil { + return &types.QueryBuildAddressResponse{ + Address: BuildContractAddressPredictable(codeHash, creator, salt, []byte{}).String(), + }, nil + } + initMsg := types.RawContractMessage(req.InitArgs) + if err := initMsg.ValidateBasic(); err != nil { + return nil, err + } + return &types.QueryBuildAddressResponse{ + Address: BuildContractAddressPredictable(codeHash, creator, salt, initMsg).String(), + }, nil +} diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 18b38fa5d0..afd4ad3cc5 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -9,15 +9,16 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - "github.com/cometbft/cometbft/libs/log" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkErrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -106,7 +107,7 @@ func TestQueryAllContractState(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, err := q.AllContractState(sdk.WrapSDKContext(ctx), spec.srcQuery) + got, err := q.AllContractState(ctx, spec.srcQuery) if spec.expErr != nil { require.Equal(t, spec.expErr.Error(), err.Error()) @@ -158,7 +159,7 @@ func TestQuerySmartContractState(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, err := q.SmartContractState(sdk.WrapSDKContext(ctx), spec.srcQuery) + got, err := q.SmartContractState(ctx, spec.srcQuery) require.True(t, errors.Is(err, spec.expErr), "but got %+v", err) if spec.expErr != nil { return @@ -171,12 +172,12 @@ func TestQuerySmartContractState(t *testing.T) { func TestQuerySmartContractPanics(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) contractAddr := BuildContractAddressClassic(1, 1) - keepers.WasmKeeper.storeCodeInfo(ctx, 1, types.CodeInfo{}) - keepers.WasmKeeper.storeContractInfo(ctx, contractAddr, &types.ContractInfo{ + keepers.WasmKeeper.mustStoreCodeInfo(ctx, 1, types.CodeInfo{}) + keepers.WasmKeeper.mustStoreContractInfo(ctx, contractAddr, &types.ContractInfo{ CodeID: 1, Created: types.NewAbsoluteTxPosition(ctx), }) - ctx = ctx.WithGasMeter(sdk.NewGasMeter(types.DefaultInstanceCost)).WithLogger(log.TestingLogger()) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(types.DefaultInstanceCost)).WithLogger(log.NewTestLogger(t)) specs := map[string]struct { doInContract func() @@ -197,13 +198,13 @@ func TestQuerySmartContractPanics(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - keepers.WasmKeeper.wasmVM = &wasmtesting.MockWasmEngine{QueryFn: func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + keepers.WasmKeeper.wasmVM = &wasmtesting.MockWasmEngine{QueryFn: func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.QueryResult, uint64, error) { spec.doInContract() - return nil, 0, nil + return &wasmvmtypes.QueryResult{}, 0, nil }} // when q := Querier(keepers.WasmKeeper) - got, err := q.SmartContractState(sdk.WrapSDKContext(ctx), &types.QuerySmartContractStateRequest{ + got, err := q.SmartContractState(ctx, &types.QuerySmartContractStateRequest{ Address: contractAddr.String(), QueryData: types.RawContractMessage("{}"), }) @@ -260,7 +261,7 @@ func TestQueryRawContractState(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, err := q.RawContractState(sdk.WrapSDKContext(ctx), spec.srcQuery) + got, err := q.RawContractState(ctx, spec.srcQuery) if spec.expErr != nil { assert.Equal(t, spec.expErr.Error(), err.Error()) return @@ -297,7 +298,7 @@ func TestQueryContractsByCode(t *testing.T) { var h int64 = 10 setBlock := func(ctx sdk.Context, height int64) sdk.Context { ctx = ctx.WithBlockHeight(height) - meter := sdk.NewGasMeter(1000000) + meter := storetypes.NewGasMeter(1000000) ctx = ctx.WithGasMeter(meter) ctx = ctx.WithBlockGasMeter(meter) return ctx @@ -380,7 +381,7 @@ func TestQueryContractsByCode(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, err := q.ContractsByCode(sdk.WrapSDKContext(ctx), spec.req) + got, err := q.ContractsByCode(ctx, spec.req) if spec.expErr != nil { assert.NotNil(t, err) @@ -519,11 +520,12 @@ func TestQueryContractHistory(t *testing.T) { xCtx, _ := ctx.CacheContext() cAddr, _ := sdk.AccAddressFromBech32(myContractBech32Addr) - keeper.appendToContractHistory(xCtx, cAddr, spec.srcHistory...) + require.NoError(t, keeper.appendToContractHistory(xCtx, cAddr, spec.srcHistory...)) // when q := Querier(keeper) - got, gotErr := q.ContractHistory(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec + got, gotErr := q.ContractHistory(xCtx, &spec.req) //nolint:gosec + // then if spec.expErr != nil { require.Error(t, gotErr) @@ -599,7 +601,7 @@ func TestQueryCodeList(t *testing.T) { } // when q := Querier(keeper) - got, gotErr := q.Codes(sdk.WrapSDKContext(xCtx), &spec.req) //nolint:gosec + got, gotErr := q.Codes(xCtx, &spec.req) //nolint:gosec // then if spec.expErr != nil { @@ -631,7 +633,7 @@ func TestQueryContractInfo(t *testing.T) { govv1beta1.RegisterInterfaces(keepers.EncodingConfig.InterfaceRegistry) k := keepers.WasmKeeper - querier := NewGrpcQuerier(k.cdc, k.storeKey, k, k.queryGasLimit) + querier := NewGrpcQuerier(k.cdc, k.storeService, k, k.queryGasLimit) myExtension := func(info *types.ContractInfo) { // abuse gov proposal as a random protobuf extension with an Any type myExt, err := govv1beta1.NewProposal(&govv1beta1.TextProposal{Title: "foo", Description: "bar"}, 1, anyDate, anyDate) @@ -671,9 +673,9 @@ func TestQueryContractInfo(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { xCtx, _ := ctx.CacheContext() - k.storeContractInfo(xCtx, contractAddr, &spec.stored) //nolint:gosec + k.mustStoreContractInfo(xCtx, contractAddr, &spec.stored) //nolint:gosec // when - gotRsp, gotErr := querier.ContractInfo(sdk.WrapSDKContext(xCtx), spec.src) + gotRsp, gotErr := querier.ContractInfo(xCtx, spec.src) if spec.expErr { require.Error(t, gotErr) return @@ -730,7 +732,7 @@ func TestQueryPinnedCodes(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, gotErr := q.PinnedCodes(sdk.WrapSDKContext(ctx), spec.srcQuery) + got, gotErr := q.PinnedCodes(ctx, spec.srcQuery) if spec.expErr != nil { require.Error(t, gotErr) assert.ErrorIs(t, gotErr, spec.expErr) @@ -749,7 +751,7 @@ func TestQueryParams(t *testing.T) { q := Querier(keeper) - paramsResponse, err := q.Params(sdk.WrapSDKContext(ctx), &types.QueryParamsRequest{}) + paramsResponse, err := q.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.NotNil(t, paramsResponse) @@ -764,7 +766,7 @@ func TestQueryParams(t *testing.T) { }) require.NoError(t, err) - paramsResponse, err = q.Params(sdk.WrapSDKContext(ctx), &types.QueryParamsRequest{}) + paramsResponse, err = q.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.NotNil(t, paramsResponse) @@ -808,7 +810,7 @@ func TestQueryCodeInfo(t *testing.T) { ) q := Querier(keeper) - got, err := q.Code(sdk.WrapSDKContext(ctx), &types.QueryCodeRequest{ + got, err := q.Code(ctx, &types.QueryCodeRequest{ CodeId: spec.codeID, }) require.NoError(t, err) @@ -881,7 +883,7 @@ func TestQueryCodeInfoList(t *testing.T) { }) } q := Querier(keeper) - got, err := q.Codes(sdk.WrapSDKContext(ctx), &types.QueryCodesRequest{ + got, err := q.Codes(ctx, &types.QueryCodesRequest{ Pagination: &query.PageRequest{ Limit: 3, }, @@ -917,7 +919,7 @@ func TestQueryContractsByCreatorList(t *testing.T) { var h int64 = 10 setBlock := func(ctx sdk.Context, height int64) sdk.Context { ctx = ctx.WithBlockHeight(height) - meter := sdk.NewGasMeter(1000000) + meter := storetypes.NewGasMeter(1000000) ctx = ctx.WithGasMeter(meter) ctx = ctx.WithBlockGasMeter(meter) return ctx @@ -981,7 +983,7 @@ func TestQueryContractsByCreatorList(t *testing.T) { q := Querier(keepers.WasmKeeper) for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - got, gotErr := q.ContractsByCreator(sdk.WrapSDKContext(ctx), spec.srcQuery) + got, gotErr := q.ContractsByCreator(ctx, spec.srcQuery) if spec.expErr != nil { require.Error(t, gotErr) assert.ErrorContains(t, gotErr, spec.expErr.Error()) @@ -1045,3 +1047,103 @@ func TestEnsurePaginationParams(t *testing.T) { }) } } + +func TestQueryBuildAddress(t *testing.T) { + specs := map[string]struct { + src *types.QueryBuildAddressRequest + exp *types.QueryBuildAddressResponse + expErr error + }{ + "empty request": { + src: nil, + expErr: status.Error(codes.InvalidArgument, "empty request"), + }, + "invalid code hash": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "invalid", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "61", + InitArgs: nil, + }, + expErr: fmt.Errorf("invalid code hash"), + }, + "invalid creator address": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "invalid", + Salt: "61", + InitArgs: nil, + }, + expErr: fmt.Errorf("invalid creator address"), + }, + "invalid salt": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "invalid", + InitArgs: nil, + }, + expErr: fmt.Errorf("invalid salt"), + }, + "empty salt": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "", + InitArgs: nil, + }, + expErr: status.Error(codes.InvalidArgument, "empty salt"), + }, + "invalid init args": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "61", + InitArgs: []byte(`invalid`), + }, + expErr: fmt.Errorf("invalid"), + }, + "valid - without init args": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "61", + InitArgs: nil, + }, + exp: &types.QueryBuildAddressResponse{ + Address: "cosmos165fz7lnnt6e08knjqsz6fnz9drs7gewezyq3pl5uspc3zgt5lldq4ge3pl", + }, + expErr: nil, + }, + "valid - with init args": { + src: &types.QueryBuildAddressRequest{ + CodeHash: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + CreatorAddress: "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + Salt: "61", + InitArgs: []byte(`{"verifier":"cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz"}`), + }, + exp: &types.QueryBuildAddressResponse{ + Address: "cosmos150kq3ggdvc9lftcv6ns75t3v6lcpxdmvuwtqr6e9fc029z6h4maqepgss6", + }, + expErr: nil, + }, + } + + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + keeper := keepers.WasmKeeper + + q := Querier(keeper) + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + got, gotErr := q.BuildAddress(ctx, spec.src) + if spec.expErr != nil { + require.Error(t, gotErr) + assert.ErrorContains(t, gotErr, spec.expErr.Error()) + return + } + require.NoError(t, gotErr) + require.NotNil(t, got) + assert.Equal(t, spec.exp.Address, got.Address) + }) + } +} diff --git a/x/wasm/keeper/query_plugin_integration_test.go b/x/wasm/keeper/query_plugin_integration_test.go index 83dea003b0..f9d126e20e 100644 --- a/x/wasm/keeper/query_plugin_integration_test.go +++ b/x/wasm/keeper/query_plugin_integration_test.go @@ -3,17 +3,19 @@ package keeper import ( "bytes" "encoding/json" + "errors" "fmt" "strings" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cosmos/gogoproto/proto" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,7 +28,7 @@ import ( func TestMaskReflectCustomQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -74,7 +76,7 @@ func TestMaskReflectCustomQuery(t *testing.T) { func TestReflectStargateQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper funds := sdk.NewCoins(sdk.NewInt64Coin("denom", 320000)) @@ -115,9 +117,61 @@ func TestReflectStargateQuery(t *testing.T) { assert.Equal(t, simpleBalance.Amount[0].Denom, expectedBalance[0].Denom) } +func TestReflectGrpcQuery(t *testing.T) { + queryPlugins := (*reflectPlugins()).Merge(&QueryPlugins{ + Grpc: func(ctx sdk.Context, request *wasmvmtypes.GrpcQuery) (proto.Message, error) { + if request.Path == "cosmos.bank.v1beta1.Query/AllBalances" { + return &banktypes.QueryAllBalancesResponse{ + Balances: sdk.NewCoins(), + }, nil + } + return nil, errors.New("unsupported request") + }, + }) + cdc := MakeEncodingConfig(t).Codec + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(&queryPlugins)) + keeper := keepers.WasmKeeper + + creator := RandomAccountAddress(t) + + // upload code + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + require.NoError(t, err) + require.Equal(t, uint64(1), codeID) + + // creator instantiates a contract + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, []byte("{}"), "reflect contract 1", sdk.NewCoins()) + require.NoError(t, err) + require.NotEmpty(t, contractAddr) + + // now grpc query for the bank balance + cosmosBankQuery := banktypes.NewQueryAllBalancesRequest(creator, nil, false) + cosmosBankQueryBz, err := proto.Marshal(cosmosBankQuery) + require.NoError(t, err) + reflectQuery := wasmvmtypes.QueryRequest{ + Grpc: &wasmvmtypes.GrpcQuery{ + Path: "cosmos.bank.v1beta1.Query/AllBalances", + Data: cosmosBankQueryBz, + }, + } + reflectQueryBz, err := json.Marshal(testdata.ReflectQueryMsg{ + Chain: &testdata.ChainQuery{Request: &reflectQuery}, + }) + require.NoError(t, err) + // query the reflect contract + reflectRespBz, err := keeper.QuerySmart(ctx, contractAddr, reflectQueryBz) + require.NoError(t, err) + var reflectResp testdata.ChainResponse + mustUnmarshal(t, reflectRespBz, &reflectResp) + // now unmarshal the protobuf response + var grpcBalance banktypes.QueryAllBalancesResponse + err = proto.Unmarshal(reflectResp.Data, &grpcBalance) + require.NoError(t, err) +} + func TestReflectTotalSupplyQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper // upload code codeID := StoreReflectContract(t, ctx, keepers).CodeID @@ -168,7 +222,7 @@ func TestReflectTotalSupplyQuery(t *testing.T) { func TestReflectInvalidStargateQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper funds := sdk.NewCoins(sdk.NewInt64Coin("denom", 320000)) @@ -249,7 +303,7 @@ type reflectState struct { func TestMaskReflectWasmQueries(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -319,7 +373,7 @@ func TestMaskReflectWasmQueries(t *testing.T) { func TestWasmRawQueryWithNil(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -362,7 +416,7 @@ func TestWasmRawQueryWithNil(t *testing.T) { } func TestQueryDenomsIntegration(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, CyberpunkFeatures) + ctx, keepers := CreateTestInput(t, false, CyberpunkCapabilities) ck, k := keepers.ContractKeeper, keepers.WasmKeeper creator := keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))...) @@ -476,7 +530,7 @@ func TestQueryDenomsIntegration(t *testing.T) { func TestDistributionQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - pCtx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + pCtx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper example := InstantiateReflectExampleContract(t, pCtx, keepers) @@ -528,9 +582,9 @@ func TestDistributionQuery(t *testing.T) { }, "delegation rewards - existing delegation": { setup: func(t *testing.T, ctx sdk.Context) sdk.Context { - val1, ok := keepers.StakingKeeper.GetValidator(ctx, val1Addr) - require.True(t, ok) - _, err := keepers.StakingKeeper.Delegate(ctx, delegator, sdk.NewInt(10_000_000), stakingtypes.Unbonded, val1, true) + val1, err := keepers.StakingKeeper.GetValidator(ctx, val1Addr) + require.NoError(t, err) + _, err = keepers.StakingKeeper.Delegate(ctx, delegator, sdkmath.NewInt(10_000_000), stakingtypes.Unbonded, val1, true) require.NoError(t, err) setValidatorRewards(ctx, keepers.StakingKeeper, keepers.DistKeeper, val1Addr, "100000000") return nextBlock(ctx, keepers.StakingKeeper) @@ -557,9 +611,9 @@ func TestDistributionQuery(t *testing.T) { }, "delegation rewards - validator empty": { setup: func(t *testing.T, ctx sdk.Context) sdk.Context { - val, found := keepers.StakingKeeper.GetValidator(ctx, val1Addr) - require.True(t, found) - _, err := keepers.StakingKeeper.Delegate(ctx, delegator, sdk.NewInt(10_000_000), stakingtypes.Unbonded, val, true) + val, err := keepers.StakingKeeper.GetValidator(ctx, val1Addr) + require.NoError(t, err) + _, err = keepers.StakingKeeper.Delegate(ctx, delegator, sdkmath.NewInt(10_000_000), stakingtypes.Unbonded, val, true) require.NoError(t, err) return ctx }, @@ -570,9 +624,9 @@ func TestDistributionQuery(t *testing.T) { }, "delegation total rewards": { setup: func(t *testing.T, ctx sdk.Context) sdk.Context { - val, found := keepers.StakingKeeper.GetValidator(ctx, val1Addr) - require.True(t, found) - _, err := keepers.StakingKeeper.Delegate(ctx, delegator, sdk.NewInt(10_000_000), stakingtypes.Unbonded, val, true) + val, err := keepers.StakingKeeper.GetValidator(ctx, val1Addr) + require.NoError(t, err) + _, err = keepers.StakingKeeper.Delegate(ctx, delegator, sdkmath.NewInt(10_000_000), stakingtypes.Unbonded, val, true) require.NoError(t, err) setValidatorRewards(ctx, keepers.StakingKeeper, keepers.DistKeeper, val1Addr, "100000000") return nextBlock(ctx, keepers.StakingKeeper) @@ -597,9 +651,9 @@ func TestDistributionQuery(t *testing.T) { "delegator validators": { setup: func(t *testing.T, ctx sdk.Context) sdk.Context { for _, v := range []sdk.ValAddress{val1Addr, val2Addr} { - val, found := keepers.StakingKeeper.GetValidator(ctx, v) - require.True(t, found) - _, err := keepers.StakingKeeper.Delegate(ctx, delegator, sdk.NewInt(10_000_000), stakingtypes.Unbonded, val, true) + val, err := keepers.StakingKeeper.GetValidator(ctx, v) + require.NoError(t, err) + _, err = keepers.StakingKeeper.Delegate(ctx, delegator, sdkmath.NewInt(10_000_000), stakingtypes.Unbonded, val, true) require.NoError(t, err) } return ctx @@ -645,7 +699,7 @@ func TestDistributionQuery(t *testing.T) { func TestIBCListChannelsQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - pCtx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + pCtx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) keeper := keepers.WasmKeeper nonIbcExample := InstantiateReflectExampleContract(t, pCtx, keepers) ibcExample := InstantiateReflectExampleContract(t, pCtx, keepers) @@ -653,7 +707,7 @@ func TestIBCListChannelsQuery(t *testing.T) { myIBCPortID := "myValidPortID" cInfo := keeper.GetContractInfo(pCtx, ibcExample.Contract) cInfo.IBCPortID = myIBCPortID - keeper.storeContractInfo(pCtx, ibcExample.Contract, cInfo) + keeper.mustStoreContractInfo(pCtx, ibcExample.Contract, cInfo) // store a random channel to be ignored in queries unusedChan := channeltypes.Channel{ State: channeltypes.OPEN, @@ -793,7 +847,7 @@ func TestIBCListChannelsQuery(t *testing.T) { query: &wasmvmtypes.IBCQuery{ListChannels: &wasmvmtypes.ListChannelsQuery{}}, assert: func(t *testing.T, d []byte) { rsp := unmarshalReflect[wasmvmtypes.ListChannelsResponse](t, d) - assert.Nil(t, rsp.Channels) + assert.Empty(t, rsp.Channels) }, }, "no matching channels": { diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index 24e76f3720..0f12124709 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -1,15 +1,18 @@ package keeper import ( + "context" "encoding/json" "errors" "fmt" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + "github.com/cosmos/gogoproto/proto" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -17,7 +20,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -51,7 +54,7 @@ func (q QueryHandler) Query(request wasmvmtypes.QueryRequest, gasLimit uint64) ( // set a limit for a subCtx sdkGas := q.gasRegister.FromWasmVMGas(gasLimit) // discard all changes/ events in subCtx by not committing the cached context - subCtx, _ := q.Ctx.WithGasMeter(sdk.NewGasMeter(sdkGas)).CacheContext() + subCtx, _ := q.Ctx.WithGasMeter(storetypes.NewGasMeter(sdkGas)).CacheContext() // make sure we charge the higher level context even on panic defer func() { @@ -87,20 +90,21 @@ type QueryPlugins struct { IBC func(ctx sdk.Context, caller sdk.AccAddress, request *wasmvmtypes.IBCQuery) ([]byte, error) Staking func(ctx sdk.Context, request *wasmvmtypes.StakingQuery) ([]byte, error) Stargate func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) + Grpc func(ctx sdk.Context, request *wasmvmtypes.GrpcQuery) (proto.Message, error) Wasm func(ctx sdk.Context, request *wasmvmtypes.WasmQuery) ([]byte, error) Distribution func(ctx sdk.Context, request *wasmvmtypes.DistributionQuery) ([]byte, error) } type contractMetaDataSource interface { - GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo + GetContractInfo(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo } type wasmQueryKeeper interface { contractMetaDataSource - GetCodeInfo(ctx sdk.Context, codeID uint64) *types.CodeInfo - QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte - QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) - IsPinnedCode(ctx sdk.Context, codeID uint64) bool + GetCodeInfo(ctx context.Context, codeID uint64) *types.CodeInfo + QueryRaw(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte + QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) + IsPinnedCode(ctx context.Context, codeID uint64) bool } func DefaultQueryPlugins( @@ -110,12 +114,15 @@ func DefaultQueryPlugins( channelKeeper types.ChannelKeeper, wasm wasmQueryKeeper, ) QueryPlugins { + // By default, we reject all stargate and gRPC queries. + // The chain needs to provide a querier plugin that only allows deterministic queries. return QueryPlugins{ Bank: BankQuerier(bank), Custom: NoCustomQuerier, IBC: IBCQuerier(wasm, channelKeeper), Staking: StakingQuerier(staking, distKeeper), Stargate: RejectStargateQuerier(), + Grpc: RejectGrpcQuerier, Wasm: WasmQuerier(wasm), Distribution: DistributionQuerier(distKeeper), } @@ -141,6 +148,9 @@ func (e QueryPlugins) Merge(o *QueryPlugins) QueryPlugins { if o.Stargate != nil { e.Stargate = o.Stargate } + if o.Grpc != nil { + e.Grpc = o.Grpc + } if o.Wasm != nil { e.Wasm = o.Wasm } @@ -164,6 +174,14 @@ func (e QueryPlugins) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, req wa return e.Staking(ctx, req.Staking) case req.Stargate != nil: return e.Stargate(ctx, req.Stargate) + case req.Grpc != nil: + resp, err := e.Grpc(ctx, req.Grpc) + if err != nil { + return nil, err + } + // Marshaling the response here instead of inside the query + // plugin makes sure that the response is always protobuf encoded. + return proto.Marshal(resp) case req.Wasm != nil: return e.Wasm(ctx, req.Wasm) case req.Distribution != nil: @@ -252,10 +270,10 @@ func IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper) if portID == "" { // then fallback to contract port address portID = wasm.GetContractInfo(ctx, caller).IBCPortID } - var channels wasmvmtypes.IBCChannels + var channels wasmvmtypes.Array[wasmvmtypes.IBCChannel] if portID != "" { // then return empty list for non ibc contracts; no channels possible gotChannels := channelKeeper.GetAllChannelsWithPortPrefix(ctx, portID) - channels = make(wasmvmtypes.IBCChannels, 0, len(gotChannels)) + channels = make(wasmvmtypes.Array[wasmvmtypes.IBCChannel], 0, len(gotChannels)) for _, ch := range gotChannels { if ch.State != channeltypes.OPEN { continue @@ -314,6 +332,48 @@ func IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper) } } +func RejectGrpcQuerier(ctx sdk.Context, request *wasmvmtypes.GrpcQuery) (proto.Message, error) { + return nil, wasmvmtypes.UnsupportedRequest{Kind: "gRPC queries are disabled"} +} + +// AcceptListGrpcQuerier supports a preconfigured set of gRPC queries only. +// All arguments must be non nil. +// +// Warning: Chains need to test and maintain their accept list carefully. +// There were critical consensus breaking issues in the past with non-deterministic behavior in the SDK. +// +// These queries can be set via WithQueryPlugins option in the wasm keeper constructor: +// WithQueryPlugins(&QueryPlugins{Grpc: AcceptListGrpcQuerier(acceptList, queryRouter, codec)}) +func AcceptListGrpcQuerier(acceptList AcceptedQueries, queryRouter GRPCQueryRouter, codec codec.Codec) func(ctx sdk.Context, request *wasmvmtypes.GrpcQuery) (proto.Message, error) { + return func(ctx sdk.Context, request *wasmvmtypes.GrpcQuery) (proto.Message, error) { + protoResponse, accepted := acceptList[request.Path] + if !accepted { + return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("'%s' path is not allowed from the contract", request.Path)} + } + + handler := queryRouter.Route(request.Path) + if handler == nil { + return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("No route to query '%s'", request.Path)} + } + + res, err := handler(ctx, &abci.RequestQuery{ + Data: request.Data, + Path: request.Path, + }) + if err != nil { + return nil, err + } + + // decode the query response into the expected protobuf message + err = codec.Unmarshal(res.Value, protoResponse) + if err != nil { + return nil, err + } + + return protoResponse, nil + } +} + // RejectStargateQuerier rejects all stargate queries func RejectStargateQuerier() func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { return func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { @@ -321,10 +381,10 @@ func RejectStargateQuerier() func(ctx sdk.Context, request *wasmvmtypes.Stargate } } -// AcceptedStargateQueries define accepted Stargate queries as a map with path as key and response type as value. +// AcceptedQueries define accepted Stargate or gRPC queries as a map with path as key and response type as value. // For example: // acceptList["/cosmos.auth.v1beta1.Query/Account"]= &authtypes.QueryAccountResponse{} -type AcceptedStargateQueries map[string]codec.ProtoMarshaler +type AcceptedQueries map[string]proto.Message // AcceptListStargateQuerier supports a preconfigured set of stargate queries only. // All arguments must be non nil. @@ -332,9 +392,9 @@ type AcceptedStargateQueries map[string]codec.ProtoMarshaler // Warning: Chains need to test and maintain their accept list carefully. // There were critical consensus breaking issues in the past with non-deterministic behavior in the SDK. // -// This queries can be set via WithQueryPlugins option in the wasm keeper constructor: +// These queries can be set via WithQueryPlugins option in the wasm keeper constructor: // WithQueryPlugins(&QueryPlugins{Stargate: AcceptListStargateQuerier(acceptList, queryRouter, codec)}) -func AcceptListStargateQuerier(acceptList AcceptedStargateQueries, queryRouter GRPCQueryRouter, codec codec.Codec) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { +func AcceptListStargateQuerier(acceptList AcceptedQueries, queryRouter GRPCQueryRouter, codec codec.Codec) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { return func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { protoResponse, accepted := acceptList[request.Path] if !accepted { @@ -346,7 +406,7 @@ func AcceptListStargateQuerier(acceptList AcceptedStargateQueries, queryRouter G return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("No route to query '%s'", request.Path)} } - res, err := route(ctx, abci.RequestQuery{ + res, err := route(ctx, &abci.RequestQuery{ Data: request.Data, Path: request.Path, }) @@ -364,14 +424,20 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee return nil, wasmvmtypes.UnsupportedRequest{Kind: "Staking is not supported"} } if request.BondedDenom != nil { - denom := keeper.BondDenom(ctx) + denom, err := keeper.BondDenom(ctx) + if err != nil { + return nil, errorsmod.Wrap(err, "bond denom") + } res := wasmvmtypes.BondedDenomResponse{ Denom: denom, } return json.Marshal(res) } if request.AllValidators != nil { - validators := keeper.GetBondedValidatorsByPower(ctx) + validators, err := keeper.GetBondedValidatorsByPower(ctx) + if err != nil { + return nil, err + } // validators := keeper.GetAllValidators(ctx) wasmVals := make([]wasmvmtypes.Validator, len(validators)) for i, v := range validators { @@ -392,9 +458,14 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee if err != nil { return nil, err } - v, found := keeper.GetValidator(ctx, valAddr) + res := wasmvmtypes.ValidatorResponse{} - if found { + v, err := keeper.GetValidator(ctx, valAddr) + switch { + case stakingtypes.ErrNoValidatorFound.Is(err): // return empty result for backwards compatibility. Changed in SDK 50 + case err != nil: + return nil, err + default: res.Validator = &wasmvmtypes.Validator{ Address: v.OperatorAddress, Commission: v.Commission.Rate.String(), @@ -409,7 +480,10 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee if err != nil { return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.AllDelegations.Delegator) } - sdkDels := keeper.GetAllDelegatorDelegations(ctx, delegator) + sdkDels, err := keeper.GetAllDelegatorDelegations(ctx, delegator) + if err != nil { + return nil, err + } delegations, err := sdkToDelegations(ctx, keeper, sdkDels) if err != nil { return nil, err @@ -430,8 +504,12 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee } var res wasmvmtypes.DelegationResponse - d, found := keeper.GetDelegation(ctx, delegator, validator) - if found { + d, err := keeper.GetDelegation(ctx, delegator, validator) + switch { + case stakingtypes.ErrNoDelegation.Is(err): // return empty result for backwards compatibility. Changed in SDK 50 + case err != nil: + return nil, err + default: res.Delegation, err = sdkToFullDelegation(ctx, keeper, distKeeper, d) if err != nil { return nil, err @@ -443,9 +521,12 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee } } -func sdkToDelegations(ctx sdk.Context, keeper types.StakingKeeper, delegations []stakingtypes.Delegation) (wasmvmtypes.Delegations, error) { +func sdkToDelegations(ctx sdk.Context, keeper types.StakingKeeper, delegations []stakingtypes.Delegation) (wasmvmtypes.Array[wasmvmtypes.Delegation], error) { result := make([]wasmvmtypes.Delegation, len(delegations)) - bondDenom := keeper.BondDenom(ctx) + bondDenom, err := keeper.BondDenom(ctx) + if err != nil { + return nil, errorsmod.Wrap(err, "bond denom") + } for i, d := range delegations { delAddr, err := sdk.AccAddressFromBech32(d.DelegatorAddress) @@ -459,9 +540,9 @@ func sdkToDelegations(ctx sdk.Context, keeper types.StakingKeeper, delegations [ // shares to amount logic comes from here: // https://github.com/cosmos/cosmos-sdk/blob/v0.38.3/x/staking/keeper/querier.go#L404 - val, found := keeper.GetValidator(ctx, valAddr) - if !found { - return nil, errorsmod.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation") + val, err := keeper.GetValidator(ctx, valAddr) + if err != nil { // is stakingtypes.ErrNoValidatorFound + return nil, errorsmod.Wrap(err, "can't load validator for delegation") } amount := sdk.NewCoin(bondDenom, val.TokensFromShares(d.Shares).TruncateInt()) @@ -483,11 +564,15 @@ func sdkToFullDelegation(ctx sdk.Context, keeper types.StakingKeeper, distKeeper if err != nil { return nil, errorsmod.Wrap(err, "validator address") } - val, found := keeper.GetValidator(ctx, valAddr) - if !found { - return nil, errorsmod.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation") + val, err := keeper.GetValidator(ctx, valAddr) + if err != nil { // is stakingtypes.ErrNoValidatorFound + return nil, errorsmod.Wrap(err, "can't load validator for delegation") } - bondDenom := keeper.BondDenom(ctx) + bondDenom, err := keeper.BondDenom(ctx) + if err != nil { + return nil, errorsmod.Wrap(err, "bond denom") + } + amount := sdk.NewCoin(bondDenom, val.TokensFromShares(delegation.Shares).TruncateInt()) delegationCoins := ConvertSdkCoinToWasmCoin(amount) @@ -498,7 +583,11 @@ func sdkToFullDelegation(ctx sdk.Context, keeper types.StakingKeeper, distKeeper // otherwise, it can redelegate the full amount // (there are cases of partial funds redelegated, but this is a start) redelegateCoins := wasmvmtypes.NewCoin(0, bondDenom) - if !keeper.HasReceivingRedelegation(ctx, delAddr, valAddr) { + found, err := keeper.HasReceivingRedelegation(ctx, delAddr, valAddr) + if err != nil { + return nil, err + } + if !found { redelegateCoins = delegationCoins } @@ -524,12 +613,12 @@ func sdkToFullDelegation(ctx sdk.Context, keeper types.StakingKeeper, distKeeper // https://github.com/cosmos/cosmos-sdk/issues/7466 is merged func getAccumulatedRewards(ctx sdk.Context, distKeeper types.DistributionKeeper, delegation stakingtypes.Delegation) ([]wasmvmtypes.Coin, error) { // Try to get *delegator* reward info! - params := distrtypes.QueryDelegationRewardsRequest{ + params := distributiontypes.QueryDelegationRewardsRequest{ DelegatorAddress: delegation.DelegatorAddress, ValidatorAddress: delegation.ValidatorAddress, } cache, _ := ctx.CacheContext() - qres, err := distKeeper.DelegationRewards(sdk.WrapSDKContext(cache), ¶ms) + qres, err := distKeeper.DelegationRewards(cache, ¶ms) if err != nil { return nil, err } @@ -608,7 +697,7 @@ func DistributionQuerier(k types.DistributionKeeper) func(ctx sdk.Context, reque return func(ctx sdk.Context, req *wasmvmtypes.DistributionQuery) ([]byte, error) { switch { case req.DelegatorWithdrawAddress != nil: - got, err := k.DelegatorWithdrawAddress(ctx, &distrtypes.QueryDelegatorWithdrawAddressRequest{DelegatorAddress: req.DelegatorWithdrawAddress.DelegatorAddress}) + got, err := k.DelegatorWithdrawAddress(ctx, &distributiontypes.QueryDelegatorWithdrawAddressRequest{DelegatorAddress: req.DelegatorWithdrawAddress.DelegatorAddress}) if err != nil { return nil, err } @@ -616,7 +705,7 @@ func DistributionQuerier(k types.DistributionKeeper) func(ctx sdk.Context, reque WithdrawAddress: got.WithdrawAddress, }) case req.DelegationRewards != nil: - got, err := k.DelegationRewards(ctx, &distrtypes.QueryDelegationRewardsRequest{ + got, err := k.DelegationRewards(ctx, &distributiontypes.QueryDelegationRewardsRequest{ DelegatorAddress: req.DelegationRewards.DelegatorAddress, ValidatorAddress: req.DelegationRewards.ValidatorAddress, }) @@ -627,7 +716,7 @@ func DistributionQuerier(k types.DistributionKeeper) func(ctx sdk.Context, reque Rewards: ConvertSDKDecCoinsToWasmDecCoins(got.Rewards), }) case req.DelegationTotalRewards != nil: - got, err := k.DelegationTotalRewards(ctx, &distrtypes.QueryDelegationTotalRewardsRequest{ + got, err := k.DelegationTotalRewards(ctx, &distributiontypes.QueryDelegationTotalRewardsRequest{ DelegatorAddress: req.DelegationTotalRewards.DelegatorAddress, }) if err != nil { @@ -638,7 +727,7 @@ func DistributionQuerier(k types.DistributionKeeper) func(ctx sdk.Context, reque Total: ConvertSDKDecCoinsToWasmDecCoins(got.Total), }) case req.DelegatorValidators != nil: - got, err := k.DelegatorValidators(ctx, &distrtypes.QueryDelegatorValidatorsRequest{ + got, err := k.DelegatorValidators(ctx, &distributiontypes.QueryDelegatorValidatorsRequest{ DelegatorAddress: req.DelegatorValidators.DelegatorAddress, }) if err != nil { @@ -653,7 +742,7 @@ func DistributionQuerier(k types.DistributionKeeper) func(ctx sdk.Context, reque } // ConvertSDKDelegatorRewardsToWasmRewards convert sdk to wasmvm type -func ConvertSDKDelegatorRewardsToWasmRewards(rewards []distrtypes.DelegationDelegatorReward) []wasmvmtypes.DelegatorReward { +func ConvertSDKDelegatorRewardsToWasmRewards(rewards []distributiontypes.DelegationDelegatorReward) []wasmvmtypes.DelegatorReward { r := make([]wasmvmtypes.DelegatorReward, len(rewards)) for i, v := range rewards { r[i] = wasmvmtypes.DelegatorReward{ @@ -677,8 +766,8 @@ func ConvertSDKDecCoinsToWasmDecCoins(src sdk.DecCoins) []wasmvmtypes.DecCoin { } // ConvertSdkCoinsToWasmCoins covert sdk type to wasmvm coins type -func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Coins { - converted := make(wasmvmtypes.Coins, len(coins)) +func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Array[wasmvmtypes.Coin] { + converted := make(wasmvmtypes.Array[wasmvmtypes.Coin], len(coins)) for i, c := range coins { converted[i] = ConvertSdkCoinToWasmCoin(c) } @@ -741,7 +830,7 @@ func ConvertSdkDenomUnitsToWasmDenomUnits(denomUnits []*banktypes.DenomUnit) []w // ConvertProtoToJSONMarshal unmarshals the given bytes into a proto message and then marshals it to json. // This is done so that clients calling stargate queries do not need to define their own proto unmarshalers, // being able to use response directly by json marshaling, which is supported in cosmwasm. -func ConvertProtoToJSONMarshal(cdc codec.Codec, protoResponse codec.ProtoMarshaler, bz []byte) ([]byte, error) { +func ConvertProtoToJSONMarshal(cdc codec.Codec, protoResponse proto.Message, bz []byte) ([]byte, error) { // unmarshal binary into stargate response data structure err := cdc.Unmarshal(bz, protoResponse) if err != nil { diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index 78666f3cd3..1fea83a25f 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -9,25 +9,24 @@ import ( "testing" "time" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - "github.com/cometbft/cometbft/libs/rand" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/gogoproto/proto" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/query" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -52,7 +51,7 @@ func TestIBCQuerier(t *testing.T) { PortID: &wasmvmtypes.PortIDQuery{}, }, wasmKeeper: &mockWasmQueryKeeper{ - GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { return &types.ContractInfo{IBCPortID: "myIBCPortID"} }, }, @@ -103,7 +102,7 @@ func TestIBCQuerier(t *testing.T) { }, }, wasmKeeper: &mockWasmQueryKeeper{ - GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { return &types.ContractInfo{IBCPortID: "myLoadedPortID"} }, }, @@ -211,8 +210,8 @@ func TestIBCQuerier(t *testing.T) { } func TestBankQuerierBalance(t *testing.T) { - mock := bankKeeperMock{GetBalanceFn: func(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { - return sdk.NewCoin(denom, sdk.NewInt(1)) + mock := bankKeeperMock{GetBalanceFn: func(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin { + return sdk.NewCoin(denom, sdkmath.NewInt(1)) }} ctx := sdk.Context{} @@ -247,7 +246,7 @@ func TestBankQuerierMetadata(t *testing.T) { }, } - mock := bankKeeperMock{GetDenomMetadataFn: func(ctx sdk.Context, denom string) (banktypes.Metadata, bool) { + mock := bankKeeperMock{GetDenomMetadataFn: func(ctx context.Context, denom string) (banktypes.Metadata, bool) { if denom == "utest" { return metadata, true } else { @@ -379,13 +378,13 @@ func TestContractInfoWasmQuerier(t *testing.T) { ContractInfo: &wasmvmtypes.ContractInfoQuery{ContractAddr: myValidContractAddr}, }, mock: mockWasmQueryKeeper{ - GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { val := types.ContractInfoFixture(func(i *types.ContractInfo) { i.Admin, i.Creator, i.IBCPortID = myAdminAddr, myCreatorAddr, "myIBCPort" }) return &val }, - IsPinnedCodeFn: func(ctx sdk.Context, codeID uint64) bool { return true }, + IsPinnedCodeFn: func(ctx context.Context, codeID uint64) bool { return true }, }, expRes: wasmvmtypes.ContractInfoResponse{ CodeID: 1, @@ -405,7 +404,7 @@ func TestContractInfoWasmQuerier(t *testing.T) { req: &wasmvmtypes.WasmQuery{ ContractInfo: &wasmvmtypes.ContractInfoQuery{ContractAddr: myValidContractAddr}, }, - mock: mockWasmQueryKeeper{GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + mock: mockWasmQueryKeeper{GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { return nil }}, expErr: true, @@ -415,13 +414,13 @@ func TestContractInfoWasmQuerier(t *testing.T) { ContractInfo: &wasmvmtypes.ContractInfoQuery{ContractAddr: myValidContractAddr}, }, mock: mockWasmQueryKeeper{ - GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { val := types.ContractInfoFixture(func(i *types.ContractInfo) { i.Admin, i.Creator = myAdminAddr, myCreatorAddr }) return &val }, - IsPinnedCodeFn: func(ctx sdk.Context, codeID uint64) bool { return false }, + IsPinnedCodeFn: func(ctx context.Context, codeID uint64) bool { return false }, }, expRes: wasmvmtypes.ContractInfoResponse{ CodeID: 1, @@ -435,13 +434,13 @@ func TestContractInfoWasmQuerier(t *testing.T) { ContractInfo: &wasmvmtypes.ContractInfoQuery{ContractAddr: myValidContractAddr}, }, mock: mockWasmQueryKeeper{ - GetContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { + GetContractInfoFn: func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { val := types.ContractInfoFixture(func(i *types.ContractInfo) { i.Creator = myCreatorAddr }) return &val }, - IsPinnedCodeFn: func(ctx sdk.Context, codeID uint64) bool { return true }, + IsPinnedCodeFn: func(ctx context.Context, codeID uint64) bool { return true }, }, expRes: wasmvmtypes.ContractInfoResponse{ CodeID: 1, @@ -482,7 +481,7 @@ func TestCodeInfoWasmQuerier(t *testing.T) { CodeInfo: &wasmvmtypes.CodeInfoQuery{CodeID: 1}, }, mock: mockWasmQueryKeeper{ - GetCodeInfoFn: func(ctx sdk.Context, codeID uint64) *types.CodeInfo { + GetCodeInfoFn: func(ctx context.Context, codeID uint64) *types.CodeInfo { return &types.CodeInfo{ CodeHash: myRawChecksum, Creator: myCreatorAddr, @@ -510,7 +509,7 @@ func TestCodeInfoWasmQuerier(t *testing.T) { CodeInfo: &wasmvmtypes.CodeInfoQuery{CodeID: 1}, }, mock: mockWasmQueryKeeper{ - GetCodeInfoFn: func(ctx sdk.Context, codeID uint64) *types.CodeInfo { + GetCodeInfoFn: func(ctx context.Context, codeID uint64) *types.CodeInfo { return nil }, }, @@ -561,7 +560,8 @@ func TestQueryErrors(t *testing.T) { mock := keeper.WasmVMQueryHandlerFn(func(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error) { return nil, spec.src }) - ctx := sdk.Context{}.WithGasMeter(sdk.NewInfiniteGasMeter()).WithMultiStore(store.NewCommitMultiStore(dbm.NewMemDB())).WithLogger(log.TestingLogger()) + ms := store.NewCommitMultiStore(dbm.NewMemDB(), log.NewTestLogger(t), storemetrics.NewNoOpMetrics()) + ctx := sdk.Context{}.WithGasMeter(storetypes.NewInfiniteGasMeter()).WithMultiStore(ms).WithLogger(log.NewTestLogger(t)) q := keeper.NewQueryHandler(ctx, mock, sdk.AccAddress{}, types.NewDefaultWasmGasRegister()) _, gotErr := q.Query(wasmvmtypes.QueryRequest{}, 1) assert.Equal(t, spec.expErr, gotErr) @@ -571,12 +571,12 @@ func TestQueryErrors(t *testing.T) { func TestAcceptListStargateQuerier(t *testing.T) { wasmApp := app.SetupWithEmptyStore(t) - ctx := wasmApp.NewUncachedContext(false, tmproto.Header{ChainID: "foo", Height: 1, Time: time.Now()}) + ctx := wasmApp.NewUncachedContext(false, cmtproto.Header{ChainID: "foo", Height: 1, Time: time.Now()}) err := wasmApp.StakingKeeper.SetParams(ctx, stakingtypes.DefaultParams()) require.NoError(t, err) - addrs := app.AddTestAddrsIncremental(wasmApp, ctx, 2, sdk.NewInt(1_000_000)) - accepted := keeper.AcceptedStargateQueries{ + addrs := app.AddTestAddrsIncremental(wasmApp, ctx, 2, sdkmath.NewInt(1_000_000)) + accepted := keeper.AcceptedQueries{ "/cosmos.auth.v1beta1.Query/Account": &authtypes.QueryAccountResponse{}, "/no/route/to/this": &authtypes.QueryAccountResponse{}, } @@ -635,102 +635,43 @@ func TestAcceptListStargateQuerier(t *testing.T) { } } -func TestDistributionQuerier(t *testing.T) { - t.Skip("not implemented") - ctx := sdk.Context{} - var myAddr sdk.AccAddress = rand.Bytes(address.Len) - var myOtherAddr sdk.AccAddress = rand.Bytes(address.Len) - specs := map[string]struct { - q wasmvmtypes.DistributionQuery - mockFn func(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress - expAddr string - expErr bool - }{ - "withdrawal override": { - q: wasmvmtypes.DistributionQuery{ - DelegatorWithdrawAddress: &wasmvmtypes.DelegatorWithdrawAddressQuery{DelegatorAddress: myAddr.String()}, - }, - mockFn: func(_ sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress { - return myOtherAddr - }, - expAddr: myOtherAddr.String(), - }, - "no withdrawal override": { - q: wasmvmtypes.DistributionQuery{ - DelegatorWithdrawAddress: &wasmvmtypes.DelegatorWithdrawAddressQuery{DelegatorAddress: myAddr.String()}, - }, - mockFn: func(_ sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress { - return delAddr - }, - expAddr: myAddr.String(), - }, - "empty address": { - q: wasmvmtypes.DistributionQuery{ - DelegatorWithdrawAddress: &wasmvmtypes.DelegatorWithdrawAddressQuery{}, - }, - expErr: true, - }, - "unknown query": { - q: wasmvmtypes.DistributionQuery{}, - expErr: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - // mock := distrKeeperMock{GetDelegatorWithdrawAddrFn: spec.mockFn} - var mock types.DistributionKeeper - q := keeper.DistributionQuerier(mock) - - gotBz, gotErr := q(ctx, &spec.q) //nolint:gosec - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - var rsp wasmvmtypes.DelegatorWithdrawAddressResponse - require.NoError(t, json.Unmarshal(gotBz, &rsp)) - assert.Equal(t, spec.expAddr, rsp.WithdrawAddress) - }) - } -} - type mockWasmQueryKeeper struct { - GetContractInfoFn func(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo - QueryRawFn func(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte - QuerySmartFn func(ctx sdk.Context, contractAddr sdk.AccAddress, req types.RawContractMessage) ([]byte, error) - IsPinnedCodeFn func(ctx sdk.Context, codeID uint64) bool - GetCodeInfoFn func(ctx sdk.Context, codeID uint64) *types.CodeInfo + GetContractInfoFn func(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo + QueryRawFn func(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte + QuerySmartFn func(ctx context.Context, contractAddr sdk.AccAddress, req types.RawContractMessage) ([]byte, error) + IsPinnedCodeFn func(ctx context.Context, codeID uint64) bool + GetCodeInfoFn func(ctx context.Context, codeID uint64) *types.CodeInfo } -func (m mockWasmQueryKeeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *types.ContractInfo { +func (m mockWasmQueryKeeper) GetContractInfo(ctx context.Context, contractAddress sdk.AccAddress) *types.ContractInfo { if m.GetContractInfoFn == nil { panic("not expected to be called") } return m.GetContractInfoFn(ctx, contractAddress) } -func (m mockWasmQueryKeeper) QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte { +func (m mockWasmQueryKeeper) QueryRaw(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte { if m.QueryRawFn == nil { panic("not expected to be called") } return m.QueryRawFn(ctx, contractAddress, key) } -func (m mockWasmQueryKeeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) { +func (m mockWasmQueryKeeper) QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) { if m.QuerySmartFn == nil { panic("not expected to be called") } return m.QuerySmartFn(ctx, contractAddr, req) } -func (m mockWasmQueryKeeper) IsPinnedCode(ctx sdk.Context, codeID uint64) bool { +func (m mockWasmQueryKeeper) IsPinnedCode(ctx context.Context, codeID uint64) bool { if m.IsPinnedCodeFn == nil { panic("not expected to be called") } return m.IsPinnedCodeFn(ctx, codeID) } -func (m mockWasmQueryKeeper) GetCodeInfo(ctx sdk.Context, codeID uint64) *types.CodeInfo { +func (m mockWasmQueryKeeper) GetCodeInfo(ctx context.Context, codeID uint64) *types.CodeInfo { if m.GetCodeInfoFn == nil { panic("not expected to be called") } @@ -738,35 +679,35 @@ func (m mockWasmQueryKeeper) GetCodeInfo(ctx sdk.Context, codeID uint64) *types. } type bankKeeperMock struct { - GetSupplyFn func(ctx sdk.Context, denom string) sdk.Coin - GetBalanceFn func(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalancesFn func(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetDenomMetadataFn func(ctx sdk.Context, denom string) (banktypes.Metadata, bool) + GetSupplyFn func(ctx context.Context, denom string) sdk.Coin + GetBalanceFn func(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalancesFn func(ctx context.Context, addr sdk.AccAddress) sdk.Coins + GetDenomMetadataFn func(ctx context.Context, denom string) (banktypes.Metadata, bool) GetDenomsMetadataFn func(ctx context.Context, req *banktypes.QueryDenomsMetadataRequest) (*banktypes.QueryDenomsMetadataResponse, error) } -func (m bankKeeperMock) GetSupply(ctx sdk.Context, denom string) sdk.Coin { +func (m bankKeeperMock) GetSupply(ctx context.Context, denom string) sdk.Coin { if m.GetSupplyFn == nil { panic("not expected to be called") } return m.GetSupplyFn(ctx, denom) } -func (m bankKeeperMock) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { +func (m bankKeeperMock) GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin { if m.GetBalanceFn == nil { panic("not expected to be called") } return m.GetBalanceFn(ctx, addr, denom) } -func (m bankKeeperMock) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { +func (m bankKeeperMock) GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins { if m.GetAllBalancesFn == nil { panic("not expected to be called") } return m.GetAllBalancesFn(ctx, addr) } -func (m bankKeeperMock) GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) { +func (m bankKeeperMock) GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) { if m.GetDenomMetadataFn == nil { panic("not expected to be called") } @@ -784,9 +725,9 @@ func TestConvertProtoToJSONMarshal(t *testing.T) { testCases := []struct { name string queryPath string - protoResponseStruct codec.ProtoMarshaler + protoResponseStruct proto.Message originalResponse string - expectedProtoResponse codec.ProtoMarshaler + expectedProtoResponse proto.Message expectedError bool }{ { @@ -795,7 +736,7 @@ func TestConvertProtoToJSONMarshal(t *testing.T) { originalResponse: "0a090a036261721202333012050a03666f6f", protoResponseStruct: &banktypes.QueryAllBalancesResponse{}, expectedProtoResponse: &banktypes.QueryAllBalancesResponse{ - Balances: sdk.NewCoins(sdk.NewCoin("bar", sdk.NewInt(30))), + Balances: sdk.NewCoins(sdk.NewCoin("bar", sdkmath.NewInt(30))), Pagination: &query.PageResponse{ NextKey: []byte("foo"), }, @@ -814,7 +755,7 @@ func TestConvertProtoToJSONMarshal(t *testing.T) { t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { originalVersionBz, err := hex.DecodeString(tc.originalResponse) require.NoError(t, err) - appCodec := app.MakeEncodingConfig().Codec + appCodec := app.MakeEncodingConfig(t).Codec jsonMarshalledResponse, err := keeper.ConvertProtoToJSONMarshal(appCodec, tc.protoResponseStruct, originalVersionBz) if tc.expectedError { @@ -869,11 +810,11 @@ func TestConvertSDKDecCoinToWasmDecCoin(t *testing.T) { } func TestResetProtoMarshalerAfterJsonMarshal(t *testing.T) { - appCodec := app.MakeEncodingConfig().Codec + appCodec := app.MakeEncodingConfig(t).Codec protoMarshaler := &banktypes.QueryAllBalancesResponse{} expected := appCodec.MustMarshalJSON(&banktypes.QueryAllBalancesResponse{ - Balances: sdk.NewCoins(sdk.NewCoin("bar", sdk.NewInt(30))), + Balances: sdk.NewCoins(sdk.NewCoin("bar", sdkmath.NewInt(30))), Pagination: &query.PageResponse{ NextKey: []byte("foo"), }, @@ -901,8 +842,8 @@ func TestDeterministicJsonMarshal(t *testing.T) { originalResponse string updatedResponse string queryPath string - responseProtoStruct codec.ProtoMarshaler - expectedProto func() codec.ProtoMarshaler + responseProtoStruct proto.Message + expectedProto func() proto.Message }{ /** * @@ -930,7 +871,7 @@ func TestDeterministicJsonMarshal(t *testing.T) { "0a530a202f636f736d6f732e617574682e763162657461312e426173654163636f756e74122f0a2d636f736d6f733166387578756c746e3873717a687a6e72737a3371373778776171756867727367366a79766679122d636f736d6f733166387578756c746e3873717a687a6e72737a3371373778776171756867727367366a79766679", "/cosmos.auth.v1beta1.Query/Account", &authtypes.QueryAccountResponse{}, - func() codec.ProtoMarshaler { + func() proto.Message { account := authtypes.BaseAccount{ Address: "cosmos1f8uxultn8sqzhznrsz3q77xwaquhgrsg6jyvfy", } @@ -945,7 +886,7 @@ func TestDeterministicJsonMarshal(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { - appCodec := app.MakeEncodingConfig().Codec + appCodec := app.MakeEncodingConfig(t).Codec originVersionBz, err := hex.DecodeString(tc.originalResponse) require.NoError(t, err) diff --git a/x/wasm/keeper/recurse_test.go b/x/wasm/keeper/recurse_test.go index 4d10d12e64..a0a2bae54a 100644 --- a/x/wasm/keeper/recurse_test.go +++ b/x/wasm/keeper/recurse_test.go @@ -4,10 +4,12 @@ import ( "encoding/json" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -112,7 +114,7 @@ func TestGasCostOnQuery(t *testing.T) { keeper.queryGasLimit = 1000 // make sure we set a limit before calling - ctx = ctx.WithGasMeter(sdk.NewGasMeter(tc.gasLimit)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(tc.gasLimit)) require.Equal(t, uint64(0), ctx.GasMeter().GasConsumed()) // do the query @@ -187,9 +189,9 @@ func TestGasOnExternalQuery(t *testing.T) { recurse := tc.msg msg := buildRecurseQuery(t, recurse) - querier := NewGrpcQuerier(keeper.cdc, keeper.storeKey, keeper, tc.gasLimit) + querier := NewGrpcQuerier(keeper.cdc, keeper.storeService, keeper, tc.gasLimit) req := &types.QuerySmartContractStateRequest{Address: contractAddr.String(), QueryData: msg} - _, gotErr := querier.SmartContractState(sdk.WrapSDKContext(ctx), req) + _, gotErr := querier.SmartContractState(ctx, req) if tc.expOutOfGas { require.Error(t, gotErr, sdkerrors.ErrOutOfGas) return @@ -209,7 +211,7 @@ func TestLimitRecursiveQueryGas(t *testing.T) { const ( // Note: about 100 SDK gas (10k CosmWasm gas) for each round of sha256 - GasWork2k uint64 = 77_161 // = NewContractInstanceCosts + x // we have 6x gas used in cpu than in the instance + GasWork2k uint64 = 77_161 // = SetupContractCost + x // we have 6x gas used in cpu than in the instance // This is overhead for calling into a sub-contract GasReturnHashed uint64 = 27 ) @@ -274,7 +276,7 @@ func TestLimitRecursiveQueryGas(t *testing.T) { totalWasmQueryCounter = 0 // make sure we set a limit before calling - ctx = ctx.WithGasMeter(sdk.NewGasMeter(tc.gasLimit)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(tc.gasLimit)) require.Equal(t, uint64(0), ctx.GasMeter().GasConsumed()) // prepare the query diff --git a/x/wasm/keeper/reflect_test.go b/x/wasm/keeper/reflect_test.go index e5cf79ff65..d6a14ae361 100644 --- a/x/wasm/keeper/reflect_test.go +++ b/x/wasm/keeper/reflect_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -23,9 +23,9 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) -const ( - CyberpunkFeatures = "staking,mask,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4" - ReflectFeatures = CyberpunkFeatures +var ( + CyberpunkCapabilities = []string{"staking", "mask", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4"} + ReflectCapabilities = []string{"staking", "mask", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0"} ) func mustUnmarshal(t *testing.T, data []byte, res interface{}) { @@ -36,7 +36,7 @@ func mustUnmarshal(t *testing.T, data []byte, res interface{}) { func TestReflectContractSend(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc))) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc))) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -115,7 +115,7 @@ func TestReflectContractSend(t *testing.T) { func TestReflectCustomMsg(t *testing.T) { cdc := MakeEncodingConfig(t).Codec - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -205,7 +205,7 @@ func TestReflectCustomMsg(t *testing.T) { } func TestRustPanicIsHandled(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, CyberpunkFeatures) + ctx, keepers := CreateTestInput(t, false, CyberpunkCapabilities) keeper := keepers.ContractKeeper creator := keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))...) @@ -222,13 +222,12 @@ func TestRustPanicIsHandled(t *testing.T) { // when panic is triggered msg := []byte(`{"panic":{}}`) gotData, err := keeper.Execute(ctx, contractAddr, creator, msg, nil) - require.ErrorIs(t, err, types.ErrExecuteFailed) + require.ErrorIs(t, err, types.ErrVMError) assert.Contains(t, err.Error(), "panicked at 'This page intentionally faulted'") assert.Nil(t, gotData) } func checkAccount(t *testing.T, ctx sdk.Context, accKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, expected sdk.Coins) { - t.Helper() acct := accKeeper.GetAccount(ctx, addr) if expected == nil { assert.Nil(t, acct) diff --git a/x/wasm/keeper/relay.go b/x/wasm/keeper/relay.go index 209218b86c..388136d608 100644 --- a/x/wasm/keeper/relay.go +++ b/x/wasm/keeper/relay.go @@ -3,9 +3,9 @@ package keeper import ( "time" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" errorsmod "cosmossdk.io/errors" @@ -36,14 +36,14 @@ func (k Keeper) OnOpenChannel( env := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCChannelOpen(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCChannelOpen(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return "", errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) } - if res != nil { - return res.Version, nil + if res != nil && res.Ok != nil { + return res.Ok.Version, nil } return "", nil } @@ -69,14 +69,21 @@ func (k Keeper) OnConnectChannel( env := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCChannelConnect(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCChannelConnect(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) + } - return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res) + return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok) } // OnCloseChannel calls the contract to let it know the IBC channel is closed. @@ -100,14 +107,21 @@ func (k Keeper) OnCloseChannel( params := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCChannelClose(codeInfo.CodeHash, params, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCChannelClose(codeInfo.CodeHash, params, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) + } - return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res) + return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok) } // OnRecvPacket calls the contract to process the incoming IBC packet. The contract fully owns the data processing and @@ -130,8 +144,8 @@ func (k Keeper) OnRecvPacket( env := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCPacketReceive(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCPacketReceive(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { panic(execErr) // let the contract fully abort an IBC packet receive. @@ -139,6 +153,10 @@ func (k Keeper) OnRecvPacket( // all state downstream and not persist any data in ibc-go. // This can be triggered by throwing a panic in the contract } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return nil, errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } if res.Err != "" { // return error ACK with non-redacted contract message, state will be reverted return channeltypes.Acknowledgement{ @@ -188,13 +206,21 @@ func (k Keeper) OnAckPacket( env := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCPacketAck(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCPacketAck(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) } - return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res) + if res == nil { + // If this gets executed, that's a bug in wasmvm + return errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) + } + + return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok) } // OnTimeoutPacket calls the contract to let it know the packet was never received on the destination chain within @@ -215,14 +241,21 @@ func (k Keeper) OnTimeoutPacket( env := types.NewEnv(ctx, contractAddr) querier := k.newQueryHandler(ctx, contractAddr) - gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.IBCPacketTimeout(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization) + gasLeft := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.IBCPacketTimeout(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasLeft, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if res == nil { + // If this gets executed, that's a bug in wasmvm + return errorsmod.Wrap(types.ErrVMError, "internal wasmvm error") + } + if res.Err != "" { + return types.MarkErrorDeterministic(errorsmod.Wrap(types.ErrExecuteFailed, res.Err)) + } - return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res) + return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok) } func (k Keeper) handleIBCBasicContractResponse(ctx sdk.Context, addr sdk.AccAddress, id string, res *wasmvmtypes.IBCBasicResponse) error { diff --git a/x/wasm/keeper/relay_test.go b/x/wasm/keeper/relay_test.go index b1ee4f3438..8fbd83be3a 100644 --- a/x/wasm/keeper/relay_test.go +++ b/x/wasm/keeper/relay_test.go @@ -6,11 +6,13 @@ import ( "math" "testing" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" @@ -27,7 +29,7 @@ func TestOnOpenChannel(t *testing.T) { specs := map[string]struct { contractAddr sdk.AccAddress - contractGas sdk.Gas + contractGas storetypes.Gas contractErr error expGas uint64 expErr bool @@ -57,9 +59,9 @@ func TestOnOpenChannel(t *testing.T) { t.Run(name, func(t *testing.T) { myChannel := wasmvmtypes.IBCChannel{Version: "my test channel"} myMsg := wasmvmtypes.IBCChannelOpenMsg{OpenTry: &wasmvmtypes.IBCOpenTry{Channel: myChannel, CounterpartyVersion: "foo"}} - m.IBCChannelOpenFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { + m.IBCChannelOpenFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { assert.Equal(t, myMsg, msg) - return &wasmvmtypes.IBC3ChannelOpenResponse{}, spec.contractGas * types.DefaultGasMultiplier, spec.contractErr + return &wasmvmtypes.IBCChannelOpenResult{Ok: &wasmvmtypes.IBC3ChannelOpenResponse{}}, spec.contractGas * types.DefaultGasMultiplier, spec.contractErr } ctx, _ := parentCtx.CacheContext() @@ -81,7 +83,7 @@ func TestOnOpenChannel(t *testing.T) { } require.NoError(t, err) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expGas, ctx.GasMeter().GasConsumed()-before-storageCosts) }) } @@ -100,7 +102,7 @@ func TestOnConnectChannel(t *testing.T) { contractResp *wasmvmtypes.IBCBasicResponse contractErr error overwriteMessenger *wasmtesting.MockMessageHandler - expContractGas sdk.Gas + expContractGas storetypes.Gas expErr bool expEventTypes []string }{ @@ -154,9 +156,9 @@ func TestOnConnectChannel(t *testing.T) { t.Run(name, func(t *testing.T) { myChannel := wasmvmtypes.IBCChannel{Version: "my test channel"} myMsg := wasmvmtypes.IBCChannelConnectMsg{OpenConfirm: &wasmvmtypes.IBCOpenConfirm{Channel: myChannel}} - m.IBCChannelConnectFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { + m.IBCChannelConnectFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { assert.Equal(t, msg, myMsg) - return spec.contractResp, myContractGas * types.DefaultGasMultiplier, spec.contractErr + return &wasmvmtypes.IBCBasicResult{Ok: spec.contractResp}, myContractGas * types.DefaultGasMultiplier, spec.contractErr } ctx, _ := parentCtx.CacheContext() @@ -187,7 +189,7 @@ func TestOnConnectChannel(t *testing.T) { } require.NoError(t, err) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expContractGas, ctx.GasMeter().GasConsumed()-before-storageCosts) // verify msgs dispatched require.Len(t, *capturedMsgs, len(spec.contractResp.Messages)) @@ -212,7 +214,7 @@ func TestOnCloseChannel(t *testing.T) { contractResp *wasmvmtypes.IBCBasicResponse contractErr error overwriteMessenger *wasmtesting.MockMessageHandler - expContractGas sdk.Gas + expContractGas storetypes.Gas expErr bool expEventTypes []string }{ @@ -266,9 +268,9 @@ func TestOnCloseChannel(t *testing.T) { t.Run(name, func(t *testing.T) { myChannel := wasmvmtypes.IBCChannel{Version: "my test channel"} myMsg := wasmvmtypes.IBCChannelCloseMsg{CloseInit: &wasmvmtypes.IBCCloseInit{Channel: myChannel}} - m.IBCChannelCloseFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { + m.IBCChannelCloseFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { assert.Equal(t, msg, myMsg) - return spec.contractResp, myContractGas * types.DefaultGasMultiplier, spec.contractErr + return &wasmvmtypes.IBCBasicResult{Ok: spec.contractResp}, myContractGas * types.DefaultGasMultiplier, spec.contractErr } ctx, _ := parentCtx.CacheContext() @@ -297,7 +299,7 @@ func TestOnCloseChannel(t *testing.T) { } require.NoError(t, err) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expContractGas, ctx.GasMeter().GasConsumed()-before-storageCosts) // verify msgs dispatched require.Len(t, *capturedMsgs, len(spec.contractResp.Messages)) @@ -316,15 +318,15 @@ func TestOnRecvPacket(t *testing.T) { parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) specs := map[string]struct { contractAddr sdk.AccAddress contractResp *wasmvmtypes.IBCReceiveResult contractErr error overwriteMessenger *wasmtesting.MockMessageHandler - mockReplyFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) - expContractGas sdk.Gas + mockReplyFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) + expContractGas storetypes.Gas expAck []byte expErr bool expPanic bool @@ -417,15 +419,15 @@ func TestOnRecvPacket(t *testing.T) { }, "submessage reply can overwrite ack data": { contractAddr: example.Contract, - expContractGas: myContractGas + storageCosts, + expContractGas: types.DefaultInstanceCostDiscount + myContractGas + storageCosts, contractResp: &wasmvmtypes.IBCReceiveResult{ Ok: &wasmvmtypes.IBCReceiveResponse{ Acknowledgement: []byte("myAck"), Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyAlways, Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{}}}}, }, }, - mockReplyFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{Data: []byte("myBetterAck")}, 0, nil + mockReplyFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Data: []byte("myBetterAck")}}, 0, nil }, expAck: []byte("myBetterAck"), expEventTypes: []string{types.EventTypeReply}, @@ -481,7 +483,7 @@ func TestOnRecvPacket(t *testing.T) { require.Equal(t, spec.expAck, gotAck.Acknowledgement()) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expContractGas, ctx.GasMeter().GasConsumed()-before-storageCosts) // verify msgs dispatched on success/ err response @@ -512,7 +514,7 @@ func TestOnAckPacket(t *testing.T) { contractResp *wasmvmtypes.IBCBasicResponse contractErr error overwriteMessenger *wasmtesting.MockMessageHandler - expContractGas sdk.Gas + expContractGas storetypes.Gas expErr bool expEventTypes []string }{ @@ -565,9 +567,9 @@ func TestOnAckPacket(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { myAck := wasmvmtypes.IBCPacketAckMsg{Acknowledgement: wasmvmtypes.IBCAcknowledgement{Data: []byte("myAck")}} - m.IBCPacketAckFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { + m.IBCPacketAckFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { assert.Equal(t, myAck, msg) - return spec.contractResp, myContractGas * types.DefaultGasMultiplier, spec.contractErr + return &wasmvmtypes.IBCBasicResult{Ok: spec.contractResp}, myContractGas * types.DefaultGasMultiplier, spec.contractErr } ctx, _ := parentCtx.CacheContext() @@ -592,7 +594,7 @@ func TestOnAckPacket(t *testing.T) { } require.NoError(t, err) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expContractGas, ctx.GasMeter().GasConsumed()-before-storageCosts) // verify msgs dispatched require.Len(t, *capturedMsgs, len(spec.contractResp.Messages)) @@ -617,7 +619,7 @@ func TestOnTimeoutPacket(t *testing.T) { contractResp *wasmvmtypes.IBCBasicResponse contractErr error overwriteMessenger *wasmtesting.MockMessageHandler - expContractGas sdk.Gas + expContractGas storetypes.Gas expErr bool expEventTypes []string }{ @@ -685,9 +687,9 @@ func TestOnTimeoutPacket(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { myPacket := wasmvmtypes.IBCPacket{Data: []byte("my test packet")} - m.IBCPacketTimeoutFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { + m.IBCPacketTimeoutFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { assert.Equal(t, myPacket, msg.Packet) - return spec.contractResp, myContractGas * types.DefaultGasMultiplier, spec.contractErr + return &wasmvmtypes.IBCBasicResult{Ok: spec.contractResp}, myContractGas * types.DefaultGasMultiplier, spec.contractErr } ctx, _ := parentCtx.CacheContext() @@ -712,7 +714,7 @@ func TestOnTimeoutPacket(t *testing.T) { } require.NoError(t, err) // verify gas consumed - const storageCosts = sdk.Gas(2903) + const storageCosts = storetypes.Gas(2903) assert.Equal(t, spec.expContractGas, ctx.GasMeter().GasConsumed()-before-storageCosts) // verify msgs dispatched require.Len(t, *capturedMsgs, len(spec.contractResp.Messages)) diff --git a/x/wasm/keeper/snapshotter.go b/x/wasm/keeper/snapshotter.go index d527d44b2c..ab813cc0ec 100644 --- a/x/wasm/keeper/snapshotter.go +++ b/x/wasm/keeper/snapshotter.go @@ -5,12 +5,13 @@ import ( "io" "math" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + snapshot "cosmossdk.io/store/snapshots/types" + storetypes "cosmossdk.io/store/types" - snapshot "github.com/cosmos/cosmos-sdk/snapshots/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/ioutils" @@ -24,10 +25,10 @@ const SnapshotFormat = 1 type WasmSnapshotter struct { wasm *Keeper - cms sdk.MultiStore + cms storetypes.MultiStore } -func NewWasmSnapshotter(cms sdk.MultiStore, wasm *Keeper) *WasmSnapshotter { +func NewWasmSnapshotter(cms storetypes.MultiStore, wasm *Keeper) *WasmSnapshotter { return &WasmSnapshotter{ wasm: wasm, cms: cms, diff --git a/x/wasm/keeper/snapshotter_integration_test.go b/x/wasm/keeper/snapshotter_integration_test.go index d93d782282..ed9af49f99 100644 --- a/x/wasm/keeper/snapshotter_integration_test.go +++ b/x/wasm/keeper/snapshotter_integration_test.go @@ -5,13 +5,15 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,13 +30,13 @@ func TestSnapshotter(t *testing.T) { wasmFiles []string }{ "single contract": { - wasmFiles: []string{"./testdata/reflect.wasm"}, + wasmFiles: []string{"./testdata/reflect_1_5.wasm"}, }, "multiple contract": { - wasmFiles: []string{"./testdata/reflect.wasm", "./testdata/burner.wasm", "./testdata/reflect.wasm"}, + wasmFiles: []string{"./testdata/reflect_1_5.wasm", "./testdata/burner.wasm", "./testdata/reflect_1_5.wasm"}, }, "duplicate contracts": { - wasmFiles: []string{"./testdata/reflect.wasm", "./testdata/reflect.wasm"}, + wasmFiles: []string{"./testdata/reflect_1_5.wasm", "./testdata/reflect_1_5.wasm"}, }, } for name, spec := range specs { @@ -61,7 +63,9 @@ func TestSnapshotter(t *testing.T) { srcCodeIDToChecksum[codeID] = checksum } // create snapshot - srcWasmApp.Commit() + _, err := srcWasmApp.Commit() + require.NoError(t, err) + snapshotHeight := uint64(srcWasmApp.LastBlockHeight()) snapshot, err := srcWasmApp.SnapshotManager().Create(snapshotHeight) require.NoError(t, err) @@ -111,14 +115,13 @@ func TestSnapshotter(t *testing.T) { } func newWasmExampleApp(t *testing.T) (*app.WasmApp, sdk.AccAddress) { - t.Helper() senderPrivKey := ed25519.GenPrivKey() - pubKey, err := cryptocodec.ToTmPubKeyInterface(senderPrivKey.PubKey()) + pubKey, err := cryptocodec.ToCmtPubKeyInterface(senderPrivKey.PubKey()) require.NoError(t, err) senderAddr := senderPrivKey.PubKey().Address().Bytes() acc := authtypes.NewBaseAccount(senderAddr, senderPrivKey.PubKey(), 0, 0) - amount, ok := sdk.NewIntFromString("10000000000000000000") + amount, ok := sdkmath.NewIntFromString("10000000000000000000") require.True(t, ok) balance := banktypes.Balance{ diff --git a/x/wasm/keeper/staking_test.go b/x/wasm/keeper/staking_test.go index f7a1809c4f..292094a52e 100644 --- a/x/wasm/keeper/staking_test.go +++ b/x/wasm/keeper/staking_test.go @@ -5,17 +5,18 @@ import ( "os" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -24,11 +25,11 @@ import ( ) type StakingInitMsg struct { - Name string `json:"name"` - Symbol string `json:"symbol"` - Decimals uint8 `json:"decimals"` - Validator sdk.ValAddress `json:"validator"` - ExitTax sdk.Dec `json:"exit_tax"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Decimals uint8 `json:"decimals"` + Validator sdk.ValAddress `json:"validator"` + ExitTax sdkmath.LegacyDec `json:"exit_tax"` // MinWithdrawal is uint128 encoded as a string (use math.Int?) MinWithdrawl string `json:"min_withdrawal"` } @@ -81,12 +82,12 @@ type TokenInfoResponse struct { } type InvestmentResponse struct { - TokenSupply string `json:"token_supply"` - StakedTokens sdk.Coin `json:"staked_tokens"` - NominalValue sdk.Dec `json:"nominal_value"` - Owner sdk.AccAddress `json:"owner"` - Validator sdk.ValAddress `json:"validator"` - ExitTax sdk.Dec `json:"exit_tax"` + TokenSupply string `json:"token_supply"` + StakedTokens sdk.Coin `json:"staked_tokens"` + NominalValue sdkmath.LegacyDec `json:"nominal_value"` + Owner sdk.AccAddress `json:"owner"` + Validator sdk.ValAddress `json:"validator"` + ExitTax sdkmath.LegacyDec `json:"exit_tax"` // MinWithdrawl is uint128 encoded as a string (use math.Int?) MinWithdrawl string `json:"min_withdrawal"` } @@ -97,9 +98,9 @@ func TestInitializeStaking(t *testing.T) { valAddr := addValidator(t, ctx, stakingKeeper, k.Faucet, sdk.NewInt64Coin("stake", 1234567)) ctx = nextBlock(ctx, stakingKeeper) - v, found := stakingKeeper.GetValidator(ctx, valAddr) - assert.True(t, found) - assert.Equal(t, v.GetDelegatorShares(), sdk.NewDec(1234567)) + v, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + assert.Equal(t, v.GetDelegatorShares(), sdkmath.LegacyNewDec(1234567)) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000), sdk.NewInt64Coin("stake", 500000)) creator := k.Faucet.NewFundedRandomAccount(ctx, deposit...) @@ -117,7 +118,7 @@ func TestInitializeStaking(t *testing.T) { Symbol: "DRV", Decimals: 0, Validator: valAddr, - ExitTax: sdk.MustNewDecFromStr("0.10"), + ExitTax: sdkmath.LegacyMustNewDecFromStr("0.10"), MinWithdrawl: "100", } initBz, err := json.Marshal(&initMsg) @@ -137,7 +138,7 @@ func TestInitializeStaking(t *testing.T) { Symbol: "MISS", Decimals: 0, Validator: sdk.ValAddress(bob), - ExitTax: sdk.MustNewDecFromStr("0.10"), + ExitTax: sdkmath.LegacyMustNewDecFromStr("0.10"), MinWithdrawl: "100", } badBz, err := json.Marshal(&badInitMsg) @@ -148,7 +149,7 @@ func TestInitializeStaking(t *testing.T) { // no changes to bonding shares val, _ := stakingKeeper.GetValidator(ctx, valAddr) - assert.Equal(t, val.GetDelegatorShares(), sdk.NewDec(1234567)) + assert.Equal(t, val.GetDelegatorShares(), sdkmath.LegacyNewDec(1234567)) } type initInfo struct { @@ -167,16 +168,15 @@ type initInfo struct { } func initializeStaking(t *testing.T) initInfo { - t.Helper() ctx, k := CreateTestInput(t, false, AvailableCapabilities) accKeeper, stakingKeeper, keeper, bankKeeper := k.AccountKeeper, k.StakingKeeper, k.WasmKeeper, k.BankKeeper valAddr := addValidator(t, ctx, stakingKeeper, k.Faucet, sdk.NewInt64Coin("stake", 1000000)) ctx = nextBlock(ctx, stakingKeeper) - v, found := stakingKeeper.GetValidator(ctx, valAddr) - assert.True(t, found) - assert.Equal(t, v.GetDelegatorShares(), sdk.NewDec(1000000)) + v, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + assert.Equal(t, v.GetDelegatorShares(), sdkmath.LegacyNewDec(1000000)) assert.Equal(t, v.Status, stakingtypes.Bonded) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000), sdk.NewInt64Coin("stake", 500000)) @@ -195,7 +195,7 @@ func initializeStaking(t *testing.T) initInfo { Symbol: "DRV", Decimals: 0, Validator: valAddr, - ExitTax: sdk.MustNewDecFromStr("0.10"), + ExitTax: sdkmath.LegacyMustNewDecFromStr("0.10"), MinWithdrawl: "100", } initBz, err := json.Marshal(&initMsg) @@ -226,8 +226,8 @@ func TestBonding(t *testing.T) { keeper, stakingKeeper, accKeeper, bankKeeper := initInfo.wasmKeeper, initInfo.stakingKeeper, initInfo.accKeeper, initInfo.bankKeeper // initial checks of bonding state - val, found := stakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) initPower := val.GetDelegatorShares() // bob has 160k, putting 80k into the contract @@ -255,12 +255,12 @@ func TestBonding(t *testing.T) { // make sure the proper number of tokens have been bonded val, _ = stakingKeeper.GetValidator(ctx, valAddr) finalPower := val.GetDelegatorShares() - assert.Equal(t, sdk.NewInt(80000), finalPower.Sub(initPower).TruncateInt()) + assert.Equal(t, sdkmath.NewInt(80000), finalPower.Sub(initPower).TruncateInt()) // check the delegation itself - d, found := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) - require.True(t, found) - assert.Equal(t, d.Shares, sdk.MustNewDecFromStr("80000")) + d, err := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) + require.NoError(t, err) + assert.Equal(t, d.Shares, sdkmath.LegacyMustNewDecFromStr("80000")) // check we have the desired balance assertBalance(t, ctx, keeper, contractAddr, bob, "80000") @@ -274,8 +274,8 @@ func TestUnbonding(t *testing.T) { keeper, stakingKeeper, accKeeper, bankKeeper := initInfo.wasmKeeper, initInfo.stakingKeeper, initInfo.accKeeper, initInfo.bankKeeper // initial checks of bonding state - val, found := stakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) initPower := val.GetDelegatorShares() // bob has 160k, putting 80k into the contract @@ -313,16 +313,16 @@ func TestUnbonding(t *testing.T) { // make sure the proper number of tokens have been bonded (80k - 27k = 53k) val, _ = stakingKeeper.GetValidator(ctx, valAddr) finalPower := val.GetDelegatorShares() - assert.Equal(t, sdk.NewInt(53000), finalPower.Sub(initPower).TruncateInt(), finalPower.String()) + assert.Equal(t, sdkmath.NewInt(53000), finalPower.Sub(initPower).TruncateInt(), finalPower.String()) // check the delegation itself - d, found := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) - require.True(t, found) - assert.Equal(t, d.Shares, sdk.MustNewDecFromStr("53000")) + d, err := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) + require.NoError(t, err) + assert.Equal(t, d.Shares, sdkmath.LegacyMustNewDecFromStr("53000")) // check there is unbonding in progress - un, found := stakingKeeper.GetUnbondingDelegation(ctx, contractAddr, valAddr) - require.True(t, found) + un, err := stakingKeeper.GetUnbondingDelegation(ctx, contractAddr, valAddr) + require.NoError(t, err) require.Equal(t, 1, len(un.Entries)) assert.Equal(t, "27000", un.Entries[0].Balance.String()) @@ -340,10 +340,10 @@ func TestReinvest(t *testing.T) { distKeeper := initInfo.distKeeper // initial checks of bonding state - val, found := stakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) initPower := val.GetDelegatorShares() - assert.Equal(t, val.Tokens, sdk.NewInt(1000000), "%s", val.Tokens) + assert.Equal(t, val.Tokens, sdkmath.NewInt(1000000), "%s", val.Tokens) // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) @@ -380,19 +380,19 @@ func TestReinvest(t *testing.T) { checkAccount(t, ctx, accKeeper, bankKeeper, bob, funds) // check the delegation itself - d, found := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) - require.True(t, found) + d, err := stakingKeeper.GetDelegation(ctx, contractAddr, valAddr) + require.NoError(t, err) // we started with 200k and added 36k - assert.Equal(t, d.Shares, sdk.MustNewDecFromStr("236000")) + assert.Equal(t, d.Shares, sdkmath.LegacyMustNewDecFromStr("236000")) // make sure the proper number of tokens have been bonded (80k + 40k = 120k) val, _ = stakingKeeper.GetValidator(ctx, valAddr) finalPower := val.GetDelegatorShares() - assert.Equal(t, sdk.NewInt(236000), finalPower.Sub(initPower).TruncateInt(), finalPower.String()) + assert.Equal(t, sdkmath.NewInt(236000), finalPower.Sub(initPower).TruncateInt(), finalPower.String()) // check there is no unbonding in progress - un, found := stakingKeeper.GetUnbondingDelegation(ctx, contractAddr, valAddr) - assert.False(t, found, "%#v", un) + _, err = stakingKeeper.GetUnbondingDelegation(ctx, contractAddr, valAddr) + require.ErrorIs(t, stakingtypes.ErrNoUnbondingDelegation, err) // check we have the desired balance assertBalance(t, ctx, keeper, contractAddr, bob, "200000") @@ -409,9 +409,9 @@ func TestQueryStakingInfo(t *testing.T) { distKeeper := initInfo.distKeeper // initial checks of bonding state - val, found := stakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) - assert.Equal(t, sdk.NewInt(1000000), val.Tokens) + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + assert.Equal(t, sdkmath.NewInt(1000000), val.Tokens) // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) @@ -434,7 +434,8 @@ func TestQueryStakingInfo(t *testing.T) { setValidatorRewards(ctx, stakingKeeper, distKeeper, valAddr, "240000") // see what the current rewards are - origReward := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + origReward, err := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + require.NoError(t, err) // STEP 2: Prepare the mask contract deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -575,7 +576,8 @@ func TestQueryStakingInfo(t *testing.T) { require.Equal(t, wasmvmtypes.NewCoin(36000, "stake"), delInfo2.AccumulatedRewards[0]) // ensure rewards did not change when querying (neither amount nor period) - finalReward := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + finalReward, err := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + require.NoError(t, err) require.Equal(t, origReward, finalReward) } @@ -587,9 +589,9 @@ func TestQueryStakingPlugin(t *testing.T) { distKeeper := initInfo.distKeeper // initial checks of bonding state - val, found := stakingKeeper.GetValidator(ctx, valAddr) - require.True(t, found) - assert.Equal(t, sdk.NewInt(1000000), val.Tokens) + val, err := stakingKeeper.GetValidator(ctx, valAddr) + require.NoError(t, err) + assert.Equal(t, sdkmath.NewInt(1000000), val.Tokens) // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) @@ -612,7 +614,8 @@ func TestQueryStakingPlugin(t *testing.T) { setValidatorRewards(ctx, stakingKeeper, distKeeper, valAddr, "240000") // see what the current rewards are - origReward := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + origReward, err := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + require.NoError(t, err) // Step 2: Try out the query plugins query := wasmvmtypes.StakingQuery{ @@ -641,18 +644,31 @@ func TestQueryStakingPlugin(t *testing.T) { require.Equal(t, wasmvmtypes.NewCoin(36000, "stake"), delInfo.AccumulatedRewards[0]) // ensure rewards did not change when querying (neither amount nor period) - finalReward := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + finalReward, err := distKeeper.GetValidatorCurrentRewards(ctx, valAddr) + require.NoError(t, err) require.Equal(t, origReward, finalReward) + + // with empty delegation (regression to ensure api stability) + query = wasmvmtypes.StakingQuery{ + Delegation: &wasmvmtypes.DelegationQuery{ + Delegator: RandomBech32AccountAddress(t), + Validator: valAddr.String(), + }, + } + raw, err = StakingQuerier(stakingKeeper, distributionkeeper.NewQuerier(distKeeper))(ctx, &query) + require.NoError(t, err) + var res2 wasmvmtypes.DelegationResponse + mustUnmarshal(t, raw, &res2) + assert.Empty(t, res2.Delegation) } // adds a few validators and returns a list of validators that are registered func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper, faucet *TestFaucet, value sdk.Coin) sdk.ValAddress { - t.Helper() owner := faucet.NewFundedRandomAccount(ctx, value) privKey := secp256k1.GenPrivKey() pubKey := privKey.PubKey() - addr := sdk.ValAddress(pubKey.Address()) + valAddr := sdk.ValAddress(owner) pkAny, err := codectypes.NewAnyWithValue(pubKey) require.NoError(t, err) @@ -661,43 +677,50 @@ func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper *stakingkeeper.Ke Moniker: "Validator power", }, Commission: stakingtypes.CommissionRates{ - Rate: sdk.MustNewDecFromStr("0.1"), - MaxRate: sdk.MustNewDecFromStr("0.2"), - MaxChangeRate: sdk.MustNewDecFromStr("0.01"), + Rate: sdkmath.LegacyMustNewDecFromStr("0.1"), + MaxRate: sdkmath.LegacyMustNewDecFromStr("0.2"), + MaxChangeRate: sdkmath.LegacyMustNewDecFromStr("0.01"), }, - MinSelfDelegation: sdk.OneInt(), + MinSelfDelegation: sdkmath.OneInt(), DelegatorAddress: owner.String(), - ValidatorAddress: addr.String(), + ValidatorAddress: valAddr.String(), Pubkey: pkAny, Value: value, } - _, err = stakingkeeper.NewMsgServerImpl(stakingKeeper).CreateValidator(sdk.WrapSDKContext(ctx), msg) + _, err = stakingkeeper.NewMsgServerImpl(stakingKeeper).CreateValidator(ctx, msg) require.NoError(t, err) - return addr + return valAddr } // this will commit the current set, update the block height and set historic info // basically, letting two blocks pass func nextBlock(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper) sdk.Context { - staking.EndBlocker(ctx, stakingKeeper) + if _, err := stakingKeeper.EndBlocker(ctx); err != nil { + panic(err) + } ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) - staking.BeginBlocker(ctx, stakingKeeper) + _ = stakingKeeper.BeginBlocker(ctx) return ctx } func setValidatorRewards(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper, valAddr sdk.ValAddress, reward string) { // allocate some rewards - vali := stakingKeeper.Validator(ctx, valAddr) - amount, err := sdk.NewDecFromStr(reward) + vali, err := stakingKeeper.Validator(ctx, valAddr) + if err != nil { + panic(err) + } + amount, err := sdkmath.LegacyNewDecFromStr(reward) if err != nil { panic(err) } payout := sdk.DecCoins{{Denom: "stake", Amount: amount}} - distKeeper.AllocateTokensToValidator(ctx, vali, payout) + err = distKeeper.AllocateTokensToValidator(ctx, vali, payout) + if err != nil { + panic(err) + } } func assertBalance(t *testing.T, ctx sdk.Context, keeper Keeper, contract, addr sdk.AccAddress, expected string) { - t.Helper() query := StakingQueryMsg{ Balance: &addressQuery{ Address: addr, @@ -714,7 +737,6 @@ func assertBalance(t *testing.T, ctx sdk.Context, keeper Keeper, contract, addr } func assertClaims(t *testing.T, ctx sdk.Context, keeper Keeper, contract, addr sdk.AccAddress, expected string) { - t.Helper() query := StakingQueryMsg{ Claims: &addressQuery{ Address: addr, @@ -731,7 +753,6 @@ func assertClaims(t *testing.T, ctx sdk.Context, keeper Keeper, contract, addr s } func assertSupply(t *testing.T, ctx sdk.Context, keeper Keeper, contract sdk.AccAddress, expectedIssued string, expectedBonded sdk.Coin) { - t.Helper() query := StakingQueryMsg{Investment: &struct{}{}} queryBz, err := json.Marshal(query) require.NoError(t, err) diff --git a/x/wasm/keeper/submsg_test.go b/x/wasm/keeper/submsg_test.go index fe301dc37b..971f0d9648 100644 --- a/x/wasm/keeper/submsg_test.go +++ b/x/wasm/keeper/submsg_test.go @@ -7,12 +7,13 @@ import ( "strconv" "testing" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,7 +27,7 @@ import ( // Try a simple send, no gas limit to for a sanity check before trying table tests func TestDispatchSubMsgSuccessCase(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, ReflectFeatures) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -111,9 +112,9 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { subGasLimit := uint64(300_000) // prep - create one chain and upload the code - ctx, keepers := CreateTestInput(t, false, ReflectFeatures) - ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) - ctx = ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter()) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities) + ctx = ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + ctx = ctx.WithBlockGasMeter(storetypes.NewInfiniteGasMeter()) keeper := keepers.WasmKeeper contractStart := sdk.NewCoins(sdk.NewInt64Coin(fundedDenom, int64(fundedAmount))) uploader := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart.Add(contractStart...)...) @@ -193,14 +194,12 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { assertReturnedEvents := func(expectedEvents int) assertion { return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - t.Helper() require.Len(t, response.Ok.Events, expectedEvents) } } assertGasUsed := func(minGas, maxGas uint64) assertion { return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - t.Helper() gasUsed := ctx.GasMeter().GasConsumed() assert.True(t, gasUsed >= minGas, "Used %d gas (less than expected %d)", gasUsed, minGas) assert.True(t, gasUsed <= maxGas, "Used %d gas (more than expected %d)", gasUsed, maxGas) @@ -209,13 +208,11 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { assertErrorString := func(shouldContain string) assertion { return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - t.Helper() assert.Contains(t, response.Err, shouldContain) } } assertGotContractAddr := func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - t.Helper() // should get the events emitted on new contract event := response.Ok.Events[0] require.Equal(t, event.Type, "instantiate") @@ -246,14 +243,14 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { "send tokens": { submsgID: 5, msg: validBankSend, - resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(102000, 103000)}, + resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(110_000, 111_000)}, }, "not enough tokens": { submsgID: 6, msg: invalidBankSend, subMsgError: true, // uses less gas than the send tokens (cost of bank transfer) - resultAssertions: []assertion{assertGasUsed(76000, 79000), assertErrorString("codespace: sdk, code: 5")}, + resultAssertions: []assertion{assertGasUsed(78_000, 81_000), assertErrorString("codespace: sdk, code: 5")}, }, "out of gas panic with no gas limit": { submsgID: 7, @@ -266,7 +263,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { msg: validBankSend, gasLimit: &subGasLimit, // uses same gas as call without limit (note we do not charge the 40k on reply) - resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(102000, 103000)}, + resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(110_000, 112_000)}, }, "not enough tokens with limit": { submsgID: 16, @@ -274,7 +271,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { subMsgError: true, gasLimit: &subGasLimit, // uses same gas as call without limit (note we do not charge the 40k on reply) - resultAssertions: []assertion{assertGasUsed(77700, 77800), assertErrorString("codespace: sdk, code: 5")}, + resultAssertions: []assertion{assertGasUsed(78_000, 81_000), assertErrorString("codespace: sdk, code: 5")}, }, "out of gas caught with gas limit": { submsgID: 17, @@ -282,7 +279,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { subMsgError: true, gasLimit: &subGasLimit, // uses all the subGasLimit, plus the 52k or so for the main contract - resultAssertions: []assertion{assertGasUsed(subGasLimit+73000, subGasLimit+74000), assertErrorString("codespace: sdk, code: 11")}, + resultAssertions: []assertion{assertGasUsed(subGasLimit+75_000, subGasLimit+77_000), assertErrorString("codespace: sdk, code: 11")}, }, "instantiate contract gets address in data and events": { submsgID: 21, @@ -312,12 +309,12 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { reflectSendBz, err := json.Marshal(reflectSend) require.NoError(t, err) - execCtx := ctx.WithGasMeter(sdk.NewGasMeter(ctxGasLimit)) + execCtx := ctx.WithGasMeter(storetypes.NewGasMeter(ctxGasLimit)) defer func() { if tc.isOutOfGasPanic { r := recover() require.NotNil(t, r, "expected panic") - if _, ok := r.(sdk.ErrorOutOfGas); !ok { + if _, ok := r.(storetypes.ErrorOutOfGas); !ok { t.Fatalf("Expected OutOfGas panic, got: %#v\n", r) } } @@ -370,7 +367,7 @@ func TestDispatchSubMsgEncodeToNoSdkMsg(t *testing.T) { Bank: nilEncoder, } - ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageHandler(NewSDKMessageHandler(nil, customEncoders))) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities, WithMessageHandler(NewSDKMessageHandler(MakeTestCodec(t), nil, customEncoders))) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -436,7 +433,7 @@ func TestDispatchSubMsgEncodeToNoSdkMsg(t *testing.T) { // Try a simple send, no gas limit to for a sanity check before trying table tests func TestDispatchSubMsgConditionalReplyOn(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, ReflectFeatures) + ctx, keepers := CreateTestInput(t, false, ReflectCapabilities) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -566,20 +563,22 @@ func TestInstantiateGovSubMsgAuthzPropagated(t *testing.T) { wasmtesting.MakeInstantiable(mockWasmVM) var instanceLevel int // mock wasvm to return new instantiate msgs with the response - mockWasmVM.InstantiateFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + mockWasmVM.InstantiateFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if instanceLevel == 2 { - return &wasmvmtypes.Response{}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 0, nil } instanceLevel++ submsgPayload := fmt.Sprintf(`{"sub":%d}`, instanceLevel) - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - { - ReplyOn: wasmvmtypes.ReplyNever, - Msg: wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{Instantiate: &wasmvmtypes.InstantiateMsg{ - CodeID: 1, Msg: []byte(submsgPayload), Label: "from sub-msg", - }}, + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + { + ReplyOn: wasmvmtypes.ReplyNever, + Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{Instantiate: &wasmvmtypes.InstantiateMsg{ + CodeID: 1, Msg: []byte(submsgPayload), Label: "from sub-msg", + }}, + }, }, }, }, @@ -653,22 +652,24 @@ func TestMigrateGovSubMsgAuthzPropagated(t *testing.T) { var instanceLevel int // mock wasvm to return new migrate msgs with the response - mockWasmVM.MigrateFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + mockWasmVM.MigrateFn = func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if instanceLevel == 1 { - return &wasmvmtypes.Response{}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 0, nil } instanceLevel++ submsgPayload := fmt.Sprintf(`{"sub":%d}`, instanceLevel) - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - { - ReplyOn: wasmvmtypes.ReplyNever, - Msg: wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{Migrate: &wasmvmtypes.MigrateMsg{ - ContractAddr: example1.Contract.String(), - NewCodeID: example2.CodeID, - Msg: []byte(submsgPayload), - }}, + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + { + ReplyOn: wasmvmtypes.ReplyNever, + Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{Migrate: &wasmvmtypes.MigrateMsg{ + ContractAddr: example1.Contract.String(), + NewCodeID: example2.CodeID, + Msg: []byte(submsgPayload), + }}, + }, }, }, }, diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 1c8a415ffc..dbf52df037 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -9,33 +9,44 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" - "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/libs/rand" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/evidence" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" @@ -43,17 +54,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/crisis" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" "github.com/cosmos/cosmos-sdk/x/distribution" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" @@ -70,10 +75,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" wasmappparams "github.com/CosmWasm/wasmd/app/params" "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" @@ -90,8 +91,6 @@ var moduleBasics = module.NewBasicManager( distribution.AppModuleBasic{}, gov.NewAppModuleBasic([]govclient.ProposalHandler{ paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, }), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -103,10 +102,8 @@ var moduleBasics = module.NewBasicManager( vesting.AppModuleBasic{}, ) -func MakeTestCodec(tb testing.TB) codec.Codec { - tb.Helper() - - return MakeEncodingConfig(tb).Codec +func MakeTestCodec(t testing.TB) codec.Codec { + return MakeEncodingConfig(t).Codec } func MakeEncodingConfig(_ testing.TB) wasmappparams.EncodingConfig { @@ -143,11 +140,9 @@ type TestFaucet struct { minterModuleName string } -func NewTestFaucet(tb testing.TB, ctx sdk.Context, bankKeeper bankkeeper.Keeper, minterModuleName string, initialAmount ...sdk.Coin) *TestFaucet { - tb.Helper() - - require.NotEmpty(tb, initialAmount) - r := &TestFaucet{t: tb, bankKeeper: bankKeeper, minterModuleName: minterModuleName} +func NewTestFaucet(t testing.TB, ctx sdk.Context, bankKeeper bankkeeper.Keeper, minterModuleName string, initialAmount ...sdk.Coin) *TestFaucet { + require.NotEmpty(t, initialAmount) + r := &TestFaucet{t: t, bankKeeper: bankKeeper, minterModuleName: minterModuleName} _, addr := keyPubAddr() r.sender = addr r.Mint(ctx, addr, initialAmount...) @@ -195,40 +190,34 @@ type TestKeepers struct { Router MessageRouter EncodingConfig wasmappparams.EncodingConfig Faucet *TestFaucet - MultiStore sdk.CommitMultiStore + MultiStore storetypes.CommitMultiStore ScopedWasmKeeper capabilitykeeper.ScopedKeeper WasmStoreKey *storetypes.KVStoreKey } // CreateDefaultTestInput common settings for CreateTestInput -func CreateDefaultTestInput(tb testing.TB) (sdk.Context, TestKeepers) { - tb.Helper() - - return CreateTestInput(tb, false, "staking") +func CreateDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers) { + return CreateTestInput(t, false, []string{"staking"}) } // CreateTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) -func CreateTestInput(tb testing.TB, isCheckTx bool, availableCapabilities string, opts ...Option) (sdk.Context, TestKeepers) { - tb.Helper() - +func CreateTestInput(t testing.TB, isCheckTx bool, availableCapabilities []string, opts ...Option) (sdk.Context, TestKeepers) { // Load default wasm config - return createTestInput(tb, isCheckTx, availableCapabilities, types.DefaultWasmConfig(), dbm.NewMemDB(), opts...) + return createTestInput(t, isCheckTx, availableCapabilities, types.DefaultWasmConfig(), dbm.NewMemDB(), opts...) } // encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) func createTestInput( - tb testing.TB, + t testing.TB, isCheckTx bool, - availableCapabilities string, + availableCapabilities []string, wasmConfig types.WasmConfig, db dbm.DB, opts ...Option, ) (sdk.Context, TestKeepers) { - tb.Helper() - - tempDir := tb.TempDir() + tempDir := t.TempDir() - keys := sdk.NewKVStoreKeys( + keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distributiontypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, @@ -236,21 +225,22 @@ func createTestInput( capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey, types.StoreKey, ) - ms := store.NewCommitMultiStore(db) + logger := log.NewTestLogger(t) + ms := store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics()) for _, v := range keys { ms.MountStoreWithDB(v, storetypes.StoreTypeIAVL, db) } - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) for _, v := range tkeys { ms.MountStoreWithDB(v, storetypes.StoreTypeTransient, db) } - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) for _, v := range memKeys { ms.MountStoreWithDB(v, storetypes.StoreTypeMemory, db) } - require.NoError(tb, ms.LoadLatestVersion()) + require.NoError(t, ms.LoadLatestVersion()) ctx := sdk.NewContext(ms, tmproto.Header{ Height: 1234567, @@ -258,14 +248,14 @@ func createTestInput( }, isCheckTx, log.NewNopLogger()) ctx = types.WithTXCounter(ctx, 0) - encodingConfig := MakeEncodingConfig(tb) + encodingConfig := MakeEncodingConfig(t) appCodec, legacyAmino := encodingConfig.Codec, encodingConfig.Amino paramsKeeper := paramskeeper.NewKeeper( appCodec, legacyAmino, keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], + tkeys[paramstypes.StoreKey], ) for _, m := range []string{ authtypes.ModuleName, @@ -285,43 +275,7 @@ func createTestInput( } subspace := func(m string) paramstypes.Subspace { r, ok := paramsKeeper.GetSubspace(m) - require.True(tb, ok) - - var keyTable paramstypes.KeyTable - switch r.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() - case minttypes.ModuleName: - keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - case distributiontypes.ModuleName: - keyTable = distributiontypes.ParamKeyTable() //nolint:staticcheck - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - // ibc types - case ibctransfertypes.ModuleName: - keyTable = ibctransfertypes.ParamKeyTable() - case icahosttypes.SubModuleName: - keyTable = icahosttypes.ParamKeyTable() - case icacontrollertypes.SubModuleName: - keyTable = icacontrollertypes.ParamKeyTable() - // wasm - case types.ModuleName: - keyTable = types.ParamKeyTable() //nolint:staticcheck - default: - return r - } - - if !r.HasKeyTable() { - r = r.WithKeyTable(keyTable) - } + require.True(t, ok) return r } maccPerms := map[string][]string{ // module account permissions @@ -334,70 +288,72 @@ func createTestInput( ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, types.ModuleName: {authtypes.Burner}, } + accountKeeper := authkeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], // target store - authtypes.ProtoBaseAccount, // prototype + runtime.NewKVStoreService(keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, maccPerms, + authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, - authtypes.NewModuleAddress(authtypes.ModuleName).String(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) blockedAddrs := make(map[string]bool) for acc := range maccPerms { blockedAddrs[authtypes.NewModuleAddress(acc).String()] = true } - - require.NoError(tb, accountKeeper.SetParams(ctx, authtypes.DefaultParams())) + require.NoError(t, accountKeeper.Params.Set(ctx, authtypes.DefaultParams())) bankKeeper := bankkeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddrs, authtypes.NewModuleAddress(banktypes.ModuleName).String(), + logger, ) - require.NoError(tb, bankKeeper.SetParams(ctx, banktypes.DefaultParams())) + require.NoError(t, bankKeeper.SetParams(ctx, banktypes.DefaultParams())) stakingKeeper := stakingkeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authtypes.NewModuleAddress(stakingtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), ) stakingtypes.DefaultParams() - require.NoError(tb, stakingKeeper.SetParams(ctx, TestingStakeParams)) + require.NoError(t, stakingKeeper.SetParams(ctx, TestingStakeParams)) distKeeper := distributionkeeper.NewKeeper( appCodec, - keys[distributiontypes.StoreKey], + runtime.NewKVStoreService(keys[distributiontypes.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(distributiontypes.ModuleName).String(), ) - require.NoError(tb, distKeeper.SetParams(ctx, distributiontypes.DefaultParams())) + require.NoError(t, distKeeper.Params.Set(ctx, distributiontypes.DefaultParams())) + require.NoError(t, distKeeper.FeePool.Set(ctx, distributiontypes.InitialFeePool())) stakingKeeper.SetHooks(distKeeper.Hooks()) - // set genesis items required for distribution - distKeeper.SetFeePool(ctx, distributiontypes.InitialFeePool()) - upgradeKeeper := upgradekeeper.NewKeeper( map[int64]bool{}, - keys[upgradetypes.StoreKey], + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, tempDir, nil, authtypes.NewModuleAddress(upgradetypes.ModuleName).String(), ) - faucet := NewTestFaucet(tb, ctx, bankKeeper, minttypes.ModuleName, sdk.NewCoin("stake", sdk.NewInt(100_000_000_000))) + faucet := NewTestFaucet(t, ctx, bankKeeper, minttypes.ModuleName, sdk.NewCoin("stake", sdkmath.NewInt(100_000_000_000))) // set some funds ot pay out validatores, based on code from: // https://github.com/cosmos/cosmos-sdk/blob/fea231556aee4d549d7551a6190389c4328194eb/x/distribution/keeper/keeper_test.go#L50-L57 distrAcc := distKeeper.GetDistributionAccount(ctx) - faucet.Fund(ctx, distrAcc.GetAddress(), sdk.NewCoin("stake", sdk.NewInt(2000000))) + faucet.Fund(ctx, distrAcc.GetAddress(), sdk.NewCoin("stake", sdkmath.NewInt(2000000))) accountKeeper.SetModuleAccount(ctx, distrAcc) capabilityKeeper := capabilitykeeper.NewKeeper( @@ -415,8 +371,8 @@ func createTestInput( stakingKeeper, upgradeKeeper, scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - querier := baseapp.NewGRPCQueryRouter() querier.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) msgRouter := baseapp.NewMsgServiceRouter() @@ -427,14 +383,14 @@ func createTestInput( keeper := NewKeeper( appCodec, - keys[types.StoreKey], + runtime.NewKVStoreService(keys[types.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, distributionkeeper.NewQuerier(distKeeper), ibcKeeper.ChannelKeeper, // ICS4Wrapper ibcKeeper.ChannelKeeper, - &ibcKeeper.PortKeeper, + ibcKeeper.PortKeeper, scopedWasmKeeper, wasmtesting.MockIBCTransferKeeper{}, msgRouter, @@ -445,23 +401,23 @@ func createTestInput( authtypes.NewModuleAddress(govtypes.ModuleName).String(), opts..., ) - require.NoError(tb, keeper.SetParams(ctx, types.DefaultParams())) + require.NoError(t, keeper.SetParams(ctx, types.DefaultParams())) // add wasm handler so we can loop-back (contracts calling contracts) contractKeeper := NewDefaultPermissionKeeper(&keeper) govKeeper := govkeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], + runtime.NewKVStoreService(keys[govtypes.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, + distKeeper, msgRouter, govtypes.DefaultConfig(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - require.NoError(tb, govKeeper.SetParams(ctx, govv1.DefaultParams())) - govKeeper.SetProposalID(ctx, 1) + require.NoError(t, govKeeper.Params.Set(ctx, govv1.DefaultParams())) am := module.NewManager( // minimal module set that we use for message/ query tests bank.NewAppModule(appCodec, bankKeeper, accountKeeper, subspace(banktypes.ModuleName)), @@ -469,9 +425,9 @@ func createTestInput( distribution.NewAppModule(appCodec, distKeeper, accountKeeper, bankKeeper, stakingKeeper, subspace(distributiontypes.ModuleName)), gov.NewAppModule(appCodec, govKeeper, accountKeeper, bankKeeper, subspace(govtypes.ModuleName)), ) - am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier)) + am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier)) //nolint:errcheck types.RegisterMsgServer(msgRouter, NewMsgServerImpl(&keeper)) - types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit)) + types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, runtime.NewKVStoreService(keys[types.ModuleName]), keeper, keeper.queryGasLimit)) keepers := TestKeepers{ AccountKeeper: accountKeeper, @@ -514,7 +470,7 @@ var _ MessageRouter = MessageRouterFunc(nil) type MessageRouterFunc func(ctx sdk.Context, req sdk.Msg) (*sdk.Result, error) -func (m MessageRouterFunc) Handler(msg sdk.Msg) baseapp.MsgServiceHandler { +func (m MessageRouterFunc) Handler(_ sdk.Msg) baseapp.MsgServiceHandler { return m } @@ -587,10 +543,8 @@ func DeterministicAccountAddress(_ testing.TB, v byte) sdk.AccAddress { return bytes.Repeat([]byte{v}, address.Len) } -func RandomBech32AccountAddress(tb testing.TB) string { - tb.Helper() - - return RandomAccountAddress(tb).String() +func RandomBech32AccountAddress(t testing.TB) string { + return RandomAccountAddress(t).String() } type ExampleContract struct { @@ -601,47 +555,35 @@ type ExampleContract struct { Checksum []byte } -func StoreHackatomExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { - tb.Helper() - - return StoreExampleContractWasm(tb, ctx, keepers, testdata.HackatomContractWasm()) +func StoreHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { + return StoreExampleContractWasm(t, ctx, keepers, testdata.HackatomContractWasm()) } -func StoreBurnerExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { - tb.Helper() - - return StoreExampleContractWasm(tb, ctx, keepers, testdata.BurnerContractWasm()) +func StoreBurnerExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { + return StoreExampleContractWasm(t, ctx, keepers, testdata.BurnerContractWasm()) } -func StoreIBCReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { - tb.Helper() - - return StoreExampleContractWasm(tb, ctx, keepers, testdata.IBCReflectContractWasm()) +func StoreIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { + return StoreExampleContractWasm(t, ctx, keepers, testdata.IBCReflectContractWasm()) } -func StoreReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { - tb.Helper() - - return StoreExampleContractWasm(tb, ctx, keepers, testdata.ReflectContractWasm()) +func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { + return StoreExampleContractWasm(t, ctx, keepers, testdata.ReflectContractWasm()) } -func StoreExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract { - tb.Helper() - +func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract { wasmCode, err := os.ReadFile(wasmFile) - require.NoError(tb, err) - return StoreExampleContractWasm(tb, ctx, keepers, wasmCode) + require.NoError(t, err) + return StoreExampleContractWasm(t, ctx, keepers, wasmCode) } -func StoreExampleContractWasm(tb testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract { - tb.Helper() - +func StoreExampleContractWasm(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract { anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000)) creator, creatorAddr := keyPubAddr() - fundAccounts(tb, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) + fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) codeID, _, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil) - require.NoError(tb, err) + require.NoError(t, err) hash := keepers.WasmKeeper.GetCodeInfo(ctx, codeID).CodeHash return ExampleContract{anyAmount, creator, creatorAddr, codeID, hash} } @@ -654,11 +596,11 @@ type ExampleContractInstance struct { } // SeedNewContractInstance sets the mock WasmEngine in keeper and calls store + instantiate to init the contract's metadata -func SeedNewContractInstance(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmEngine) ExampleContractInstance { - tb.Helper() - exampleContract := StoreRandomContract(tb, ctx, keepers, mock) +func SeedNewContractInstance(t testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmEngine) ExampleContractInstance { + t.Helper() + exampleContract := StoreRandomContract(t, ctx, keepers, mock) contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, exampleContract.CodeID, exampleContract.CreatorAddr, exampleContract.CreatorAddr, []byte(`{}`), "", nil) - require.NoError(tb, err) + require.NoError(t, err) return ExampleContractInstance{ ExampleContract: exampleContract, Contract: contractAddr, @@ -666,26 +608,24 @@ func SeedNewContractInstance(tb testing.TB, ctx sdk.Context, keepers TestKeepers } // StoreRandomContract sets the mock WasmEngine in keeper and calls store -func StoreRandomContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmEngine) ExampleContract { - tb.Helper() - - return StoreRandomContractWithAccessConfig(tb, ctx, keepers, mock, nil) +func StoreRandomContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmEngine) ExampleContract { + return StoreRandomContractWithAccessConfig(t, ctx, keepers, mock, nil) } func StoreRandomContractWithAccessConfig( - tb testing.TB, ctx sdk.Context, + t testing.TB, ctx sdk.Context, keepers TestKeepers, mock types.WasmEngine, cfg *types.AccessConfig, ) ExampleContract { - tb.Helper() + t.Helper() anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000)) creator, creatorAddr := keyPubAddr() - fundAccounts(tb, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) + fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) keepers.WasmKeeper.wasmVM = mock wasmCode := append(wasmIdent, rand.Bytes(10)...) codeID, checksum, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, cfg) - require.NoError(tb, err) + require.NoError(t, err) exampleContract := ExampleContract{InitialAmount: anyAmount, Creator: creator, CreatorAddr: creatorAddr, CodeID: codeID, Checksum: checksum} return exampleContract } @@ -702,25 +642,24 @@ type HackatomExampleInstance struct { } // InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract -func InstantiateHackatomExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance { - tb.Helper() - - contract := StoreHackatomExampleContract(tb, ctx, keepers) +func InstantiateHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance { + contract := StoreHackatomExampleContract(t, ctx, keepers) verifier, verifierAddr := keyPubAddr() - fundAccounts(tb, ctx, keepers.AccountKeeper, keepers.BankKeeper, verifierAddr, contract.InitialAmount) + fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, verifierAddr, contract.InitialAmount) beneficiary, beneficiaryAddr := keyPubAddr() - initMsgBz := HackatomExampleInitMsg{ + initMsgBz, err := json.Marshal(HackatomExampleInitMsg{ Verifier: verifierAddr, Beneficiary: beneficiaryAddr, - }.GetBytes(tb) + }) + require.NoError(t, err) initialAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 100)) adminAddr := contract.CreatorAddr label := "demo contract to query" contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, contract.CodeID, contract.CreatorAddr, adminAddr, initMsgBz, label, initialAmount) - require.NoError(tb, err) + require.NoError(t, err) return HackatomExampleInstance{ ExampleContract: contract, Contract: contractAddr, @@ -740,16 +679,14 @@ type ExampleInstance struct { Deposit sdk.Coins } -// InstantiateReflectExampleContract load and instantiate the "./testdata/reflect.wasm" contract -func InstantiateReflectExampleContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleInstance { - tb.Helper() - - example := StoreReflectContract(tb, ctx, keepers) +// InstantiateReflectExampleContract load and instantiate the "./testdata/reflect_2_0.wasm" contract +func InstantiateReflectExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleInstance { + example := StoreReflectContract(t, ctx, keepers) initialAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 100)) label := "demo contract to query" contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, example.CodeID, example.CreatorAddr, example.CreatorAddr, []byte("{}"), label, initialAmount) - require.NoError(tb, err) + require.NoError(t, err) return ExampleInstance{ ExampleContract: example, Contract: contractAddr, @@ -763,11 +700,9 @@ type HackatomExampleInitMsg struct { Beneficiary sdk.AccAddress `json:"beneficiary"` } -func (m HackatomExampleInitMsg) GetBytes(tb testing.TB) []byte { - tb.Helper() - +func (m HackatomExampleInitMsg) GetBytes(t testing.TB) []byte { initMsgBz, err := json.Marshal(m) - require.NoError(tb, err) + require.NoError(t, err) return initMsgBz } @@ -778,20 +713,25 @@ type IBCReflectExampleInstance struct { ReflectCodeID uint64 } -// InstantiateIBCReflectContract load and instantiate the "./testdata/ibc_reflect.wasm" contract -func InstantiateIBCReflectContract(tb testing.TB, ctx sdk.Context, keepers TestKeepers) IBCReflectExampleInstance { - tb.Helper() +func (m IBCReflectExampleInstance) GetBytes(t testing.TB) []byte { + initMsgBz, err := json.Marshal(m) + require.NoError(t, err) + return initMsgBz +} - reflectID := StoreReflectContract(tb, ctx, keepers).CodeID - ibcReflectID := StoreIBCReflectContract(tb, ctx, keepers).CodeID +// InstantiateIBCReflectContract load and instantiate the "./testdata/ibc_reflect.wasm" contract +func InstantiateIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) IBCReflectExampleInstance { + reflectID := StoreReflectContract(t, ctx, keepers).CodeID + ibcReflectID := StoreIBCReflectContract(t, ctx, keepers).CodeID - initMsgBz := IBCReflectInitMsg{ + initMsgBz, err := json.Marshal(IBCReflectInitMsg{ ReflectCodeID: reflectID, - }.GetBytes(tb) - adminAddr := RandomAccountAddress(tb) + }) + require.NoError(t, err) + adminAddr := RandomAccountAddress(t) contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, ibcReflectID, adminAddr, adminAddr, initMsgBz, "ibc-reflect-factory", nil) - require.NoError(tb, err) + require.NoError(t, err) return IBCReflectExampleInstance{ Admin: adminAddr, Contract: contractAddr, @@ -804,11 +744,9 @@ type IBCReflectInitMsg struct { ReflectCodeID uint64 `json:"reflect_code_id"` } -func (m IBCReflectInitMsg) GetBytes(tb testing.TB) []byte { - tb.Helper() - +func (m IBCReflectInitMsg) GetBytes(t testing.TB) []byte { initMsgBz, err := json.Marshal(m) - require.NoError(tb, err) + require.NoError(t, err) return initMsgBz } @@ -817,18 +755,16 @@ type BurnerExampleInitMsg struct { Delete uint32 `json:"delete"` } -func (m BurnerExampleInitMsg) GetBytes(tb testing.TB) []byte { - tb.Helper() +func (m BurnerExampleInitMsg) GetBytes(t testing.TB) []byte { initMsgBz, err := json.Marshal(m) - require.NoError(tb, err) + require.NoError(t, err) return initMsgBz } -func fundAccounts(tb testing.TB, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, addr sdk.AccAddress, coins sdk.Coins) { - tb.Helper() +func fundAccounts(t testing.TB, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, addr sdk.AccAddress, coins sdk.Coins) { acc := am.NewAccountWithAddress(ctx, addr) am.SetAccount(ctx, acc) - NewTestFaucet(tb, ctx, bank, minttypes.ModuleName, coins...).Fund(ctx, addr, coins...) + NewTestFaucet(t, ctx, bank, minttypes.ModuleName, coins...).Fund(ctx, addr, coins...) } var keyCounter uint64 diff --git a/x/wasm/keeper/testdata/contracts.go b/x/wasm/keeper/testdata/contracts.go index dc81aa23d5..eb63bdeef6 100644 --- a/x/wasm/keeper/testdata/contracts.go +++ b/x/wasm/keeper/testdata/contracts.go @@ -3,7 +3,8 @@ package testdata import ( _ "embed" - typwasmvmtypes "github.com/CosmWasm/wasmvm/types" + typwasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + "github.com/cosmos/cosmos-sdk/types" ) @@ -12,7 +13,7 @@ const ( ) var ( - //go:embed reflect.wasm + //go:embed reflect_2_0.wasm reflectContract []byte //go:embed reflect_1_1.wasm migrateReflectContract []byte diff --git a/x/wasm/keeper/testdata/reflect.wasm b/x/wasm/keeper/testdata/reflect.wasm deleted file mode 100644 index 28a64acbf8..0000000000 Binary files a/x/wasm/keeper/testdata/reflect.wasm and /dev/null differ diff --git a/x/wasm/keeper/testdata/reflect_1_5.wasm b/x/wasm/keeper/testdata/reflect_1_5.wasm new file mode 100644 index 0000000000..073a4f4064 Binary files /dev/null and b/x/wasm/keeper/testdata/reflect_1_5.wasm differ diff --git a/x/wasm/keeper/testdata/reflect_2_0.wasm b/x/wasm/keeper/testdata/reflect_2_0.wasm new file mode 100644 index 0000000000..9791208ace Binary files /dev/null and b/x/wasm/keeper/testdata/reflect_2_0.wasm differ diff --git a/x/wasm/keeper/wasmtesting/extension_mocks.go b/x/wasm/keeper/wasmtesting/extension_mocks.go index 3ab14c9a1c..0bf241cf6d 100644 --- a/x/wasm/keeper/wasmtesting/extension_mocks.go +++ b/x/wasm/keeper/wasmtesting/extension_mocks.go @@ -2,7 +2,6 @@ package wasmtesting import ( sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type MockCoinTransferrer struct { @@ -17,10 +16,10 @@ func (m *MockCoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr, toAddr sd } type AccountPrunerMock struct { - CleanupExistingAccountFn func(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) + CleanupExistingAccountFn func(ctx sdk.Context, existingAccount sdk.AccountI) (handled bool, err error) } -func (m AccountPrunerMock) CleanupExistingAccount(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) { +func (m AccountPrunerMock) CleanupExistingAccount(ctx sdk.Context, existingAccount sdk.AccountI) (handled bool, err error) { if m.CleanupExistingAccountFn == nil { panic("not expected to be called") } diff --git a/x/wasm/keeper/wasmtesting/gas_register.go b/x/wasm/keeper/wasmtesting/gas_register.go index d0f718af3a..a16de3b32d 100644 --- a/x/wasm/keeper/wasmtesting/gas_register.go +++ b/x/wasm/keeper/wasmtesting/gas_register.go @@ -1,73 +1,57 @@ package wasmtesting import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" ) // MockGasRegister mock that implements keeper.GasRegister type MockGasRegister struct { - CompileCostFn func(byteLength int) sdk.Gas - NewContractInstanceCostFn func(pinned bool, msgLen int) sdk.Gas - InstantiateContractCostFn func(pinned bool, msgLen int) sdk.Gas - ReplyCostFn func(pinned bool, reply wasmvmtypes.Reply) sdk.Gas - EventCostsFn func(evts []wasmvmtypes.EventAttribute) sdk.Gas - ToWasmVMGasFn func(source sdk.Gas) uint64 - FromWasmVMGasFn func(source uint64) sdk.Gas - UncompressCostsFn func(byteLength int) sdk.Gas + SetupContractCostFn func(discount bool, msgLen int) storetypes.Gas + ReplyCostFn func(discount bool, reply wasmvmtypes.Reply) storetypes.Gas + EventCostsFn func(evts []wasmvmtypes.EventAttribute) storetypes.Gas + ToWasmVMGasFn func(source storetypes.Gas) uint64 + FromWasmVMGasFn func(source uint64) storetypes.Gas + UncompressCostsFn func(byteLength int) storetypes.Gas } -func (m MockGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) sdk.Gas { - if m.NewContractInstanceCostFn == nil { - panic("not expected to be called") - } - return m.NewContractInstanceCostFn(pinned, msgLen) -} - -func (m MockGasRegister) CompileCosts(byteLength int) sdk.Gas { - if m.CompileCostFn == nil { - panic("not expected to be called") - } - return m.CompileCostFn(byteLength) -} - -func (m MockGasRegister) UncompressCosts(byteLength int) sdk.Gas { +func (m MockGasRegister) UncompressCosts(byteLength int) storetypes.Gas { if m.UncompressCostsFn == nil { panic("not expected to be called") } return m.UncompressCostsFn(byteLength) } -func (m MockGasRegister) InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas { - if m.InstantiateContractCostFn == nil { +func (m MockGasRegister) SetupContractCost(discount bool, msgLen int) storetypes.Gas { + if m.SetupContractCostFn == nil { panic("not expected to be called") } - return m.InstantiateContractCostFn(pinned, msgLen) + return m.SetupContractCostFn(discount, msgLen) } -func (m MockGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas { +func (m MockGasRegister) ReplyCosts(discount bool, reply wasmvmtypes.Reply) storetypes.Gas { if m.ReplyCostFn == nil { panic("not expected to be called") } - return m.ReplyCostFn(pinned, reply) + return m.ReplyCostFn(discount, reply) } -func (m MockGasRegister) EventCosts(evts []wasmvmtypes.EventAttribute, _ wasmvmtypes.Events) sdk.Gas { +func (m MockGasRegister) EventCosts(evts []wasmvmtypes.EventAttribute, _ wasmvmtypes.Array[wasmvmtypes.Event]) storetypes.Gas { if m.EventCostsFn == nil { panic("not expected to be called") } return m.EventCostsFn(evts) } -func (m MockGasRegister) ToWasmVMGas(source sdk.Gas) uint64 { +func (m MockGasRegister) ToWasmVMGas(source storetypes.Gas) uint64 { if m.ToWasmVMGasFn == nil { panic("not expected to be called") } return m.ToWasmVMGasFn(source) } -func (m MockGasRegister) FromWasmVMGas(source uint64) sdk.Gas { +func (m MockGasRegister) FromWasmVMGas(source uint64) storetypes.Gas { if m.FromWasmVMGasFn == nil { panic("not expected to be called") } diff --git a/x/wasm/keeper/wasmtesting/messenger.go b/x/wasm/keeper/wasmtesting/messenger.go index 8f613cf667..6c133406a5 100644 --- a/x/wasm/keeper/wasmtesting/messenger.go +++ b/x/wasm/keeper/wasmtesting/messenger.go @@ -3,16 +3,17 @@ package wasmtesting import ( "errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) type MockMessageHandler struct { - DispatchMsgFn func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) + DispatchMsgFn func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) } -func (m *MockMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { +func (m *MockMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { if m.DispatchMsgFn == nil { panic("not expected to be called") } @@ -22,18 +23,18 @@ func (m *MockMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAd func NewCapturingMessageHandler() (*MockMessageHandler, *[]wasmvmtypes.CosmosMsg) { var messages []wasmvmtypes.CosmosMsg return &MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { messages = append(messages, msg) // return one data item so that this doesn't cause an error in submessage processing (it takes the first element from data) - return nil, [][]byte{{1}}, nil + return nil, [][]byte{{1}}, [][]*codectypes.Any{}, nil }, }, &messages } func NewErroringMessageHandler() *MockMessageHandler { return &MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - return nil, nil, errors.New("test, ignore") + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { + return nil, nil, [][]*codectypes.Any{}, errors.New("test, ignore") }, } } diff --git a/x/wasm/keeper/wasmtesting/mock_engine.go b/x/wasm/keeper/wasmtesting/mock_engine.go index b1c7b11d04..9ef1c583a2 100644 --- a/x/wasm/keeper/wasmtesting/mock_engine.go +++ b/x/wasm/keeper/wasmtesting/mock_engine.go @@ -3,8 +3,8 @@ package wasmtesting import ( "bytes" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cometbft/cometbft/libs/rand" errorsmod "cosmossdk.io/errors" @@ -12,48 +12,53 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) +const ( + // The amount of gas to be consumed by the default MockWasmEngine.StoreCode functions per byte + MockStoreCodeCostPerByte = 3 * 140_000 +) + var _ types.WasmEngine = &MockWasmEngine{} // MockWasmEngine implements types.WasmEngine for testing purpose. One or multiple messages can be stubbed. // Without a stub function a panic is thrown. type MockWasmEngine struct { - StoreCodeFn func(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) + StoreCodeFn func(codeID wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) StoreCodeUncheckedFn func(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) AnalyzeCodeFn func(codeID wasmvm.Checksum) (*wasmvmtypes.AnalysisReport, error) - InstantiateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) - ExecuteFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) - QueryFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) - MigrateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) - SudoFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) - ReplyFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) + InstantiateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) + ExecuteFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) + QueryFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.QueryResult, uint64, error) + MigrateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) + SudoFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) + ReplyFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) GetCodeFn func(codeID wasmvm.Checksum) (wasmvm.WasmCode, error) CleanupFn func() - IBCChannelOpenFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) - IBCChannelConnectFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) - IBCChannelCloseFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) + IBCChannelOpenFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) + IBCChannelConnectFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) + IBCChannelCloseFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) IBCPacketReceiveFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) - IBCPacketAckFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) - IBCPacketTimeoutFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) + IBCPacketAckFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) + IBCPacketTimeoutFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) PinFn func(checksum wasmvm.Checksum) error UnpinFn func(checksum wasmvm.Checksum) error GetMetricsFn func() (*wasmvmtypes.Metrics, error) } -func (m *MockWasmEngine) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { +func (m *MockWasmEngine) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { if m.IBCChannelOpenFn == nil { panic("not supposed to be called!") } return m.IBCChannelOpenFn(codeID, env, msg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m *MockWasmEngine) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCChannelConnectFn == nil { panic("not supposed to be called!") } return m.IBCChannelConnectFn(codeID, env, msg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m *MockWasmEngine) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCChannelCloseFn == nil { panic("not supposed to be called!") } @@ -67,30 +72,25 @@ func (m *MockWasmEngine) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtype return m.IBCPacketReceiveFn(codeID, env, msg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m *MockWasmEngine) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCPacketAckFn == nil { panic("not supposed to be called!") } return m.IBCPacketAckFn(codeID, env, msg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m *MockWasmEngine) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCPacketTimeoutFn == nil { panic("not supposed to be called!") } return m.IBCPacketTimeoutFn(codeID, env, msg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -// Deprecated: use StoreCode instead. -func (m *MockWasmEngine) Create(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) { - panic("Deprecated: use StoreCode instead") -} - -func (m *MockWasmEngine) StoreCode(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) { +func (m *MockWasmEngine) StoreCode(codeID wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) { if m.StoreCodeFn == nil { panic("not supposed to be called!") } - return m.StoreCodeFn(codeID) + return m.StoreCodeFn(codeID, gasLimit) } func (m *MockWasmEngine) StoreCodeUnchecked(codeID wasmvm.WasmCode) (wasmvm.Checksum, error) { @@ -107,42 +107,42 @@ func (m *MockWasmEngine) AnalyzeCode(codeID wasmvm.Checksum) (*wasmvmtypes.Analy return m.AnalyzeCodeFn(codeID) } -func (m *MockWasmEngine) Instantiate(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (m *MockWasmEngine) Instantiate(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if m.InstantiateFn == nil { panic("not supposed to be called!") } return m.InstantiateFn(codeID, env, info, initMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) Execute(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (m *MockWasmEngine) Execute(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if m.ExecuteFn == nil { panic("not supposed to be called!") } return m.ExecuteFn(codeID, env, info, executeMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) Query(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { +func (m *MockWasmEngine) Query(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.QueryResult, uint64, error) { if m.QueryFn == nil { panic("not supposed to be called!") } return m.QueryFn(codeID, env, queryMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) Migrate(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (m *MockWasmEngine) Migrate(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if m.MigrateFn == nil { panic("not supposed to be called!") } return m.MigrateFn(codeID, env, migrateMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) Sudo(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (m *MockWasmEngine) Sudo(codeID wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if m.SudoFn == nil { panic("not supposed to be called!") } return m.SudoFn(codeID, env, sudoMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m *MockWasmEngine) Reply(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (m *MockWasmEngine) Reply(codeID wasmvm.Checksum, env wasmvmtypes.Env, reply wasmvmtypes.Reply, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { if m.ReplyFn == nil { panic("not supposed to be called!") } @@ -189,23 +189,25 @@ var AlwaysPanicMockWasmEngine = &MockWasmEngine{} // SelfCallingInstMockWasmEngine prepares a WasmEngine mock that calls itself on instantiation. func SelfCallingInstMockWasmEngine(executeCalled *bool) *MockWasmEngine { return &MockWasmEngine{ - StoreCodeFn: func(code wasmvm.WasmCode) (wasmvm.Checksum, error) { + StoreCodeFn: func(code wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) { anyCodeID := bytes.Repeat([]byte{0x1}, 32) - return anyCodeID, nil + return anyCodeID, 0, nil }, - InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - {Msg: wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{Execute: &wasmvmtypes.ExecuteMsg{ContractAddr: env.Contract.Address, Msg: []byte(`{}`)}}, - }}, + InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + {Msg: wasmvmtypes.CosmosMsg{ + Wasm: &wasmvmtypes.WasmMsg{Execute: &wasmvmtypes.ExecuteMsg{ContractAddr: env.Contract.Address, Msg: []byte(`{}`)}}, + }}, + }, }, }, 1, nil }, AnalyzeCodeFn: WithoutIBCAnalyzeFn, - ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { *executeCalled = true - return &wasmvmtypes.Response{}, 1, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 1, nil }, } } @@ -223,7 +225,7 @@ type IBCContractCallbacks interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) + ) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) IBCChannelConnect( codeID wasmvm.Checksum, @@ -235,7 +237,7 @@ type IBCContractCallbacks interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) IBCChannelClose( codeID wasmvm.Checksum, @@ -247,7 +249,7 @@ type IBCContractCallbacks interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) IBCPacketReceive( codeID wasmvm.Checksum, @@ -271,7 +273,7 @@ type IBCContractCallbacks interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) IBCPacketTimeout( codeID wasmvm.Checksum, @@ -283,7 +285,7 @@ type IBCContractCallbacks interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) } type contractExecutable interface { @@ -298,7 +300,7 @@ type contractExecutable interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) } // MakeInstantiable adds some noop functions to not fail when contract is used for instantiation @@ -334,19 +336,20 @@ func NewIBCContractMockWasmEngine(c IBCContractCallbacks) *MockWasmEngine { return m } -func HashOnlyStoreCodeFn(code wasmvm.WasmCode) (wasmvm.Checksum, error) { +func HashOnlyStoreCodeFn(code wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) { if code == nil { - return nil, errorsmod.Wrap(types.ErrInvalid, "wasm code must not be nil") + return nil, 0, errorsmod.Wrap(types.ErrInvalid, "wasm code must not be nil") } - return wasmvm.CreateChecksum(code) + checksum, err := wasmvm.CreateChecksum(code) + return checksum, 0, err } -func NoOpInstantiateFn(wasmvm.Checksum, wasmvmtypes.Env, wasmvmtypes.MessageInfo, []byte, wasmvm.KVStore, wasmvm.GoAPI, wasmvm.Querier, wasmvm.GasMeter, uint64, wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { - return &wasmvmtypes.Response{}, 0, nil +func NoOpInstantiateFn(wasmvm.Checksum, wasmvmtypes.Env, wasmvmtypes.MessageInfo, []byte, wasmvm.KVStore, wasmvm.GoAPI, wasmvm.Querier, wasmvm.GasMeter, uint64, wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{}}, 0, nil } -func NoOpStoreCodeFn(_ wasmvm.WasmCode) (wasmvm.Checksum, error) { - return rand.Bytes(32), nil +func NoOpStoreCodeFn(wasm wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) { + return rand.Bytes(32), uint64(MockStoreCodeCostPerByte * len(wasm)), nil } func HasIBCAnalyzeFn(wasmvm.Checksum) (*wasmvmtypes.AnalysisReport, error) { @@ -362,29 +365,29 @@ func WithoutIBCAnalyzeFn(wasmvm.Checksum) (*wasmvmtypes.AnalysisReport, error) { var _ IBCContractCallbacks = &MockIBCContractCallbacks{} type MockIBCContractCallbacks struct { - IBCChannelOpenFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) - IBCChannelConnectFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) - IBCChannelCloseFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) + IBCChannelOpenFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) + IBCChannelConnectFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) + IBCChannelCloseFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) IBCPacketReceiveFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) - IBCPacketAckFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) - IBCPacketTimeoutFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) + IBCPacketAckFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) + IBCPacketTimeoutFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) } -func (m MockIBCContractCallbacks) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { +func (m MockIBCContractCallbacks) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { if m.IBCChannelOpenFn == nil { panic("not expected to be called") } return m.IBCChannelOpenFn(codeID, env, channel, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m MockIBCContractCallbacks) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m MockIBCContractCallbacks) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCChannelConnectFn == nil { panic("not expected to be called") } return m.IBCChannelConnectFn(codeID, env, channel, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m MockIBCContractCallbacks) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m MockIBCContractCallbacks) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCChannelCloseFn == nil { panic("not expected to be called") } @@ -398,14 +401,14 @@ func (m MockIBCContractCallbacks) IBCPacketReceive(codeID wasmvm.Checksum, env w return m.IBCPacketReceiveFn(codeID, env, packet, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m MockIBCContractCallbacks) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, ack wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m MockIBCContractCallbacks) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, ack wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCPacketAckFn == nil { panic("not expected to be called") } return m.IBCPacketAckFn(codeID, env, ack, store, goapi, querier, gasMeter, gasLimit, deserCost) } -func (m MockIBCContractCallbacks) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, packet wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (m MockIBCContractCallbacks) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, packet wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { if m.IBCPacketTimeoutFn == nil { panic("not expected to be called") } diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go index 8cae741855..2c327785ee 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -1,11 +1,11 @@ package wasmtesting import ( - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/wasmtesting/msg_dispatcher.go b/x/wasm/keeper/wasmtesting/msg_dispatcher.go index 4d016f4741..2229fedab5 100644 --- a/x/wasm/keeper/wasmtesting/msg_dispatcher.go +++ b/x/wasm/keeper/wasmtesting/msg_dispatcher.go @@ -1,7 +1,7 @@ package wasmtesting import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/wasm/keeper/wasmtesting/query_handler.go b/x/wasm/keeper/wasmtesting/query_handler.go index e70495b52f..5f4a4501bb 100644 --- a/x/wasm/keeper/wasmtesting/query_handler.go +++ b/x/wasm/keeper/wasmtesting/query_handler.go @@ -1,7 +1,7 @@ package wasmtesting import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/wasm/keeper/wasmtesting/store.go b/x/wasm/keeper/wasmtesting/store.go index 6548c8bae2..2cb9a6de6f 100644 --- a/x/wasm/keeper/wasmtesting/store.go +++ b/x/wasm/keeper/wasmtesting/store.go @@ -1,13 +1,12 @@ package wasmtesting import ( - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" ) // MockCommitMultiStore mock with a CacheMultiStore to capture commits type MockCommitMultiStore struct { - sdk.CommitMultiStore + storetypes.CommitMultiStore Committed []bool } @@ -17,7 +16,7 @@ func (m *MockCommitMultiStore) CacheMultiStore() storetypes.CacheMultiStore { } type mockCMS struct { - sdk.CommitMultiStore + storetypes.CommitMultiStore committed *bool } diff --git a/x/wasm/migrations/v1/store.go b/x/wasm/migrations/v1/store.go index f970d85c09..ab245b0e2a 100644 --- a/x/wasm/migrations/v1/store.go +++ b/x/wasm/migrations/v1/store.go @@ -1,17 +1,19 @@ package v1 import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) // AddToSecondIndexFn creates a secondary index entry for the creator fo the contract -type AddToSecondIndexFn func(ctx sdk.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress) +type AddToSecondIndexFn func(ctx context.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress) error // Keeper abstract keeper type wasmKeeper interface { - IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) + IterateContractInfo(ctx context.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) } // Migrator is a struct for handling in-place store migrations. @@ -29,7 +31,10 @@ func NewMigrator(k wasmKeeper, fn AddToSecondIndexFn) Migrator { func (m Migrator) Migrate1to2(ctx sdk.Context) error { m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool { creator := sdk.MustAccAddressFromBech32(contractInfo.Creator) - m.addToSecondIndexFn(ctx, creator, contractInfo.Created, contractAddr) + err := m.addToSecondIndexFn(ctx, creator, contractInfo.Created, contractAddr) + if err != nil { + panic(err) + } return false }) return nil diff --git a/x/wasm/migrations/v1/store_test.go b/x/wasm/migrations/v1/store_test.go index 7afec80b59..d85ff8f1f3 100644 --- a/x/wasm/migrations/v1/store_test.go +++ b/x/wasm/migrations/v1/store_test.go @@ -15,7 +15,7 @@ import ( ) func TestMigrate1To2(t *testing.T) { - const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1" + AvailableCapabilities := []string{"iterator", "staking", "stargate", "cosmwasm_1_1"} ctx, keepers := keeper.CreateTestInput(t, false, AvailableCapabilities) wasmKeeper := keepers.WasmKeeper diff --git a/x/wasm/migrations/v2/legacy_types.go b/x/wasm/migrations/v2/legacy_types.go new file mode 100644 index 0000000000..787c28b574 --- /dev/null +++ b/x/wasm/migrations/v2/legacy_types.go @@ -0,0 +1,1219 @@ +package v2 + +import ( + bytes "bytes" + fmt "fmt" + io "io" + math_bits "math/bits" + + proto "github.com/cosmos/gogoproto/proto" + "gopkg.in/yaml.v2" +) + +// AccessType permission types +type AccessType int32 + +const ( + // AccessTypeUnspecified placeholder for empty value + AccessTypeUnspecified AccessType = 0 + // AccessTypeNobody forbidden + AccessTypeNobody AccessType = 1 + // AccessTypeOnlyAddress restricted to a single address + // Deprecated: use AccessTypeAnyOfAddresses instead + AccessTypeOnlyAddress AccessType = 2 + // AccessTypeEverybody unrestricted + AccessTypeEverybody AccessType = 3 + // AccessTypeAnyOfAddresses allow any of the addresses + AccessTypeAnyOfAddresses AccessType = 4 +) + +var AccessType_name = map[int32]string{ + 0: "ACCESS_TYPE_UNSPECIFIED", + 1: "ACCESS_TYPE_NOBODY", + 2: "ACCESS_TYPE_ONLY_ADDRESS", + 3: "ACCESS_TYPE_EVERYBODY", + 4: "ACCESS_TYPE_ANY_OF_ADDRESSES", +} + +var AccessType_value = map[string]int32{ + "ACCESS_TYPE_UNSPECIFIED": 0, + "ACCESS_TYPE_NOBODY": 1, + "ACCESS_TYPE_ONLY_ADDRESS": 2, + "ACCESS_TYPE_EVERYBODY": 3, + "ACCESS_TYPE_ANY_OF_ADDRESSES": 4, +} + +func (AccessType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e6155d98fa173e02, []int{0} +} + +// AccessTypeParam +type AccessTypeParam struct { + Value AccessType `protobuf:"varint,1,opt,name=value,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"value,omitempty" yaml:"value"` +} + +func (m *AccessTypeParam) Reset() { *m = AccessTypeParam{} } +func (m *AccessTypeParam) String() string { return proto.CompactTextString(m) } +func (*AccessTypeParam) ProtoMessage() {} +func (*AccessTypeParam) Descriptor() ([]byte, []int) { + return fileDescriptor_e6155d98fa173e02, []int{0} +} + +func (m *AccessTypeParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *AccessTypeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessTypeParam.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *AccessTypeParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessTypeParam.Merge(m, src) +} + +func (m *AccessTypeParam) XXX_Size() int { + return m.Size() +} + +func (m *AccessTypeParam) XXX_DiscardUnknown() { + xxx_messageInfo_AccessTypeParam.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessTypeParam proto.InternalMessageInfo + +// AccessConfig access control type. +type AccessConfig struct { + Permission AccessType `protobuf:"varint,1,opt,name=permission,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"permission,omitempty" yaml:"permission"` + // Address + // Deprecated: replaced by addresses + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` + Addresses []string `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty" yaml:"addresses"` +} + +func (m *AccessConfig) Reset() { *m = AccessConfig{} } +func (m *AccessConfig) String() string { return proto.CompactTextString(m) } +func (*AccessConfig) ProtoMessage() {} +func (*AccessConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e6155d98fa173e02, []int{1} +} + +func (m *AccessConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *AccessConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccessConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *AccessConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessConfig.Merge(m, src) +} + +func (m *AccessConfig) XXX_Size() int { + return m.Size() +} + +func (m *AccessConfig) XXX_DiscardUnknown() { + xxx_messageInfo_AccessConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessConfig proto.InternalMessageInfo + +// Params defines the set of wasm parameters. +type Params struct { + CodeUploadAccess AccessConfig `protobuf:"bytes,1,opt,name=code_upload_access,json=codeUploadAccess,proto3" json:"code_upload_access" yaml:"code_upload_access"` + InstantiateDefaultPermission AccessType `protobuf:"varint,2,opt,name=instantiate_default_permission,json=instantiateDefaultPermission,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"instantiate_default_permission,omitempty" yaml:"instantiate_default_permission"` +} + +func (p Params) String() string { + out, err := yaml.Marshal(p) + if err != nil { + panic(err) + } + return string(out) +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_e6155d98fa173e02, []int{2} +} + +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} + +func (m *Params) XXX_Size() int { + return m.Size() +} + +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +// CodeInfo is data for the uploaded contract WASM code +type CodeInfo struct { + // CodeHash is the unique identifier created by wasmvm + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // Creator address who initially stored the code + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // InstantiateConfig access control to apply on contract creation, optional + InstantiateConfig AccessConfig `protobuf:"bytes,5,opt,name=instantiate_config,json=instantiateConfig,proto3" json:"instantiate_config"` +} + +func (m *CodeInfo) Reset() { *m = CodeInfo{} } +func (m *CodeInfo) String() string { return proto.CompactTextString(m) } +func (*CodeInfo) ProtoMessage() {} +func (*CodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e6155d98fa173e02, []int{3} +} + +func (m *CodeInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *CodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CodeInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *CodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeInfo.Merge(m, src) +} + +func (m *CodeInfo) XXX_Size() int { + return m.Size() +} + +func (m *CodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeInfo proto.InternalMessageInfo + +var fileDescriptor_e6155d98fa173e02 = []byte{ + // 1201 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x8f, 0xdb, 0xc4, + 0x17, 0x8f, 0x93, 0xec, 0x8f, 0x4c, 0xf7, 0xdb, 0xaf, 0x3b, 0x6c, 0x69, 0x36, 0xac, 0x92, 0x60, + 0x4a, 0xd9, 0x6e, 0xdb, 0xa4, 0x5d, 0x10, 0x48, 0x3d, 0x54, 0xca, 0x0f, 0xb7, 0xeb, 0x8a, 0x4d, + 0xa2, 0x49, 0x4a, 0x59, 0xa4, 0x62, 0x39, 0xf6, 0x24, 0x6b, 0x35, 0xf1, 0x44, 0x9e, 0xc9, 0x36, + 0xfe, 0x0f, 0x50, 0x24, 0x24, 0x0e, 0x1c, 0xb8, 0x44, 0x42, 0x02, 0x41, 0xb9, 0x71, 0xe0, 0x8f, + 0xa8, 0x40, 0x42, 0x3d, 0x72, 0x8a, 0x60, 0x7b, 0x80, 0x73, 0x8e, 0xe5, 0x82, 0x3c, 0x13, 0xd7, + 0xa6, 0xed, 0x76, 0xc3, 0xc5, 0x9a, 0x79, 0xef, 0x7d, 0x3e, 0xef, 0xbd, 0xcf, 0xcc, 0x3c, 0x19, + 0x6c, 0x9a, 0x84, 0xf6, 0x1f, 0x18, 0xb4, 0x5f, 0xe4, 0x9f, 0xc3, 0x6b, 0x45, 0xe6, 0x0d, 0x30, + 0x2d, 0x0c, 0x5c, 0xc2, 0x08, 0x94, 0x03, 0x6f, 0x81, 0x7f, 0x0e, 0xaf, 0x65, 0x36, 0x7c, 0x0b, + 0xa1, 0x3a, 0xf7, 0x17, 0xc5, 0x46, 0x04, 0x67, 0xd6, 0xbb, 0xa4, 0x4b, 0x84, 0xdd, 0x5f, 0xcd, + 0xad, 0x1b, 0x5d, 0x42, 0xba, 0x3d, 0x5c, 0xe4, 0xbb, 0xf6, 0xb0, 0x53, 0x34, 0x1c, 0x6f, 0xee, + 0x3a, 0x63, 0xf4, 0x6d, 0x87, 0x14, 0xf9, 0x57, 0x98, 0x94, 0x7b, 0xe0, 0xff, 0x25, 0xd3, 0xc4, + 0x94, 0xb6, 0xbc, 0x01, 0x6e, 0x18, 0xae, 0xd1, 0x87, 0x55, 0xb0, 0x74, 0x68, 0xf4, 0x86, 0x38, + 0x2d, 0xe5, 0xa5, 0xad, 0xd3, 0x3b, 0x9b, 0x85, 0xe7, 0x6b, 0x2a, 0x84, 0x88, 0xb2, 0x3c, 0x9b, + 0xe6, 0xd6, 0x3c, 0xa3, 0xdf, 0xbb, 0xae, 0x70, 0x90, 0x82, 0x04, 0xf8, 0x7a, 0xf2, 0xab, 0xaf, + 0x73, 0x92, 0xf2, 0x8b, 0x04, 0xd6, 0x44, 0x74, 0x85, 0x38, 0x1d, 0xbb, 0x0b, 0x9b, 0x00, 0x0c, + 0xb0, 0xdb, 0xb7, 0x29, 0xb5, 0x89, 0xb3, 0x50, 0x86, 0xb3, 0xb3, 0x69, 0xee, 0x8c, 0xc8, 0x10, + 0x22, 0x15, 0x14, 0xa1, 0x81, 0x97, 0xc1, 0x8a, 0x61, 0x59, 0x2e, 0xa6, 0x34, 0x1d, 0xcf, 0x4b, + 0x5b, 0xa9, 0x32, 0x9c, 0x4d, 0x73, 0xa7, 0x05, 0x66, 0xee, 0x50, 0x50, 0x10, 0x02, 0x77, 0x40, + 0x6a, 0xbe, 0xc4, 0x34, 0x9d, 0xc8, 0x27, 0xb6, 0x52, 0xe5, 0xf5, 0xd9, 0x34, 0x27, 0xff, 0x2b, + 0x1e, 0x53, 0x05, 0x85, 0x61, 0xf3, 0x6e, 0xbe, 0x8c, 0x83, 0x65, 0xae, 0x11, 0x85, 0x0c, 0x40, + 0x93, 0x58, 0x58, 0x1f, 0x0e, 0x7a, 0xc4, 0xb0, 0x74, 0x83, 0xd7, 0xcb, 0xfb, 0x39, 0xb5, 0x93, + 0x3d, 0xae, 0x1f, 0xa1, 0x41, 0xf9, 0xc2, 0xa3, 0x69, 0x2e, 0x36, 0x9b, 0xe6, 0x36, 0x44, 0xc6, + 0x17, 0x79, 0x94, 0x87, 0x7f, 0xfe, 0xb8, 0x2d, 0x21, 0xd9, 0xf7, 0xdc, 0xe1, 0x0e, 0x81, 0x87, + 0x9f, 0x4b, 0x20, 0x6b, 0x3b, 0x94, 0x19, 0x0e, 0xb3, 0x0d, 0x86, 0x75, 0x0b, 0x77, 0x8c, 0x61, + 0x8f, 0xe9, 0x11, 0x49, 0xe3, 0x0b, 0x48, 0x7a, 0x71, 0x36, 0xcd, 0xbd, 0x2d, 0x92, 0xbf, 0x9a, + 0x4d, 0x41, 0x9b, 0x91, 0x80, 0xaa, 0xf0, 0x37, 0x9e, 0xb9, 0xb9, 0x2c, 0x31, 0xe5, 0x7b, 0x09, + 0xac, 0x56, 0x88, 0x85, 0x35, 0xa7, 0x43, 0xe0, 0x1b, 0x20, 0xc5, 0x1b, 0x3a, 0x30, 0xe8, 0x01, + 0xd7, 0x63, 0x0d, 0xad, 0xfa, 0x86, 0x5d, 0x83, 0x1e, 0xc0, 0x34, 0x58, 0x31, 0x5d, 0x6c, 0x30, + 0xe2, 0x8a, 0x83, 0x42, 0xc1, 0x16, 0x7e, 0x0c, 0x60, 0xb4, 0x14, 0x93, 0x2b, 0x95, 0x5e, 0x5a, + 0x48, 0xcf, 0x94, 0xaf, 0xa7, 0x90, 0xec, 0x4c, 0x84, 0x44, 0x78, 0x6f, 0x27, 0x57, 0x13, 0x72, + 0xf2, 0x76, 0x72, 0x35, 0x29, 0x2f, 0x29, 0xbf, 0xc6, 0xc1, 0x5a, 0x85, 0x38, 0xcc, 0x35, 0x4c, + 0xc6, 0xab, 0x7d, 0x0b, 0xac, 0xf0, 0x6a, 0x6d, 0x8b, 0xd7, 0x9a, 0x2c, 0x83, 0xa3, 0x69, 0x6e, + 0x99, 0x37, 0x53, 0x45, 0xcb, 0xbe, 0x4b, 0xb3, 0x5e, 0x51, 0xf5, 0x3a, 0x58, 0x32, 0xac, 0xbe, + 0xed, 0xa4, 0x13, 0xdc, 0x2e, 0x36, 0xbe, 0xb5, 0x67, 0xb4, 0x71, 0x2f, 0x9d, 0x14, 0x56, 0xbe, + 0x81, 0x37, 0xe6, 0x2c, 0xd8, 0x9a, 0xb7, 0x75, 0xfe, 0x25, 0x6d, 0xb5, 0x29, 0xe9, 0x0d, 0x19, + 0x6e, 0x8d, 0x1a, 0x84, 0xda, 0xcc, 0x26, 0x0e, 0x0a, 0x40, 0xf0, 0x0a, 0x38, 0x65, 0xb7, 0x4d, + 0x7d, 0x40, 0x5c, 0xe6, 0x97, 0xbb, 0xcc, 0x2f, 0xfa, 0xff, 0x8e, 0xa6, 0xb9, 0x94, 0x56, 0xae, + 0x34, 0x88, 0xcb, 0xb4, 0x2a, 0x4a, 0xd9, 0x6d, 0x93, 0x2f, 0x2d, 0xf8, 0x29, 0x48, 0xe1, 0x11, + 0xc3, 0x0e, 0xbf, 0x14, 0x2b, 0x3c, 0xe1, 0x7a, 0x41, 0x8c, 0x86, 0x42, 0x30, 0x1a, 0x0a, 0x25, + 0xc7, 0x2b, 0x6f, 0xff, 0xfc, 0xd3, 0x95, 0x0b, 0x2f, 0x54, 0x12, 0x55, 0x49, 0x0d, 0x78, 0x50, + 0x48, 0x79, 0x3d, 0xf9, 0x97, 0xff, 0x22, 0xfe, 0x96, 0x40, 0x3a, 0x08, 0xf5, 0x55, 0xdb, 0xb5, + 0x29, 0x23, 0xae, 0xa7, 0x3a, 0xcc, 0xf5, 0x60, 0x03, 0xa4, 0xc8, 0x00, 0xbb, 0x06, 0x0b, 0x9f, + 0xfa, 0x4e, 0xe1, 0xd8, 0x4c, 0x11, 0x78, 0x3d, 0x40, 0xf9, 0xb7, 0x15, 0x85, 0x24, 0xd1, 0xe3, + 0x8a, 0x1f, 0x7b, 0x5c, 0x37, 0xc0, 0xca, 0x70, 0x60, 0x71, 0xa1, 0x13, 0xff, 0x45, 0xe8, 0x39, + 0x08, 0x6e, 0x81, 0x44, 0x9f, 0x76, 0xf9, 0xe1, 0xad, 0x95, 0x5f, 0x7f, 0x3a, 0xcd, 0x41, 0x64, + 0x3c, 0x08, 0xaa, 0xdc, 0xc3, 0x94, 0x1a, 0x5d, 0x8c, 0xfc, 0x10, 0x05, 0x01, 0xf8, 0x22, 0x11, + 0x7c, 0x13, 0xac, 0xb5, 0x7b, 0xc4, 0xbc, 0xaf, 0x1f, 0x60, 0xbb, 0x7b, 0xc0, 0xc4, 0xc5, 0x42, + 0xa7, 0xb8, 0x6d, 0x97, 0x9b, 0xe0, 0x06, 0x58, 0x65, 0x23, 0xdd, 0x76, 0x2c, 0x3c, 0x12, 0x8d, + 0xa0, 0x15, 0x36, 0xd2, 0xfc, 0xad, 0x82, 0xc1, 0xd2, 0x1e, 0xb1, 0x70, 0x0f, 0xde, 0x04, 0x89, + 0xfb, 0xd8, 0x13, 0x4f, 0xa8, 0xfc, 0xde, 0xd3, 0x69, 0xee, 0x6a, 0xd7, 0x66, 0x07, 0xc3, 0x76, + 0xc1, 0x24, 0xfd, 0xa2, 0x49, 0xfa, 0x98, 0xb5, 0x3b, 0x2c, 0x5c, 0xf4, 0xec, 0x36, 0x2d, 0xb6, + 0x3d, 0x86, 0x69, 0x61, 0x17, 0x8f, 0xca, 0xfe, 0x02, 0xf9, 0x04, 0xfe, 0x6d, 0x14, 0xe3, 0x3c, + 0xce, 0x1f, 0xa3, 0xd8, 0x6c, 0xff, 0x10, 0x07, 0x20, 0x9c, 0x08, 0xf0, 0x7d, 0x70, 0xae, 0x54, + 0xa9, 0xa8, 0xcd, 0xa6, 0xde, 0xda, 0x6f, 0xa8, 0xfa, 0x9d, 0x5a, 0xb3, 0xa1, 0x56, 0xb4, 0x9b, + 0x9a, 0x5a, 0x95, 0x63, 0x99, 0x8d, 0xf1, 0x24, 0x7f, 0x36, 0x0c, 0xbe, 0xe3, 0xd0, 0x01, 0x36, + 0xed, 0x8e, 0x8d, 0x2d, 0x78, 0x19, 0xc0, 0x28, 0xae, 0x56, 0x2f, 0xd7, 0xab, 0xfb, 0xb2, 0x94, + 0x59, 0x1f, 0x4f, 0xf2, 0x72, 0x08, 0xa9, 0x91, 0x36, 0xb1, 0x3c, 0xf8, 0x01, 0x48, 0x47, 0xa3, + 0xeb, 0xb5, 0x0f, 0xf7, 0xf5, 0x52, 0xb5, 0x8a, 0xd4, 0x66, 0x53, 0x8e, 0x3f, 0x9f, 0xa6, 0xee, + 0xf4, 0xbc, 0xd2, 0xb3, 0x91, 0x7d, 0x36, 0x0a, 0x54, 0x3f, 0x52, 0xd1, 0x3e, 0xcf, 0x94, 0xc8, + 0x9c, 0x1b, 0x4f, 0xf2, 0xaf, 0x85, 0x28, 0xf5, 0x10, 0xbb, 0x1e, 0x4f, 0x76, 0x03, 0x6c, 0x46, + 0x31, 0xa5, 0xda, 0xbe, 0x5e, 0xbf, 0x19, 0xa4, 0x53, 0x9b, 0x72, 0x32, 0xb3, 0x39, 0x9e, 0xe4, + 0xd3, 0x21, 0xb4, 0xe4, 0x78, 0xf5, 0x4e, 0x29, 0x18, 0xf9, 0x99, 0xd5, 0xcf, 0xbe, 0xc9, 0xc6, + 0x1e, 0x7e, 0x9b, 0x8d, 0x6d, 0x7f, 0x97, 0x00, 0xf9, 0x93, 0x6e, 0x29, 0xc4, 0xe0, 0x6a, 0xa5, + 0x5e, 0x6b, 0xa1, 0x52, 0xa5, 0xa5, 0x57, 0xea, 0x55, 0x55, 0xdf, 0xd5, 0x9a, 0xad, 0x3a, 0xda, + 0xd7, 0xeb, 0x0d, 0x15, 0x95, 0x5a, 0x5a, 0xbd, 0xf6, 0x32, 0x69, 0x8b, 0xe3, 0x49, 0xfe, 0xd2, + 0x49, 0xdc, 0x51, 0xc1, 0xef, 0x82, 0x8b, 0x0b, 0xa5, 0xd1, 0x6a, 0x5a, 0x4b, 0x96, 0x32, 0x5b, + 0xe3, 0x49, 0xfe, 0xfc, 0x49, 0xfc, 0x9a, 0x63, 0x33, 0x78, 0x0f, 0x5c, 0x5e, 0x88, 0x78, 0x4f, + 0xbb, 0x85, 0x4a, 0x2d, 0x55, 0x8e, 0x67, 0x2e, 0x8d, 0x27, 0xf9, 0x77, 0x4e, 0xe2, 0xde, 0xb3, + 0xbb, 0xae, 0xc1, 0xf0, 0xc2, 0xf4, 0xb7, 0xd4, 0x9a, 0xda, 0xd4, 0x9a, 0x72, 0x62, 0x31, 0xfa, + 0x5b, 0xd8, 0xc1, 0xd4, 0xa6, 0x99, 0xa4, 0x7f, 0x58, 0xe5, 0xdd, 0x47, 0x7f, 0x64, 0x63, 0x0f, + 0x8f, 0xb2, 0xd2, 0xa3, 0xa3, 0xac, 0xf4, 0xf8, 0x28, 0x2b, 0xfd, 0x7e, 0x94, 0x95, 0xbe, 0x78, + 0x92, 0x8d, 0x3d, 0x7e, 0x92, 0x8d, 0xfd, 0xf6, 0x24, 0x1b, 0xfb, 0xe4, 0x42, 0xe4, 0x0d, 0x55, + 0x08, 0xed, 0xdf, 0x0d, 0x7e, 0xc4, 0xac, 0xe2, 0x48, 0xfc, 0x90, 0xf1, 0xbf, 0xb1, 0xf6, 0x32, + 0x1f, 0x91, 0xef, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x69, 0x83, 0x28, 0x71, 0xae, 0x09, 0x00, + 0x00, +} + +func (m *AccessTypeParam) Equal(that interface{}) bool { + if that == nil { + return m == nil + } + + that1, ok := that.(*AccessTypeParam) + if !ok { + that2, ok := that.(AccessTypeParam) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return m == nil + } else if m == nil { + return false + } + if m.Value != that1.Value { + return false + } + return true +} + +func (m *AccessConfig) Equal(that interface{}) bool { + if that == nil { + return m == nil + } + + that1, ok := that.(*AccessConfig) + if !ok { + that2, ok := that.(AccessConfig) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return m == nil + } else if m == nil { + return false + } + if m.Permission != that1.Permission { + return false + } + if m.Address != that1.Address { + return false + } + if len(m.Addresses) != len(that1.Addresses) { + return false + } + for i := range m.Addresses { + if m.Addresses[i] != that1.Addresses[i] { + return false + } + } + return true +} + +func (m *Params) Equal(that interface{}) bool { + if that == nil { + return m == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return m == nil + } else if m == nil { + return false + } + if !m.CodeUploadAccess.Equal(&that1.CodeUploadAccess) { + return false + } + if m.InstantiateDefaultPermission != that1.InstantiateDefaultPermission { + return false + } + return true +} + +func (m *CodeInfo) Equal(that interface{}) bool { + if that == nil { + return m == nil + } + + that1, ok := that.(*CodeInfo) + if !ok { + that2, ok := that.(CodeInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return m == nil + } else if m == nil { + return false + } + if !bytes.Equal(m.CodeHash, that1.CodeHash) { + return false + } + if m.Creator != that1.Creator { + return false + } + if !m.InstantiateConfig.Equal(&that1.InstantiateConfig) { + return false + } + return true +} + +func (m *AccessTypeParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessTypeParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessTypeParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AccessConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccessConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccessConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if m.Permission != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Permission)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InstantiateDefaultPermission != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.InstantiateDefaultPermission)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.CodeUploadAccess.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CodeInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CodeInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.InstantiateConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x12 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} + +func (m *AccessTypeParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovTypes(uint64(m.Value)) + } + return n +} + +func (m *AccessConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Permission != 0 { + n += 1 + sovTypes(uint64(m.Permission)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CodeUploadAccess.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.InstantiateDefaultPermission != 0 { + n += 1 + sovTypes(uint64(m.InstantiateDefaultPermission)) + } + return n +} + +func (m *CodeInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.InstantiateConfig.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} + +func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessTypeParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessTypeParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= AccessType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *AccessConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccessConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccessConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Permission", wireType) + } + m.Permission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Permission |= AccessType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeUploadAccess", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CodeUploadAccess.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiateDefaultPermission", wireType) + } + m.InstantiateDefaultPermission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InstantiateDefaultPermission |= AccessType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *CodeInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CodeInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiateConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InstantiateConfig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/wasm/migrations/v2/params_legacy.go b/x/wasm/migrations/v2/params_legacy.go new file mode 100644 index 0000000000..d4fad0bdef --- /dev/null +++ b/x/wasm/migrations/v2/params_legacy.go @@ -0,0 +1,142 @@ +/* +NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov +controlled execution of MsgUpdateParams messages. These types remains solely +for migration purposes and will be removed in a future release. +*/ +package v2 + +import ( + "encoding/json" + "fmt" + + "github.com/cosmos/gogoproto/jsonpb" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +var ( + ParamStoreKeyUploadAccess = []byte("uploadAccess") + ParamStoreKeyInstantiateAccess = []byte("instantiateAccess") +) + +// Deprecated: Type declaration for parameters +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig), + paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType), + } +} + +func validateAccessConfig(i interface{}) error { + v, ok := i.(AccessConfig) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return v.ValidateBasic() +} + +var AllAccessTypes = []AccessType{ + AccessTypeNobody, + AccessTypeOnlyAddress, + AccessTypeAnyOfAddresses, + AccessTypeEverybody, +} + +func validateAccessType(i interface{}) error { + a, ok := i.(AccessType) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if a == AccessTypeUnspecified { + return errorsmod.Wrap(types.ErrEmpty, "type") + } + for _, v := range AllAccessTypes { + if v == a { + return nil + } + } + return errorsmod.Wrapf(types.ErrInvalid, "unknown type: %q", a) +} + +func (a AccessConfig) ValidateBasic() error { + switch a.Permission { + case AccessTypeUnspecified: + return errorsmod.Wrap(types.ErrEmpty, "type") + case AccessTypeNobody, AccessTypeEverybody: + return nil + case AccessTypeOnlyAddress: + _, err := sdk.AccAddressFromBech32(a.Address) + return errorsmod.Wrap(err, "only address") + case AccessTypeAnyOfAddresses: + return errorsmod.Wrap(assertValidAddresses(a.Addresses), "addresses") + } + return errorsmod.Wrapf(types.ErrInvalid, "unknown type: %q", a.Permission) +} + +func assertValidAddresses(addrs []string) error { + if len(addrs) == 0 { + return types.ErrEmpty + } + idx := make(map[string]struct{}, len(addrs)) + for _, a := range addrs { + if _, err := sdk.AccAddressFromBech32(a); err != nil { + return errorsmod.Wrapf(err, "address: %s", a) + } + if _, exists := idx[a]; exists { + return types.ErrDuplicate.Wrapf("address: %s", a) + } + idx[a] = struct{}{} + } + return nil +} + +func (a AccessType) String() string { + switch a { + case AccessTypeNobody: + return "Nobody" + case AccessTypeOnlyAddress: + return "OnlyAddress" + case AccessTypeEverybody: + return "Everybody" + case AccessTypeAnyOfAddresses: + return "AnyOfAddresses" + } + return "Unspecified" +} + +func (a *AccessType) UnmarshalText(text []byte) error { + for _, v := range AllAccessTypes { + if v.String() == string(text) { + *a = v + return nil + } + } + *a = AccessTypeUnspecified + return nil +} + +func (a AccessType) MarshalText() ([]byte, error) { + return []byte(a.String()), nil +} + +func (a *AccessType) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { + return json.Marshal(a) +} + +func (a *AccessType) UnmarshalJSONPB(_ *jsonpb.Unmarshaler, data []byte) error { + return json.Unmarshal(data, a) +} + +func (a AccessConfig) Equals(o AccessConfig) bool { + return a.Permission == o.Permission && a.Address == o.Address +} diff --git a/x/wasm/migrations/v2/params_legacy_test.go b/x/wasm/migrations/v2/params_legacy_test.go new file mode 100644 index 0000000000..d405b0b368 --- /dev/null +++ b/x/wasm/migrations/v2/params_legacy_test.go @@ -0,0 +1,89 @@ +package v2 + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec" +) + +func TestAccessTypeMarshalJson(t *testing.T) { + specs := map[string]struct { + src AccessType + exp string + }{ + "Unspecified": {src: AccessTypeUnspecified, exp: `"Unspecified"`}, + "Nobody": {src: AccessTypeNobody, exp: `"Nobody"`}, + "OnlyAddress": {src: AccessTypeOnlyAddress, exp: `"OnlyAddress"`}, + "AccessTypeAnyOfAddresses": {src: AccessTypeAnyOfAddresses, exp: `"AnyOfAddresses"`}, + "Everybody": {src: AccessTypeEverybody, exp: `"Everybody"`}, + "unknown": {src: 999, exp: `"Unspecified"`}, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + got, err := json.Marshal(spec.src) + require.NoError(t, err) + assert.Equal(t, []byte(spec.exp), got) + }) + } +} + +func TestAccessTypeUnmarshalJson(t *testing.T) { + specs := map[string]struct { + src string + exp AccessType + }{ + "Unspecified": {src: `"Unspecified"`, exp: AccessTypeUnspecified}, + "Nobody": {src: `"Nobody"`, exp: AccessTypeNobody}, + "OnlyAddress": {src: `"OnlyAddress"`, exp: AccessTypeOnlyAddress}, + "AnyOfAddresses": {src: `"AnyOfAddresses"`, exp: AccessTypeAnyOfAddresses}, + "Everybody": {src: `"Everybody"`, exp: AccessTypeEverybody}, + "unknown": {src: `""`, exp: AccessTypeUnspecified}, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + var got AccessType + err := json.Unmarshal([]byte(spec.src), &got) + require.NoError(t, err) + assert.Equal(t, spec.exp, got) + }) + } +} + +func TestParamsUnmarshalJson(t *testing.T) { + specs := map[string]struct { + src string + exp Params + }{ + "defaults": { + src: `{"code_upload_access": {"permission": "Everybody"}, + "instantiate_default_permission": "Everybody"}`, + exp: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeEverybody}, + InstantiateDefaultPermission: AccessTypeEverybody, + }, + }, + "legacy type": { + src: `{"code_upload_access": {"permission": "OnlyAddress", "address": "wasm1lq3q55r9sqwqyrfmlp6xy8ufhayt96lmcttthz", "addresses": [] }, + "instantiate_default_permission": "Nobody"}`, + exp: Params{ + CodeUploadAccess: AccessConfig{ + Permission: AccessTypeOnlyAddress, Address: "wasm1lq3q55r9sqwqyrfmlp6xy8ufhayt96lmcttthz", Addresses: nil, + }, + InstantiateDefaultPermission: AccessTypeNobody, + }, + }, + } + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + var val Params + marshaler := codec.NewLegacyAmino() + err := marshaler.UnmarshalJSON([]byte(spec.src), &val) + require.NoError(t, err) + assert.Equal(t, spec.exp, val) + }) + } +} diff --git a/x/wasm/migrations/v2/store.go b/x/wasm/migrations/v2/store.go index 64c94ba837..481ef6865c 100644 --- a/x/wasm/migrations/v2/store.go +++ b/x/wasm/migrations/v2/store.go @@ -1,8 +1,9 @@ package v2 import ( + corestoretypes "cosmossdk.io/core/store" + "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/exported" @@ -13,21 +14,14 @@ import ( // version 3. Specifically, it takes the parameters that are currently stored // and managed by the x/params module and stores them directly into the x/wasm // module state. -func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { - store := ctx.KVStore(storeKey) - var currParams types.Params +func MigrateStore(ctx sdk.Context, storeService corestoretypes.KVStoreService, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error { + store := storeService.OpenKVStore(ctx) + var currParams Params legacySubspace.GetParamSet(ctx, &currParams) - - if err := currParams.ValidateBasic(); err != nil { - return err - } - bz, err := cdc.Marshal(&currParams) if err != nil { return err } - store.Set(types.ParamsKey, bz) - - return nil + return store.Set(types.ParamsKey, bz) } diff --git a/x/wasm/migrations/v2/store_test.go b/x/wasm/migrations/v2/store_test.go index 3f21bf4555..f087e6f42f 100644 --- a/x/wasm/migrations/v2/store_test.go +++ b/x/wasm/migrations/v2/store_test.go @@ -3,42 +3,99 @@ package v2_test import ( "testing" + "github.com/cometbft/cometbft/libs/rand" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/CosmWasm/wasmd/x/wasm" - "github.com/CosmWasm/wasmd/x/wasm/exported" v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2" "github.com/CosmWasm/wasmd/x/wasm/types" ) -type mockSubspace struct { - ps types.Params -} +func TestMigrate(t *testing.T) { + cfg := moduletestutil.MakeTestEncodingConfig(wasm.AppModuleBasic{}) + cdc := cfg.Codec + var ( + wasmStoreKey = storetypes.NewKVStoreKey(types.StoreKey) + paramsStoreKey = storetypes.NewKVStoreKey(paramstypes.StoreKey) + paramsTStoreKey = storetypes.NewTransientStoreKey(paramstypes.TStoreKey) + myAddress = sdk.AccAddress(rand.Bytes(address.Len)) + ) + specs := map[string]struct { + src v2.Params + }{ + "one address": { + src: v2.Params{ + CodeUploadAccess: v2.AccessConfig{ + Permission: v2.AccessTypeOnlyAddress, + Address: myAddress.String(), + }, + InstantiateDefaultPermission: v2.AccessTypeNobody, + }, + }, + "multiple addresses": { + src: v2.Params{ + CodeUploadAccess: v2.AccessConfig{ + Permission: v2.AccessTypeAnyOfAddresses, + Addresses: []string{myAddress.String(), sdk.AccAddress(rand.Bytes(address.Len)).String()}, + }, + InstantiateDefaultPermission: v2.AccessTypeEverybody, + }, + }, + "everybody": { + src: v2.Params{ + CodeUploadAccess: v2.AccessConfig{ + Permission: v2.AccessTypeEverybody, + }, + InstantiateDefaultPermission: v2.AccessTypeEverybody, + }, + }, + "nobody": { + src: v2.Params{ + CodeUploadAccess: v2.AccessConfig{ + Permission: v2.AccessTypeNobody, + }, + InstantiateDefaultPermission: v2.AccessTypeNobody, + }, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + paramsKeeper := paramskeeper.NewKeeper(cdc, cfg.Amino, paramsStoreKey, paramsTStoreKey) + ctx := testutil.DefaultContextWithKeys( + map[string]*storetypes.KVStoreKey{ + paramstypes.StoreKey: paramsStoreKey, + types.StoreKey: wasmStoreKey, + }, + map[string]*storetypes.TransientStoreKey{ + paramstypes.TStoreKey: paramsTStoreKey, + }, + nil, + ) -func newMockSubspace(ps types.Params) mockSubspace { - return mockSubspace{ps: ps} -} + // register legacy parameters + params := spec.src + subspace := paramsKeeper.Subspace(types.ModuleName) + subspace.WithKeyTable(v2.ParamKeyTable()) + subspace.SetParamSet(ctx, ¶ms) -func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) { - *ps.(*types.Params) = ms.ps -} + // when + require.NoError(t, v2.MigrateStore(ctx, runtime.NewKVStoreService(wasmStoreKey), subspace, cdc)) -func TestMigrate(t *testing.T) { - cdc := moduletestutil.MakeTestEncodingConfig(wasm.AppModuleBasic{}).Codec - storeKey := sdk.NewKVStoreKey(types.StoreKey) - tKey := sdk.NewTransientStoreKey("transient_test") - ctx := testutil.DefaultContext(storeKey, tKey) - store := ctx.KVStore(storeKey) - - legacySubspace := newMockSubspace(types.DefaultParams()) - require.NoError(t, v2.MigrateStore(ctx, storeKey, legacySubspace, cdc)) - - var res types.Params - bz := store.Get(types.ParamsKey) - require.NoError(t, cdc.Unmarshal(bz, &res)) - require.Equal(t, legacySubspace.ps, res) + var res v2.Params + bz := ctx.KVStore(wasmStoreKey).Get(types.ParamsKey) + require.NoError(t, cdc.Unmarshal(bz, &res)) + assert.Equal(t, params, res) + }) + } } diff --git a/x/wasm/migrations/v3/store.go b/x/wasm/migrations/v3/store.go index 0e72e300e9..a4408ea61e 100644 --- a/x/wasm/migrations/v3/store.go +++ b/x/wasm/migrations/v3/store.go @@ -1,22 +1,25 @@ package v3 import ( + "context" "encoding/binary" + corestoretypes "cosmossdk.io/core/store" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) // StoreCodeInfoFn stores code info -type StoreCodeInfoFn func(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo) +type StoreCodeInfoFn func(ctx context.Context, codeID uint64, codeInfo types.CodeInfo) // Keeper abstract keeper type wasmKeeper interface { - SetParams(ctx sdk.Context, ps types.Params) error + SetParams(ctx context.Context, ps types.Params) error } // Migrator is a struct for handling in-place store migrations. @@ -31,10 +34,13 @@ func NewMigrator(k wasmKeeper, fn StoreCodeInfoFn) Migrator { } // Migrate3to4 migrates from version 3 to 4. -func (m Migrator) Migrate3to4(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { +func (m Migrator) Migrate3to4(ctx sdk.Context, storeService corestoretypes.KVStoreService, cdc codec.BinaryCodec) error { var legacyParams Params - store := ctx.KVStore(storeKey) - bz := store.Get(types.ParamsKey) + store := storeService.OpenKVStore(ctx) + bz, err := store.Get(types.ParamsKey) + if err != nil { + return err + } if bz != nil { cdc.MustUnmarshal(bz, &legacyParams) @@ -53,7 +59,7 @@ func (m Migrator) Migrate3to4(ctx sdk.Context, storeKey storetypes.StoreKey, cdc } } - prefixStore := prefix.NewStore(store, types.CodeKeyPrefix) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(store), types.CodeKeyPrefix) iter := prefixStore.Iterator(nil, nil) defer iter.Close() diff --git a/x/wasm/migrations/v3/store_test.go b/x/wasm/migrations/v3/store_test.go index 0bd217d299..b754599d76 100644 --- a/x/wasm/migrations/v3/store_test.go +++ b/x/wasm/migrations/v3/store_test.go @@ -19,7 +19,7 @@ import ( ) func TestMigrate3To4(t *testing.T) { - const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1" + AvailableCapabilities := []string{"iterator", "staking", "stargate", "cosmwasm_1_1"} ctx, keepers := keeper.CreateTestInput(t, false, AvailableCapabilities) store := ctx.KVStore(keepers.WasmStoreKey) cdc := moduletestutil.MakeTestEncodingConfig(wasm.AppModuleBasic{}).Codec diff --git a/x/wasm/module.go b/x/wasm/module.go index d209899f67..7ece3416fe 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -7,7 +7,7 @@ import ( "runtime/debug" "strings" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" abci "github.com/cometbft/cometbft/abci/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cast" @@ -192,15 +192,6 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(gs) } -// BeginBlock returns the begin blocker for the wasm module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock returns the end blocker for the wasm module. It returns no validator -// updates. -func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} - // ____________________________________________________________________________ // AppModuleSimulation functions @@ -216,12 +207,12 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei } // RegisterStoreDecoder registers a decoder for supply module's types -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) { } // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return simulation.WeightedOperations(&simState, am.accountKeeper, am.bankKeeper, am.keeper) + return simulation.WeightedOperations(simState.AppParams, am.accountKeeper, am.bankKeeper, am.keeper) } // ____________________________________________________________________________ @@ -286,7 +277,7 @@ func getExpectedLibwasmVersion() string { panic("can't read build info") } for _, d := range buildInfo.Deps { - if d.Path != "github.com/CosmWasm/wasmvm" { + if d.Path != "github.com/CosmWasm/wasmvm/v2" { continue } if d.Replace != nil { diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go index b91137daf2..786d71b3f0 100644 --- a/x/wasm/module_test.go +++ b/x/wasm/module_test.go @@ -27,19 +27,20 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/exported" "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" + v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2" "github.com/CosmWasm/wasmd/x/wasm/types" ) type mockSubspace struct { - ps types.Params + ps v2.Params } -func newMockSubspace(ps types.Params) mockSubspace { +func newMockSubspace(ps v2.Params) mockSubspace { return mockSubspace{ps: ps} } func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) { - *ps.(*types.Params) = ms.ps + *ps.(*v2.Params) = ms.ps } type testData struct { @@ -57,14 +58,19 @@ type testData struct { func setupTest(t *testing.T) testData { t.Helper() - ctx, keepers := keeper.CreateTestInput(t, false, "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4") + DefaultParams := v2.Params{ + CodeUploadAccess: v2.AccessConfig{Permission: v2.AccessTypeEverybody}, + InstantiateDefaultPermission: v2.AccessTypeEverybody, + } + + ctx, keepers := keeper.CreateTestInput(t, false, []string{"iterator", "staking", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0"}) encConf := keeper.MakeEncodingConfig(t) queryRouter := baseapp.NewGRPCQueryRouter() serviceRouter := baseapp.NewMsgServiceRouter() queryRouter.SetInterfaceRegistry(encConf.InterfaceRegistry) serviceRouter.SetInterfaceRegistry(encConf.InterfaceRegistry) data := testData{ - module: NewAppModule(encConf.Codec, keepers.WasmKeeper, keepers.AccountKeeper, keepers.BankKeeper, nil, newMockSubspace(types.DefaultParams())), + module: NewAppModule(encConf.Codec, keepers.WasmKeeper, keepers.AccountKeeper, keepers.BankKeeper, nil, newMockSubspace(DefaultParams)), ctx: ctx, acctKeeper: keepers.AccountKeeper, keeper: *keepers.WasmKeeper, @@ -556,7 +562,7 @@ func assertAttribute(t *testing.T, key, value string, attr abci.EventAttribute) func assertCodeList(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, expectedNum int, marshaler codec.Codec) { t.Helper() path := "/cosmwasm.wasm.v1.Query/Codes" - resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path}) + resp, sdkerr := q.Route(path)(ctx, &abci.RequestQuery{Path: path}) require.NoError(t, sdkerr) require.True(t, resp.IsOK()) @@ -577,7 +583,7 @@ func assertCodeBytes(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, require.NoError(t, err) path := "/cosmwasm.wasm.v1.Query/Code" - resp, err := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz}) + resp, err := q.Route(path)(ctx, &abci.RequestQuery{Path: path, Data: bz}) if len(expectedBytes) == 0 { require.Equal(t, types.ErrNoSuchCodeFn(codeID).Wrapf("code id %d", codeID).Error(), err.Error()) return @@ -597,7 +603,7 @@ func assertContractList(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Contex require.NoError(t, err) path := "/cosmwasm.wasm.v1.Query/ContractsByCode" - resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz}) + resp, sdkerr := q.Route(path)(ctx, &abci.RequestQuery{Path: path, Data: bz}) if len(expContractAddrs) == 0 { assert.ErrorIs(t, err, types.ErrNotFound) return @@ -622,7 +628,7 @@ func assertContractState(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Conte require.NoError(t, err) path := "/cosmwasm.wasm.v1.Query/RawContractState" - resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz}) + resp, sdkerr := q.Route(path)(ctx, &abci.RequestQuery{Path: path, Data: bz}) require.NoError(t, sdkerr) require.True(t, resp.IsOK()) bz = resp.Value @@ -640,7 +646,7 @@ func assertContractInfo(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Contex require.NoError(t, err) path := "/cosmwasm.wasm.v1.Query/ContractInfo" - resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz}) + resp, sdkerr := q.Route(path)(ctx, &abci.RequestQuery{Path: path, Data: bz}) require.NoError(t, sdkerr) require.True(t, resp.IsOK()) bz = resp.Value diff --git a/x/wasm/relay_pingpong_test.go b/x/wasm/relay_pingpong_test.go index 40af77b551..d06a460714 100644 --- a/x/wasm/relay_pingpong_test.go +++ b/x/wasm/relay_pingpong_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -137,7 +137,7 @@ type player struct { // Execute starts the ping pong game // Contracts finds all connected channels and broadcasts a ping message -func (p *player) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (p *player) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { p.execCalls++ // start game var start startGame @@ -153,39 +153,41 @@ func (p *player) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.Mes p.incrementCounter(sentBallsCountKey, store) store.Set(lastBallSentKey, sdk.Uint64ToBigEndian(start.Value)) - return &wasmvmtypes.Response{ - Messages: []wasmvmtypes.SubMsg{ - { - Msg: wasmvmtypes.CosmosMsg{ - IBC: &wasmvmtypes.IBCMsg{ - SendPacket: &wasmvmtypes.SendPacketMsg{ - ChannelID: start.ChannelID, - Data: service.GetBytes(), - Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{ - Revision: doNotTimeout.RevisionNumber, - Height: doNotTimeout.RevisionHeight, - }}, + return &wasmvmtypes.ContractResult{ + Ok: &wasmvmtypes.Response{ + Messages: []wasmvmtypes.SubMsg{ + { + Msg: wasmvmtypes.CosmosMsg{ + IBC: &wasmvmtypes.IBCMsg{ + SendPacket: &wasmvmtypes.SendPacketMsg{ + ChannelID: start.ChannelID, + Data: service.GetBytes(), + Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{ + Revision: doNotTimeout.RevisionNumber, + Height: doNotTimeout.RevisionHeight, + }}, + }, }, }, + ReplyOn: wasmvmtypes.ReplyNever, }, - ReplyOn: wasmvmtypes.ReplyNever, }, }, }, 0, nil } // OnIBCChannelOpen ensures to accept only configured version -func (p player) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { +func (p player) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { if msg.GetChannel().Version != p.actor { - return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil + return &wasmvmtypes.IBCChannelOpenResult{Ok: &wasmvmtypes.IBC3ChannelOpenResponse{}}, 0, nil } - return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil + return &wasmvmtypes.IBCChannelOpenResult{Ok: &wasmvmtypes.IBC3ChannelOpenResponse{}}, 0, nil } // OnIBCChannelConnect persists connection endpoints -func (p player) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (p player) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { p.storeEndpoint(store, msg.GetChannel()) - return &wasmvmtypes.IBCBasicResponse{}, 0, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } // connectedChannelsModel is a simple persistence model to store endpoint addresses within the contract's store @@ -210,7 +212,7 @@ func (p player) storeEndpoint(store wasmvm.KVStore, channel wasmvmtypes.IBCChann store.Set(ibcEndpointsKey, bz) } -func (p player) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (p player) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { panic("implement me") } @@ -262,7 +264,7 @@ func (p player) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmv return &wasmvmtypes.IBCReceiveResult{ Ok: &wasmvmtypes.IBCReceiveResponse{ - Attributes: wasmvmtypes.EventAttributes{ + Attributes: wasmvmtypes.Array[wasmvmtypes.EventAttribute]{ {Key: "empty-value-test"}, }, Acknowledgement: receivedBall.BuildAck().GetBytes(), @@ -272,7 +274,7 @@ func (p player) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmv } // OnIBCPacketAcknowledgement handles the packet acknowledgment frame. Stops the game on an any error -func (p player) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (p player) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { // parse received data and store var sentBall hit if err := json.Unmarshal(msg.OriginalPacket.Data, &sentBall); err != nil { @@ -291,10 +293,10 @@ func (p player) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtyp } p.incrementCounter(confirmedBallsCountKey, store) - return &wasmvmtypes.IBCBasicResponse{}, 0, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } -func (p player) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (p player) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { panic("implement me") } diff --git a/x/wasm/relay_test.go b/x/wasm/relay_test.go index 91a6a37d15..bfb906db6b 100644 --- a/x/wasm/relay_test.go +++ b/x/wasm/relay_test.go @@ -6,17 +6,17 @@ import ( "testing" "time" - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -33,20 +33,19 @@ func TestFromIBCTransferToContract(t *testing.T) { // then the contract can handle the receiving side of an ics20 transfer // that was started on chain A via ibc transfer module - transferAmount := sdk.NewInt(1) + transferAmount := sdkmath.NewInt(1) specs := map[string]struct { contract wasmtesting.IBCContractCallbacks setupContract func(t *testing.T, contract wasmtesting.IBCContractCallbacks, chain *wasmibctesting.TestChain) expChainAPendingSendPackets int expChainBPendingSendPackets int - expChainABalanceDiff math.Int - expChainBBalanceDiff math.Int + expChainABalanceDiff sdkmath.Int + expChainBBalanceDiff sdkmath.Int expErr bool }{ "ack": { contract: &ackReceiverContract{}, setupContract: func(t *testing.T, contract wasmtesting.IBCContractCallbacks, chain *wasmibctesting.TestChain) { - t.Helper() c := contract.(*ackReceiverContract) c.t = t c.chain = chain @@ -59,26 +58,24 @@ func TestFromIBCTransferToContract(t *testing.T) { "nack": { contract: &nackReceiverContract{}, setupContract: func(t *testing.T, contract wasmtesting.IBCContractCallbacks, chain *wasmibctesting.TestChain) { - t.Helper() c := contract.(*nackReceiverContract) c.t = t }, expChainAPendingSendPackets: 0, expChainBPendingSendPackets: 0, - expChainABalanceDiff: sdk.ZeroInt(), - expChainBBalanceDiff: sdk.ZeroInt(), + expChainABalanceDiff: sdkmath.ZeroInt(), + expChainBBalanceDiff: sdkmath.ZeroInt(), }, "error": { contract: &errorReceiverContract{}, setupContract: func(t *testing.T, contract wasmtesting.IBCContractCallbacks, chain *wasmibctesting.TestChain) { - t.Helper() c := contract.(*errorReceiverContract) c.t = t }, expChainAPendingSendPackets: 1, expChainBPendingSendPackets: 0, expChainABalanceDiff: transferAmount.Neg(), - expChainBBalanceDiff: sdk.ZeroInt(), + expChainBBalanceDiff: sdkmath.ZeroInt(), expErr: true, }, } @@ -187,7 +184,7 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) { // when contract is triggered to send IBCTransferMsg receiverAddress := chainB.SenderAccount.GetAddress() - coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) // start transfer from chainA to chainB startMsg := &types.MsgExecuteContract{ @@ -260,7 +257,7 @@ func TestContractCanEmulateIBCTransferMessage(t *testing.T) { // when contract is triggered to send the ibc package to chain B timeout := uint64(chainB.LastHeader.Header.Time.Add(time.Hour).UnixNano()) // enough time to not timeout receiverAddress := chainB.SenderAccount.GetAddress() - coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) // start transfer from chainA to chainB startMsg := &types.MsgExecuteContract{ @@ -337,7 +334,7 @@ func TestContractCanEmulateIBCTransferMessageWithTimeout(t *testing.T) { // when contract is triggered to send the ibc package to chain B timeout := uint64(chainB.LastHeader.Header.Time.Add(time.Nanosecond).UnixNano()) // will timeout receiverAddress := chainB.SenderAccount.GetAddress() - coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) initialContractBalance := chainA.Balance(myContractAddr, sdk.DefaultBondDenom) initialSenderBalance := chainA.Balance(chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) @@ -425,7 +422,7 @@ func TestContractEmulateIBCTransferMessageOnDiffContractIBCChannel(t *testing.T) // when contract is triggered to send the ibc package to chain B timeout := uint64(chainB.LastHeader.Header.Time.Add(time.Hour).UnixNano()) // enough time to not timeout receiverAddress := chainB.SenderAccount.GetAddress() - coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100)) // start transfer from chainA - A2 to chainB via IBC channel startMsg := &types.MsgExecuteContract{ @@ -539,7 +536,7 @@ func TestContractHandlesChannelCloseNotOwned(t *testing.T) { Msg: closeIBCChannel{ ChannelID: path.EndpointA.ChannelID, }.GetBytes(), - Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))), + Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100))), } _, err := chainA.SendMsgs(closeIBCChannelMsg) @@ -554,9 +551,9 @@ type captureCloseContract struct { closeCalled bool } -func (c *captureCloseContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (c *captureCloseContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { c.closeCalled = true - return &wasmvmtypes.IBCBasicResponse{}, 1, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 1, nil } var _ wasmtesting.IBCContractCallbacks = &sendViaIBCTransferContract{} @@ -567,7 +564,7 @@ type sendViaIBCTransferContract struct { t *testing.T } -func (s *sendViaIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (s *sendViaIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { var in startTransfer if err := json.Unmarshal(executeMsg, &in); err != nil { return nil, 0, err @@ -584,7 +581,7 @@ func (s *sendViaIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.En }, } - return &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}}, 0, nil } var _ wasmtesting.IBCContractCallbacks = &sendEmulatedIBCTransferContract{} @@ -597,7 +594,7 @@ type sendEmulatedIBCTransferContract struct { contractAddr string } -func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { var in startTransfer if err := json.Unmarshal(executeMsg, &in); err != nil { return nil, 0, err @@ -619,10 +616,10 @@ func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtyp Timeout: wasmvmtypes.IBCTimeout{Timestamp: in.Timeout}, }, } - return &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}}, 0, nil } -func (s *sendEmulatedIBCTransferContract) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (s *sendEmulatedIBCTransferContract) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { packet := msg.Packet var data ibctransfertypes.FungibleTokenPacketData @@ -632,16 +629,16 @@ func (s *sendEmulatedIBCTransferContract) IBCPacketTimeout(_ wasmvm.Checksum, _ if err := data.ValidateBasic(); err != nil { return nil, 0, err } - amount, _ := sdk.NewIntFromString(data.Amount) + amount, _ := sdkmath.NewIntFromString(data.Amount) returnTokens := &wasmvmtypes.BankMsg{ Send: &wasmvmtypes.SendMsg{ ToAddress: data.Sender, - Amount: wasmvmtypes.Coins{wasmvmtypes.NewCoin(amount.Uint64(), data.Denom)}, + Amount: wasmvmtypes.Array[wasmvmtypes.Coin]{wasmvmtypes.NewCoin(amount.Uint64(), data.Denom)}, }, } - return &wasmvmtypes.IBCBasicResponse{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{Bank: returnTokens}}}}, 0, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{Bank: returnTokens}}}}}, 0, nil } var _ wasmtesting.IBCContractCallbacks = &closeChannelContract{} @@ -650,11 +647,11 @@ type closeChannelContract struct { contractStub } -func (c *closeChannelContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { - return &wasmvmtypes.IBCBasicResponse{}, 1, nil +func (c *closeChannelContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 1, nil } -func (c *closeChannelContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { +func (c *closeChannelContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.ContractResult, uint64, error) { var in closeIBCChannel if err := json.Unmarshal(executeMsg, &in); err != nil { return nil, 0, err @@ -665,7 +662,7 @@ func (c *closeChannelContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ w }, } - return &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}, 0, nil + return &wasmvmtypes.ContractResult{Ok: &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}}, 0, nil } type closeIBCChannel struct { @@ -728,7 +725,7 @@ func (c *ackReceiverContract) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes. return &wasmvmtypes.IBCReceiveResult{Ok: &wasmvmtypes.IBCReceiveResponse{Acknowledgement: ack, Attributes: log}}, 0, nil } -func (c *ackReceiverContract) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (c *ackReceiverContract) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { var data ibctransfertypes.FungibleTokenPacketData if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(msg.OriginalPacket.Data, &data); err != nil { return nil, 0, err @@ -748,7 +745,7 @@ func (c *ackReceiverContract) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, return nil, 0, errorsmod.Wrap(err, "within our smart contract") } - return &wasmvmtypes.IBCBasicResponse{}, 0, nil + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } // contract that acts as the receiving side for an ics-20 transfer and always returns a nack. @@ -788,15 +785,15 @@ func (c *errorReceiverContract) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtype // simple helper struct that implements connection setup methods. type contractStub struct{} -func (s *contractStub) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) { - return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil +func (s *contractStub) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) { + return &wasmvmtypes.IBCChannelOpenResult{Ok: &wasmvmtypes.IBC3ChannelOpenResponse{}}, 0, nil } -func (s *contractStub) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelConnectMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { - return &wasmvmtypes.IBCBasicResponse{}, 0, nil +func (s *contractStub) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelConnectMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } -func (s *contractStub) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (s *contractStub) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { panic("implement me") } @@ -804,11 +801,11 @@ func (s *contractStub) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ panic("implement me") } -func (s *contractStub) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { - return &wasmvmtypes.IBCBasicResponse{}, 0, nil +func (s *contractStub) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { + return &wasmvmtypes.IBCBasicResult{Ok: &wasmvmtypes.IBCBasicResponse{}}, 0, nil } -func (s *contractStub) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) { +func (s *contractStub) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { panic("implement me") } diff --git a/x/wasm/simulation/genesis.go b/x/wasm/simulation/genesis.go index ce6916db0a..aa5d6ce8e1 100644 --- a/x/wasm/simulation/genesis.go +++ b/x/wasm/simulation/genesis.go @@ -14,7 +14,8 @@ func RandomizedGenState(simstate *module.SimulationState) { Codes: nil, Contracts: nil, Sequences: []types.Sequence{ - {IDKey: types.KeySequenceCodeID, Value: simstate.Rand.Uint64()}, + {IDKey: types.KeySequenceCodeID, Value: simstate.Rand.Uint64() % 1_000_000_000}, + {IDKey: types.KeySequenceInstanceID, Value: simstate.Rand.Uint64() % 1_000_000_000}, }, GenMsgs: nil, } diff --git a/x/wasm/simulation/operations.go b/x/wasm/simulation/operations.go index 6e937badb4..c284a33342 100644 --- a/x/wasm/simulation/operations.go +++ b/x/wasm/simulation/operations.go @@ -1,11 +1,12 @@ package simulation import ( + "context" "encoding/json" "math/rand" "os" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" errorsmod "cosmossdk.io/errors" @@ -13,7 +14,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -40,20 +40,20 @@ const ( // WasmKeeper is a subset of the wasm keeper used by simulations type WasmKeeper interface { GetAuthority() string - GetParams(ctx sdk.Context) types.Params - IterateCodeInfos(ctx sdk.Context, cb func(uint64, types.CodeInfo) bool) - IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) - QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) - PeekAutoIncrementID(ctx sdk.Context, lastIDKey []byte) uint64 + GetParams(ctx context.Context) types.Params + IterateCodeInfos(ctx context.Context, cb func(uint64, types.CodeInfo) bool) + IterateContractInfo(ctx context.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) + QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) + PeekAutoIncrementID(ctx context.Context, lastIDKey []byte) (uint64, error) } type BankKeeper interface { simulation.BankKeeper - IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool + IsSendEnabledCoin(ctx context.Context, coin sdk.Coin) bool } // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( - simstate *module.SimulationState, + appParams simtypes.AppParams, ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, @@ -67,42 +67,27 @@ func WeightedOperations( weightMsgMigrateContract int wasmContractPath string ) - - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgStoreCode, &weightMsgStoreCode, nil, - func(_ *rand.Rand) { - weightMsgStoreCode = params.DefaultWeightMsgStoreCode - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgInstantiateContract, &weightMsgInstantiateContract, nil, - func(_ *rand.Rand) { - weightMsgInstantiateContract = params.DefaultWeightMsgInstantiateContract - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgExecuteContract, &weightMsgInstantiateContract, nil, - func(_ *rand.Rand) { - weightMsgExecuteContract = params.DefaultWeightMsgExecuteContract - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgUpdateAdmin, &weightMsgUpdateAdmin, nil, - func(_ *rand.Rand) { - weightMsgUpdateAdmin = params.DefaultWeightMsgUpdateAdmin - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgClearAdmin, &weightMsgClearAdmin, nil, - func(_ *rand.Rand) { - weightMsgClearAdmin = params.DefaultWeightMsgClearAdmin - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgMigrateContract, &weightMsgMigrateContract, nil, - func(_ *rand.Rand) { - weightMsgMigrateContract = params.DefaultWeightMsgMigrateContract - }, - ) - simstate.AppParams.GetOrGenerate(simstate.Cdc, OpReflectContractPath, &wasmContractPath, nil, - func(_ *rand.Rand) { - wasmContractPath = "" - }, - ) + appParams.GetOrGenerate(OpWeightMsgStoreCode, &weightMsgStoreCode, nil, func(_ *rand.Rand) { + weightMsgStoreCode = params.DefaultWeightMsgStoreCode + }) + appParams.GetOrGenerate(OpWeightMsgInstantiateContract, &weightMsgInstantiateContract, nil, func(_ *rand.Rand) { + weightMsgInstantiateContract = params.DefaultWeightMsgInstantiateContract + }) + appParams.GetOrGenerate(OpWeightMsgExecuteContract, &weightMsgInstantiateContract, nil, func(_ *rand.Rand) { + weightMsgExecuteContract = params.DefaultWeightMsgExecuteContract + }) + appParams.GetOrGenerate(OpWeightMsgUpdateAdmin, &weightMsgUpdateAdmin, nil, func(_ *rand.Rand) { + weightMsgUpdateAdmin = params.DefaultWeightMsgUpdateAdmin + }) + appParams.GetOrGenerate(OpWeightMsgClearAdmin, &weightMsgClearAdmin, nil, func(_ *rand.Rand) { + weightMsgClearAdmin = params.DefaultWeightMsgClearAdmin + }) + appParams.GetOrGenerate(OpWeightMsgMigrateContract, &weightMsgMigrateContract, nil, func(_ *rand.Rand) { + weightMsgMigrateContract = params.DefaultWeightMsgMigrateContract + }) + appParams.GetOrGenerate(OpReflectContractPath, &wasmContractPath, nil, func(_ *rand.Rand) { + wasmContractPath = "" + }) var wasmBz []byte if wasmContractPath == "" { @@ -497,7 +482,6 @@ func BuildOperationInput( TxGen: txConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, AccountKeeper: ak, diff --git a/x/wasm/types/authz.go b/x/wasm/types/authz.go index 7a55dda860..0e8279703f 100644 --- a/x/wasm/types/authz.go +++ b/x/wasm/types/authz.go @@ -2,9 +2,10 @@ package types import ( "bytes" + "context" "strings" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/cosmos/gogoproto/proto" errorsmod "cosmossdk.io/errors" @@ -44,7 +45,7 @@ func (a StoreCodeAuthorization) MsgTypeURL() string { } // Accept implements Authorization.Accept. -func (a *StoreCodeAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { +func (a *StoreCodeAuthorization) Accept(ctx context.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { storeMsg, ok := msg.(*MsgStoreCode) if !ok { return authztypes.AcceptResponse{}, sdkerrors.ErrInvalidRequest.Wrap("unknown msg type") @@ -58,7 +59,8 @@ func (a *StoreCodeAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authztype if !ok { return authztypes.AcceptResponse{}, sdkerrors.ErrNotFound.Wrap("gas register") } - ctx.GasMeter().ConsumeGas(gasRegister.UncompressCosts(len(code)), "Uncompress gzip bytecode") + sdk.UnwrapSDKContext(ctx).GasMeter(). + ConsumeGas(gasRegister.UncompressCosts(len(code)), "Uncompress gzip bytecode") wasmCode, err := ioutils.Uncompress(code, int64(MaxWasmSize)) if err != nil { return authztypes.AcceptResponse{}, sdkerrors.ErrInvalidRequest.Wrap("uncompress wasm archive") @@ -163,8 +165,8 @@ func (a ContractExecutionAuthorization) NewAuthz(g []ContractGrant) authztypes.A } // Accept implements Authorization.Accept. -func (a *ContractExecutionAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { - return AcceptGrantedMessage[*MsgExecuteContract](ctx, a.Grants, msg, a) +func (a *ContractExecutionAuthorization) Accept(goCtx context.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { + return AcceptGrantedMessage[*MsgExecuteContract](sdk.UnwrapSDKContext(goCtx), a.Grants, msg, a) } // ValidateBasic implements Authorization.ValidateBasic. @@ -195,8 +197,8 @@ func (a ContractMigrationAuthorization) MsgTypeURL() string { } // Accept implements Authorization.Accept. -func (a *ContractMigrationAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { - return AcceptGrantedMessage[*MsgMigrateContract](ctx, a.Grants, msg, a) +func (a *ContractMigrationAuthorization) Accept(goCtx context.Context, msg sdk.Msg) (authztypes.AcceptResponse, error) { + return AcceptGrantedMessage[*MsgMigrateContract](sdk.UnwrapSDKContext(goCtx), a.Grants, msg, a) } // NewAuthz factory method to create an Authorization with updated grants diff --git a/x/wasm/types/authz.pb.go b/x/wasm/types/authz.pb.go index 150758ce8f..d7db1573e3 100644 --- a/x/wasm/types/authz.pb.go +++ b/x/wasm/types/authz.pb.go @@ -5,6 +5,10 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -12,15 +16,14 @@ import ( _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -41,9 +44,11 @@ func (*StoreCodeAuthorization) ProtoMessage() {} func (*StoreCodeAuthorization) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{0} } + func (m *StoreCodeAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *StoreCodeAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StoreCodeAuthorization.Marshal(b, m, deterministic) @@ -56,12 +61,15 @@ func (m *StoreCodeAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *StoreCodeAuthorization) XXX_Merge(src proto.Message) { xxx_messageInfo_StoreCodeAuthorization.Merge(m, src) } + func (m *StoreCodeAuthorization) XXX_Size() int { return m.Size() } + func (m *StoreCodeAuthorization) XXX_DiscardUnknown() { xxx_messageInfo_StoreCodeAuthorization.DiscardUnknown(m) } @@ -81,9 +89,11 @@ func (*ContractExecutionAuthorization) ProtoMessage() {} func (*ContractExecutionAuthorization) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{1} } + func (m *ContractExecutionAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ContractExecutionAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractExecutionAuthorization.Marshal(b, m, deterministic) @@ -96,12 +106,15 @@ func (m *ContractExecutionAuthorization) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *ContractExecutionAuthorization) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractExecutionAuthorization.Merge(m, src) } + func (m *ContractExecutionAuthorization) XXX_Size() int { return m.Size() } + func (m *ContractExecutionAuthorization) XXX_DiscardUnknown() { xxx_messageInfo_ContractExecutionAuthorization.DiscardUnknown(m) } @@ -121,9 +134,11 @@ func (*ContractMigrationAuthorization) ProtoMessage() {} func (*ContractMigrationAuthorization) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{2} } + func (m *ContractMigrationAuthorization) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ContractMigrationAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractMigrationAuthorization.Marshal(b, m, deterministic) @@ -136,12 +151,15 @@ func (m *ContractMigrationAuthorization) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *ContractMigrationAuthorization) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractMigrationAuthorization.Merge(m, src) } + func (m *ContractMigrationAuthorization) XXX_Size() int { return m.Size() } + func (m *ContractMigrationAuthorization) XXX_DiscardUnknown() { xxx_messageInfo_ContractMigrationAuthorization.DiscardUnknown(m) } @@ -165,9 +183,11 @@ func (*CodeGrant) ProtoMessage() {} func (*CodeGrant) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{3} } + func (m *CodeGrant) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CodeGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeGrant.Marshal(b, m, deterministic) @@ -180,12 +200,15 @@ func (m *CodeGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *CodeGrant) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeGrant.Merge(m, src) } + func (m *CodeGrant) XXX_Size() int { return m.Size() } + func (m *CodeGrant) XXX_DiscardUnknown() { xxx_messageInfo_CodeGrant.DiscardUnknown(m) } @@ -212,9 +235,11 @@ func (*ContractGrant) ProtoMessage() {} func (*ContractGrant) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{4} } + func (m *ContractGrant) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ContractGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractGrant.Marshal(b, m, deterministic) @@ -227,12 +252,15 @@ func (m *ContractGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *ContractGrant) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractGrant.Merge(m, src) } + func (m *ContractGrant) XXX_Size() int { return m.Size() } + func (m *ContractGrant) XXX_DiscardUnknown() { xxx_messageInfo_ContractGrant.DiscardUnknown(m) } @@ -252,9 +280,11 @@ func (*MaxCallsLimit) ProtoMessage() {} func (*MaxCallsLimit) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{5} } + func (m *MaxCallsLimit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MaxCallsLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MaxCallsLimit.Marshal(b, m, deterministic) @@ -267,12 +297,15 @@ func (m *MaxCallsLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *MaxCallsLimit) XXX_Merge(src proto.Message) { xxx_messageInfo_MaxCallsLimit.Merge(m, src) } + func (m *MaxCallsLimit) XXX_Size() int { return m.Size() } + func (m *MaxCallsLimit) XXX_DiscardUnknown() { xxx_messageInfo_MaxCallsLimit.DiscardUnknown(m) } @@ -292,9 +325,11 @@ func (*MaxFundsLimit) ProtoMessage() {} func (*MaxFundsLimit) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{6} } + func (m *MaxFundsLimit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MaxFundsLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MaxFundsLimit.Marshal(b, m, deterministic) @@ -307,12 +342,15 @@ func (m *MaxFundsLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *MaxFundsLimit) XXX_Merge(src proto.Message) { xxx_messageInfo_MaxFundsLimit.Merge(m, src) } + func (m *MaxFundsLimit) XXX_Size() int { return m.Size() } + func (m *MaxFundsLimit) XXX_DiscardUnknown() { xxx_messageInfo_MaxFundsLimit.DiscardUnknown(m) } @@ -335,9 +373,11 @@ func (*CombinedLimit) ProtoMessage() {} func (*CombinedLimit) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{7} } + func (m *CombinedLimit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CombinedLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CombinedLimit.Marshal(b, m, deterministic) @@ -350,12 +390,15 @@ func (m *CombinedLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *CombinedLimit) XXX_Merge(src proto.Message) { xxx_messageInfo_CombinedLimit.Merge(m, src) } + func (m *CombinedLimit) XXX_Size() int { return m.Size() } + func (m *CombinedLimit) XXX_DiscardUnknown() { xxx_messageInfo_CombinedLimit.DiscardUnknown(m) } @@ -365,8 +408,7 @@ var xxx_messageInfo_CombinedLimit proto.InternalMessageInfo // AllowAllMessagesFilter is a wildcard to allow any type of contract payload // message. // Since: wasmd 0.30 -type AllowAllMessagesFilter struct { -} +type AllowAllMessagesFilter struct{} func (m *AllowAllMessagesFilter) Reset() { *m = AllowAllMessagesFilter{} } func (m *AllowAllMessagesFilter) String() string { return proto.CompactTextString(m) } @@ -374,9 +416,11 @@ func (*AllowAllMessagesFilter) ProtoMessage() {} func (*AllowAllMessagesFilter) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{8} } + func (m *AllowAllMessagesFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AllowAllMessagesFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AllowAllMessagesFilter.Marshal(b, m, deterministic) @@ -389,12 +433,15 @@ func (m *AllowAllMessagesFilter) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *AllowAllMessagesFilter) XXX_Merge(src proto.Message) { xxx_messageInfo_AllowAllMessagesFilter.Merge(m, src) } + func (m *AllowAllMessagesFilter) XXX_Size() int { return m.Size() } + func (m *AllowAllMessagesFilter) XXX_DiscardUnknown() { xxx_messageInfo_AllowAllMessagesFilter.DiscardUnknown(m) } @@ -415,9 +462,11 @@ func (*AcceptedMessageKeysFilter) ProtoMessage() {} func (*AcceptedMessageKeysFilter) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{9} } + func (m *AcceptedMessageKeysFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AcceptedMessageKeysFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AcceptedMessageKeysFilter.Marshal(b, m, deterministic) @@ -430,12 +479,15 @@ func (m *AcceptedMessageKeysFilter) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *AcceptedMessageKeysFilter) XXX_Merge(src proto.Message) { xxx_messageInfo_AcceptedMessageKeysFilter.Merge(m, src) } + func (m *AcceptedMessageKeysFilter) XXX_Size() int { return m.Size() } + func (m *AcceptedMessageKeysFilter) XXX_DiscardUnknown() { xxx_messageInfo_AcceptedMessageKeysFilter.DiscardUnknown(m) } @@ -456,9 +508,11 @@ func (*AcceptedMessagesFilter) ProtoMessage() {} func (*AcceptedMessagesFilter) Descriptor() ([]byte, []int) { return fileDescriptor_36ff3a20cf32b258, []int{10} } + func (m *AcceptedMessagesFilter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AcceptedMessagesFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AcceptedMessagesFilter.Marshal(b, m, deterministic) @@ -471,12 +525,15 @@ func (m *AcceptedMessagesFilter) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *AcceptedMessagesFilter) XXX_Merge(src proto.Message) { xxx_messageInfo_AcceptedMessagesFilter.Merge(m, src) } + func (m *AcceptedMessagesFilter) XXX_Size() int { return m.Size() } + func (m *AcceptedMessagesFilter) XXX_DiscardUnknown() { xxx_messageInfo_AcceptedMessagesFilter.DiscardUnknown(m) } @@ -500,56 +557,59 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/authz.proto", fileDescriptor_36ff3a20cf32b258) } var fileDescriptor_36ff3a20cf32b258 = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0x02, 0x1f, 0x1f, 0x1d, 0xe0, 0xfb, 0xb1, 0xe1, 0x6b, 0x5a, 0x20, 0x5b, 0xb2, 0xdf, - 0xaf, 0x4a, 0xd2, 0xdd, 0x14, 0xe3, 0xa5, 0x07, 0x4d, 0x5b, 0x45, 0x8d, 0x60, 0xcc, 0xaa, 0x81, - 0x78, 0x69, 0xa6, 0xdb, 0x61, 0x3b, 0xb2, 0x3b, 0xd3, 0xec, 0x4c, 0x81, 0x92, 0x18, 0xef, 0x9e, - 0xbc, 0x79, 0xf5, 0x68, 0x3c, 0x71, 0xe8, 0xd1, 0x3f, 0x80, 0x70, 0xe2, 0x68, 0x3c, 0xa0, 0x42, - 0x0c, 0xff, 0x83, 0x27, 0xb3, 0x33, 0xd3, 0x96, 0x96, 0x42, 0x90, 0x13, 0x97, 0xed, 0xce, 0xfb, - 0xce, 0xfb, 0x3e, 0xcf, 0x33, 0xf3, 0xf4, 0x5d, 0x30, 0xeb, 0x52, 0x16, 0x6c, 0x42, 0x16, 0xd8, - 0xe2, 0xb1, 0x91, 0xb3, 0x61, 0x83, 0xd7, 0xb6, 0xad, 0x7a, 0x48, 0x39, 0xd5, 0xff, 0x68, 0x67, - 0x2d, 0xf1, 0xd8, 0xc8, 0x4d, 0x4f, 0x79, 0xd4, 0xa3, 0x22, 0x69, 0x47, 0x6f, 0x72, 0xdf, 0x74, - 0x2a, 0xda, 0x47, 0x59, 0x59, 0x26, 0xe4, 0x42, 0xa5, 0x0c, 0xb9, 0xb2, 0x2b, 0x90, 0x21, 0x7b, - 0x23, 0x57, 0x41, 0x1c, 0xe6, 0x6c, 0x97, 0x62, 0xa2, 0xf2, 0xa7, 0x09, 0xf0, 0x66, 0x1d, 0xb5, - 0xab, 0x53, 0x1e, 0xa5, 0x9e, 0x8f, 0x6c, 0xb1, 0xaa, 0x34, 0xd6, 0x6c, 0x48, 0x9a, 0x2a, 0xf5, - 0x27, 0x0c, 0x30, 0xa1, 0xb6, 0x78, 0xca, 0x90, 0xf9, 0x56, 0x03, 0x89, 0xc7, 0x9c, 0x86, 0xa8, - 0x44, 0xab, 0xa8, 0xd0, 0xe0, 0x35, 0x1a, 0xe2, 0x6d, 0xc8, 0x31, 0x25, 0xfa, 0x4d, 0x30, 0xea, - 0x85, 0x90, 0x70, 0x96, 0xd4, 0xe6, 0x86, 0x33, 0xe3, 0x0b, 0x33, 0x56, 0xbf, 0x34, 0x2b, 0x2a, - 0xba, 0x1b, 0xed, 0x29, 0xc6, 0x77, 0x0f, 0xd2, 0xb1, 0x77, 0xc7, 0x3b, 0xf3, 0x9a, 0xa3, 0xaa, - 0xf2, 0x8b, 0x7b, 0xad, 0xac, 0xa9, 0x84, 0xc9, 0x13, 0x52, 0x5a, 0xac, 0x1e, 0x9c, 0x57, 0xc7, - 0x3b, 0xf3, 0x33, 0x42, 0xc8, 0x60, 0x1e, 0x66, 0x4b, 0x03, 0x46, 0x89, 0x12, 0x1e, 0x42, 0x97, - 0xdf, 0xd9, 0x42, 0x6e, 0x23, 0x8a, 0xf6, 0x52, 0x2d, 0xf6, 0x51, 0x4d, 0x0f, 0xa2, 0x2a, 0x3b, - 0x9c, 0x49, 0xf7, 0xe1, 0xc5, 0xe9, 0xfe, 0x2d, 0xe8, 0x9e, 0xcf, 0xa9, 0x87, 0xf6, 0x32, 0xf6, - 0x42, 0x78, 0xc5, 0x68, 0x0f, 0xe6, 0x64, 0xbe, 0x04, 0xf1, 0xce, 0xad, 0xea, 0x33, 0x20, 0xee, - 0xd2, 0x2a, 0x2a, 0xd7, 0x20, 0xab, 0x25, 0xb5, 0x39, 0x2d, 0x33, 0xe1, 0x8c, 0x45, 0x81, 0x7b, - 0x90, 0xd5, 0xf4, 0xa7, 0x20, 0x81, 0x09, 0xe3, 0x90, 0x70, 0x0c, 0x39, 0x2a, 0xd7, 0x51, 0x18, - 0x60, 0xc6, 0x30, 0x25, 0xc9, 0xa1, 0x39, 0x2d, 0x33, 0xbe, 0x60, 0x9c, 0x56, 0x53, 0x70, 0x5d, - 0xc4, 0x58, 0x89, 0x92, 0x35, 0xec, 0x39, 0x7f, 0x9d, 0xa8, 0x7e, 0xd4, 0x29, 0x36, 0x3f, 0x69, - 0x60, 0xb2, 0x47, 0xb5, 0x3e, 0x0d, 0xc6, 0x5c, 0x15, 0x10, 0x24, 0xe2, 0x4e, 0x67, 0xad, 0x3f, - 0x01, 0xbf, 0xf8, 0x38, 0xc0, 0x5c, 0x61, 0x4e, 0x59, 0xd2, 0xfd, 0x56, 0xdb, 0xfd, 0x56, 0x81, - 0x34, 0x8b, 0x99, 0xbd, 0x56, 0xf6, 0x9f, 0x33, 0x8f, 0x36, 0xd2, 0xbf, 0xbd, 0x14, 0x35, 0x59, - 0x75, 0x64, 0x33, 0x7d, 0x05, 0x8c, 0xae, 0x61, 0x9f, 0xa3, 0x30, 0x39, 0x7c, 0x4e, 0xdb, 0x6b, - 0x7b, 0xad, 0xec, 0xbf, 0xe7, 0xb7, 0x5d, 0x14, 0x5d, 0x56, 0x1d, 0xd5, 0xce, 0x24, 0x60, 0x72, - 0x19, 0x6e, 0x95, 0xa0, 0xef, 0x33, 0x81, 0xa8, 0xcf, 0x82, 0x78, 0x88, 0x02, 0x88, 0x09, 0x26, - 0x9e, 0x10, 0x37, 0xe2, 0x74, 0x03, 0xf9, 0x5b, 0x17, 0x25, 0x1e, 0x5d, 0xaf, 0x2e, 0xae, 0xb7, - 0xa7, 0xbd, 0xf9, 0x41, 0x13, 0x80, 0x8b, 0x0d, 0x52, 0x55, 0x80, 0xcf, 0xc1, 0xaf, 0x30, 0xa0, - 0x8d, 0xae, 0xe9, 0x52, 0x96, 0x72, 0x4f, 0x34, 0x6e, 0x3a, 0xe6, 0x29, 0x51, 0x4c, 0x8a, 0x37, - 0x22, 0xbb, 0xbd, 0xff, 0x9c, 0xce, 0x78, 0x98, 0xd7, 0x1a, 0x15, 0xcb, 0xa5, 0x81, 0x9a, 0x54, - 0xea, 0x27, 0xcb, 0xaa, 0xeb, 0x6a, 0xf8, 0x44, 0x05, 0x4c, 0x5a, 0xb3, 0x0d, 0x70, 0x49, 0xfa, - 0x5d, 0xb2, 0xe6, 0x37, 0xe1, 0x85, 0xa0, 0x82, 0x09, 0xaa, 0x4a, 0xfa, 0xff, 0x83, 0xdf, 0xdd, - 0x48, 0x5e, 0xb9, 0xff, 0xd4, 0x7e, 0x13, 0x61, 0xa7, 0x1d, 0x3d, 0xa9, 0x73, 0xe8, 0x0a, 0xea, - 0xec, 0x51, 0x65, 0xba, 0x20, 0x51, 0xf0, 0x7d, 0xba, 0x59, 0xf0, 0xfd, 0x65, 0xc4, 0x18, 0xf4, - 0x10, 0x93, 0xce, 0xc9, 0xdf, 0xbf, 0xb0, 0xc7, 0xba, 0x73, 0x74, 0x70, 0x2b, 0xf3, 0x05, 0x48, - 0x45, 0xff, 0xbf, 0x3a, 0x47, 0x55, 0x95, 0x79, 0x80, 0x9a, 0x2a, 0xa9, 0xeb, 0x60, 0x64, 0x1d, - 0x35, 0xa5, 0x27, 0xe2, 0x8e, 0x78, 0xcf, 0x2f, 0xfd, 0x14, 0xb6, 0x21, 0xb1, 0xcf, 0x42, 0x30, - 0xdf, 0x68, 0x20, 0xd1, 0x97, 0x6d, 0x83, 0x2f, 0x80, 0xb1, 0x40, 0x45, 0x04, 0x81, 0x89, 0x62, - 0xe2, 0xfb, 0x41, 0x5a, 0x77, 0xe0, 0x66, 0x67, 0x58, 0xc9, 0xb4, 0xd3, 0xd9, 0x77, 0xb9, 0x83, - 0x19, 0x08, 0x5f, 0xbc, 0xbd, 0xfb, 0xd5, 0x88, 0xed, 0x1e, 0x1a, 0xda, 0xfe, 0xa1, 0xa1, 0x7d, - 0x39, 0x34, 0xb4, 0xd7, 0x47, 0x46, 0x6c, 0xff, 0xc8, 0x88, 0x7d, 0x3c, 0x32, 0x62, 0xcf, 0xfe, - 0x3b, 0x61, 0x8a, 0x12, 0x65, 0xc1, 0x4a, 0xfb, 0xc3, 0x5b, 0xb5, 0xb7, 0xe4, 0x07, 0x58, 0x18, - 0xa3, 0x32, 0x2a, 0x66, 0xc3, 0xf5, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x55, 0xf8, 0x5e, 0x18, - 0x1f, 0x08, 0x00, 0x00, + // 817 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcf, 0x4f, 0x33, 0x45, + 0x18, 0xee, 0x7e, 0xdf, 0x27, 0xd2, 0x81, 0xcf, 0x1f, 0x1b, 0x6c, 0x5a, 0x20, 0x5b, 0xb2, 0x2a, + 0x56, 0x92, 0xee, 0xa6, 0xe8, 0xa9, 0x07, 0x4d, 0xb7, 0x5a, 0x35, 0x82, 0x31, 0x8b, 0x06, 0xe2, + 0xa5, 0x99, 0xee, 0x0e, 0xdb, 0x91, 0xdd, 0x99, 0x66, 0x67, 0x0a, 0x14, 0x63, 0xbc, 0x7b, 0xf2, + 0xec, 0xc9, 0x9b, 0xc6, 0x13, 0x87, 0xfe, 0x11, 0x84, 0xc4, 0x84, 0x78, 0xf2, 0x84, 0x0a, 0x07, + 0xfe, 0x01, 0xe3, 0xc1, 0x93, 0x99, 0x1f, 0x6d, 0x69, 0x29, 0x04, 0x39, 0xf9, 0x5d, 0xa6, 0x9d, + 0xf7, 0x9d, 0xf7, 0x7d, 0x9f, 0xe7, 0x9d, 0x67, 0xde, 0x05, 0xcb, 0x01, 0x65, 0xc9, 0x01, 0x64, + 0x89, 0x2b, 0x97, 0xfd, 0x8a, 0x0b, 0xbb, 0xbc, 0x7d, 0xe4, 0x74, 0x52, 0xca, 0xa9, 0xf9, 0xd2, + 0xc0, 0xeb, 0xc8, 0x65, 0xbf, 0xb2, 0xb8, 0x10, 0xd1, 0x88, 0x4a, 0xa7, 0x2b, 0xfe, 0xa9, 0x73, + 0x8b, 0x05, 0x71, 0x8e, 0xb2, 0xa6, 0x72, 0xa8, 0x8d, 0x76, 0x59, 0x6a, 0xe7, 0xb6, 0x20, 0x43, + 0xee, 0x7e, 0xa5, 0x85, 0x38, 0xac, 0xb8, 0x01, 0xc5, 0x44, 0xfb, 0x6f, 0x02, 0xe0, 0xbd, 0x0e, + 0x1a, 0x44, 0x17, 0x22, 0x4a, 0xa3, 0x18, 0xb9, 0x72, 0xd7, 0xea, 0xee, 0xba, 0x90, 0xf4, 0xb4, + 0xeb, 0x65, 0x98, 0x60, 0x42, 0x5d, 0xb9, 0x2a, 0x93, 0xfd, 0x83, 0x01, 0x72, 0x5b, 0x9c, 0xa6, + 0xa8, 0x4e, 0x43, 0x54, 0xeb, 0xf2, 0x36, 0x4d, 0xf1, 0x11, 0xe4, 0x98, 0x12, 0xf3, 0x1d, 0x30, + 0x13, 0xa5, 0x90, 0x70, 0x96, 0x37, 0x56, 0x1e, 0x97, 0xe6, 0xd6, 0x97, 0x9c, 0x49, 0x6a, 0x8e, + 0x08, 0xfa, 0x40, 0x9c, 0xf1, 0xb2, 0x27, 0xe7, 0xc5, 0xcc, 0x4f, 0x57, 0xc7, 0x6b, 0x86, 0xaf, + 0xa3, 0xaa, 0x8d, 0xd3, 0x7e, 0xd9, 0xd6, 0xc4, 0x54, 0x87, 0x34, 0x17, 0x67, 0xac, 0xce, 0xb7, + 0x57, 0xc7, 0x6b, 0x4b, 0x92, 0xc8, 0x74, 0x1c, 0x76, 0xdf, 0x00, 0x56, 0x9d, 0x12, 0x9e, 0xc2, + 0x80, 0xbf, 0x7f, 0x88, 0x82, 0xae, 0xb0, 0x8e, 0x43, 0xf5, 0x26, 0xa0, 0x16, 0xa7, 0x41, 0x55, + 0x19, 0x6e, 0x85, 0xfb, 0xc9, 0xfd, 0xe1, 0xbe, 0x2a, 0xe1, 0xde, 0x8d, 0x69, 0x0c, 0xf6, 0x26, + 0x8e, 0x52, 0xf8, 0x3f, 0x83, 0x3d, 0x1d, 0x93, 0xfd, 0x0d, 0xc8, 0x0e, 0x6f, 0xd5, 0x5c, 0x02, + 0xd9, 0x80, 0x86, 0xa8, 0xd9, 0x86, 0xac, 0x9d, 0x37, 0x56, 0x8c, 0xd2, 0xbc, 0x3f, 0x2b, 0x0c, + 0x1f, 0x42, 0xd6, 0x36, 0x3f, 0x07, 0x39, 0x4c, 0x18, 0x87, 0x84, 0x63, 0xc8, 0x51, 0xb3, 0x83, + 0xd2, 0x04, 0x33, 0x86, 0x29, 0xc9, 0x3f, 0x5a, 0x31, 0x4a, 0x73, 0xeb, 0xd6, 0x4d, 0x36, 0xb5, + 0x20, 0x40, 0x8c, 0xd5, 0x29, 0xd9, 0xc5, 0x91, 0xff, 0xca, 0xb5, 0xe8, 0x4f, 0x87, 0xc1, 0xf6, + 0x5f, 0x06, 0x78, 0x3a, 0xc6, 0xda, 0x7c, 0x1b, 0xcc, 0x06, 0xda, 0x20, 0x41, 0x64, 0xbd, 0xfc, + 0xaf, 0xfd, 0xf2, 0x82, 0x26, 0x5d, 0x0b, 0xc3, 0x14, 0x31, 0xb6, 0xc5, 0x53, 0x4c, 0x22, 0x7f, + 0x78, 0xd2, 0xfc, 0x0c, 0x3c, 0x17, 0xe3, 0x04, 0x73, 0x8d, 0x66, 0xc1, 0x51, 0xef, 0xc2, 0x19, + 0xbc, 0x0b, 0xa7, 0x46, 0x7a, 0x5e, 0xe9, 0xb4, 0x5f, 0x7e, 0xed, 0xd6, 0xa6, 0x8b, 0xce, 0x1c, + 0x6d, 0x88, 0x24, 0x3b, 0xbe, 0x4a, 0x66, 0x6e, 0x83, 0x99, 0x5d, 0x1c, 0x73, 0x94, 0xe6, 0x1f, + 0xdf, 0x91, 0xf6, 0xcd, 0xd3, 0x7e, 0xf9, 0xf5, 0xbb, 0xd3, 0x36, 0x64, 0x96, 0x1d, 0x5f, 0xa7, + 0xb3, 0x09, 0x78, 0xba, 0x09, 0x0f, 0xeb, 0x30, 0x8e, 0x99, 0xac, 0x68, 0x2e, 0x83, 0x6c, 0x8a, + 0x12, 0x88, 0x09, 0x26, 0x91, 0xa4, 0xfd, 0xc4, 0x1f, 0x19, 0xaa, 0xef, 0xde, 0x17, 0xb8, 0xb8, + 0x78, 0x53, 0x5e, 0xfc, 0x58, 0x7a, 0xfb, 0x17, 0x43, 0x16, 0x6c, 0x74, 0x49, 0xa8, 0x0b, 0x7e, + 0x05, 0x9e, 0x87, 0x09, 0xed, 0x8e, 0xe4, 0x58, 0x70, 0x74, 0x8b, 0xc5, 0x20, 0x1a, 0xca, 0xaa, + 0x4e, 0x31, 0xf1, 0x1a, 0x42, 0x88, 0x3f, 0xff, 0x5e, 0x2c, 0x45, 0x98, 0xb7, 0xbb, 0x2d, 0x27, + 0xa0, 0x89, 0x9e, 0x61, 0xfa, 0xa7, 0xcc, 0xc2, 0x3d, 0x3d, 0x96, 0x44, 0x00, 0xfb, 0xfe, 0xea, + 0x78, 0x6d, 0x3e, 0x46, 0x11, 0x0c, 0x7a, 0x4d, 0x31, 0xca, 0x98, 0x52, 0xf1, 0xa0, 0xe2, 0x03, + 0xf9, 0x8c, 0xd0, 0xdb, 0x7f, 0x4b, 0xd9, 0x24, 0x2d, 0x4c, 0x50, 0xa8, 0xf8, 0xbc, 0x01, 0x5e, + 0x0c, 0x04, 0xdf, 0xe6, 0x64, 0x1b, 0x5f, 0x90, 0x66, 0x7f, 0x60, 0xbd, 0x4e, 0xfc, 0xd1, 0xb3, + 0x40, 0x7c, 0x8c, 0xa6, 0x1d, 0x80, 0x5c, 0x2d, 0x8e, 0xe9, 0x41, 0x2d, 0x8e, 0x37, 0x11, 0x63, + 0x30, 0x42, 0x4c, 0x69, 0xab, 0xfa, 0xd1, 0xbd, 0x55, 0x38, 0x9a, 0xc1, 0xd3, 0x53, 0xd9, 0x5f, + 0x83, 0x82, 0x78, 0xbb, 0x1d, 0x8e, 0x42, 0xed, 0xf9, 0x18, 0xf5, 0xb4, 0xd3, 0x34, 0xc1, 0x93, + 0x3d, 0xd4, 0x53, 0xaa, 0xc9, 0xfa, 0xf2, 0x7f, 0x75, 0xe3, 0x3f, 0xd5, 0xb6, 0x54, 0xed, 0xdb, + 0x2a, 0xd8, 0x3f, 0x1a, 0x20, 0x37, 0xe1, 0x1d, 0x14, 0xf7, 0xc0, 0x6c, 0xa2, 0x2d, 0x12, 0xc0, + 0xbc, 0xb7, 0xfa, 0xcf, 0x79, 0xd1, 0xf4, 0xe1, 0xc1, 0x70, 0xd0, 0x29, 0xb7, 0xb8, 0x88, 0x39, + 0x4c, 0x62, 0x4c, 0x50, 0xf3, 0x4b, 0x46, 0x89, 0x3f, 0x8c, 0x7b, 0x58, 0xa3, 0xa6, 0xc2, 0xf1, + 0xde, 0x3b, 0xf9, 0xd3, 0xca, 0x9c, 0x5c, 0x58, 0xc6, 0xd9, 0x85, 0x65, 0xfc, 0x71, 0x61, 0x19, + 0xdf, 0x5d, 0x5a, 0x99, 0xb3, 0x4b, 0x2b, 0xf3, 0xdb, 0xa5, 0x95, 0xf9, 0x62, 0xf5, 0x9a, 0x6a, + 0xea, 0x94, 0x25, 0xdb, 0x83, 0x8f, 0x78, 0xe8, 0x1e, 0xaa, 0x8f, 0xb9, 0x54, 0x4e, 0x6b, 0x46, + 0x4e, 0x93, 0xb7, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xf0, 0x2f, 0x8c, 0x6b, 0x08, 0x00, + 0x00, } func (m *StoreCodeAuthorization) Marshal() (dAtA []byte, err error) { @@ -964,6 +1024,7 @@ func encodeVarintAuthz(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *StoreCodeAuthorization) Size() (n int) { if m == nil { return 0 @@ -1134,9 +1195,11 @@ func (m *AcceptedMessagesFilter) Size() (n int) { func sovAuthz(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozAuthz(x uint64) (n int) { return sovAuthz(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *StoreCodeAuthorization) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1221,6 +1284,7 @@ func (m *StoreCodeAuthorization) Unmarshal(dAtA []byte) error { } return nil } + func (m *ContractExecutionAuthorization) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1305,6 +1369,7 @@ func (m *ContractExecutionAuthorization) Unmarshal(dAtA []byte) error { } return nil } + func (m *ContractMigrationAuthorization) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1389,6 +1454,7 @@ func (m *ContractMigrationAuthorization) Unmarshal(dAtA []byte) error { } return nil } + func (m *CodeGrant) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1509,6 +1575,7 @@ func (m *CodeGrant) Unmarshal(dAtA []byte) error { } return nil } + func (m *ContractGrant) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1663,6 +1730,7 @@ func (m *ContractGrant) Unmarshal(dAtA []byte) error { } return nil } + func (m *MaxCallsLimit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1732,6 +1800,7 @@ func (m *MaxCallsLimit) Unmarshal(dAtA []byte) error { } return nil } + func (m *MaxFundsLimit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1816,6 +1885,7 @@ func (m *MaxFundsLimit) Unmarshal(dAtA []byte) error { } return nil } + func (m *CombinedLimit) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1919,6 +1989,7 @@ func (m *CombinedLimit) Unmarshal(dAtA []byte) error { } return nil } + func (m *AllowAllMessagesFilter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1969,6 +2040,7 @@ func (m *AllowAllMessagesFilter) Unmarshal(dAtA []byte) error { } return nil } + func (m *AcceptedMessageKeysFilter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2051,6 +2123,7 @@ func (m *AcceptedMessageKeysFilter) Unmarshal(dAtA []byte) error { } return nil } + func (m *AcceptedMessagesFilter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2133,6 +2206,7 @@ func (m *AcceptedMessagesFilter) Unmarshal(dAtA []byte) error { } return nil } + func skipAuthz(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/authz_test.go b/x/wasm/types/authz_test.go index 65667218b9..f846691988 100644 --- a/x/wasm/types/authz_test.go +++ b/x/wasm/types/authz_test.go @@ -5,11 +5,13 @@ import ( "strings" "testing" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -97,7 +99,7 @@ func TestContractAuthzFilterAccept(t *testing.T) { filter ContractAuthzFilterX src RawContractMessage exp bool - expGasConsumed sdk.Gas + expGasConsumed storetypes.Gas expErr bool }{ "allow all - accepts json obj": { @@ -119,25 +121,25 @@ func TestContractAuthzFilterAccept(t *testing.T) { filter: NewAcceptedMessageKeysFilter("foo"), src: []byte(`{"foo": "bar"}`), exp: true, - expGasConsumed: sdk.Gas(len(`{"foo": "bar"}`)), + expGasConsumed: storetypes.Gas(len(`{"foo": "bar"}`)), }, "allowed key - multiple": { filter: NewAcceptedMessageKeysFilter("foo", "other"), src: []byte(`{"other": "value"}`), exp: true, - expGasConsumed: sdk.Gas(len(`{"other": "value"}`)), + expGasConsumed: storetypes.Gas(len(`{"other": "value"}`)), }, "allowed key - non accepted key": { filter: NewAcceptedMessageKeysFilter("foo"), src: []byte(`{"bar": "value"}`), exp: false, - expGasConsumed: sdk.Gas(len(`{"bar": "value"}`)), + expGasConsumed: storetypes.Gas(len(`{"bar": "value"}`)), }, "allowed key - unsupported array msg": { filter: NewAcceptedMessageKeysFilter("foo", "other"), src: []byte(`[{"foo":"bar"}]`), expErr: false, - expGasConsumed: sdk.Gas(len(`[{"foo":"bar"}]`)), + expGasConsumed: storetypes.Gas(len(`[{"foo":"bar"}]`)), }, "allowed key - invalid msg": { filter: NewAcceptedMessageKeysFilter("foo", "other"), @@ -177,7 +179,7 @@ func TestContractAuthzFilterAccept(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - gm := sdk.NewGasMeter(1_000_000) + gm := storetypes.NewGasMeter(1_000_000) allowed, gotErr := spec.filter.Accept(sdk.Context{}.WithGasMeter(gm), spec.src) // then @@ -193,7 +195,7 @@ func TestContractAuthzFilterAccept(t *testing.T) { } func TestContractAuthzLimitValidate(t *testing.T) { - oneToken := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()) + oneToken := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()) specs := map[string]struct { src ContractAuthzLimitX expErr bool @@ -220,11 +222,11 @@ func TestContractAuthzLimitValidate(t *testing.T) { expErr: true, }, "max funds - contains empty value": { - src: &MaxFundsLimit{Amounts: sdk.Coins{oneToken, sdk.NewCoin("other", sdk.ZeroInt())}.Sort()}, + src: &MaxFundsLimit{Amounts: sdk.Coins{oneToken, sdk.NewCoin("other", sdkmath.ZeroInt())}.Sort()}, expErr: true, }, "max funds - unsorted": { - src: &MaxFundsLimit{Amounts: sdk.Coins{oneToken, sdk.NewCoin("other", sdk.OneInt())}}, + src: &MaxFundsLimit{Amounts: sdk.Coins{oneToken, sdk.NewCoin("other", sdkmath.OneInt())}}, expErr: true, }, "combined": { @@ -260,8 +262,8 @@ func TestContractAuthzLimitValidate(t *testing.T) { } func TestContractAuthzLimitAccept(t *testing.T) { - oneToken := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()) - otherToken := sdk.NewCoin("other", sdk.OneInt()) + oneToken := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt()) + otherToken := sdk.NewCoin("other", sdkmath.OneInt()) specs := map[string]struct { limit ContractAuthzLimitX src AuthzableWasmMsg @@ -280,7 +282,7 @@ func TestContractAuthzLimitAccept(t *testing.T) { }, "max calls - accepted with zero fund set": { limit: NewMaxCallsLimit(1), - src: &MsgExecuteContract{Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.ZeroInt()))}, + src: &MsgExecuteContract{Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.ZeroInt()))}, exp: &ContractAuthzLimitAcceptResult{Accepted: true, DeleteLimit: true}, }, "max calls - rejected with some fund transfer": { @@ -558,7 +560,7 @@ func TestAcceptGrantedMessage(t *testing.T) { }, }, "accepted and not updated - limit not touched": { - auth: NewContractExecutionAuthorization(mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), NewAllowAllMessagesFilter())), + auth: NewContractExecutionAuthorization(mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), NewAllowAllMessagesFilter())), msg: &MsgExecuteContract{ Sender: sdk.AccAddress(randBytes(SDKAddrLen)).String(), Contract: myContractAddr.String(), @@ -593,21 +595,21 @@ func TestAcceptGrantedMessage(t *testing.T) { "accepted and updated - multi, one updated": { auth: NewContractExecutionAuthorization( mustGrant(otherContractAddr, NewMaxCallsLimit(1), NewAllowAllMessagesFilter()), - mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2))), NewAcceptedMessageKeysFilter("bar")), - mustGrant(myContractAddr, NewCombinedLimit(2, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2))), NewAcceptedMessageKeysFilter("foo")), + mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2))), NewAcceptedMessageKeysFilter("bar")), + mustGrant(myContractAddr, NewCombinedLimit(2, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2))), NewAcceptedMessageKeysFilter("foo")), ), msg: &MsgExecuteContract{ Sender: sdk.AccAddress(randBytes(SDKAddrLen)).String(), Contract: myContractAddr.String(), Msg: []byte(`{"foo":"bar"}`), - Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), + Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), }, expResult: authztypes.AcceptResponse{ Accept: true, Updated: NewContractExecutionAuthorization( mustGrant(otherContractAddr, NewMaxCallsLimit(1), NewAllowAllMessagesFilter()), - mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2))), NewAcceptedMessageKeysFilter("bar")), - mustGrant(myContractAddr, NewCombinedLimit(1, sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1))), NewAcceptedMessageKeysFilter("foo")), + mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2))), NewAcceptedMessageKeysFilter("bar")), + mustGrant(myContractAddr, NewCombinedLimit(1, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))), NewAcceptedMessageKeysFilter("foo")), ), }, }, @@ -626,17 +628,17 @@ func TestAcceptGrantedMessage(t *testing.T) { Sender: sdk.AccAddress(randBytes(SDKAddrLen)).String(), Contract: myContractAddr.String(), Msg: []byte(`{"foo":"bar"}`), - Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), + Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), }, expResult: authztypes.AcceptResponse{Accept: false}, }, "not accepted - funds exceeds limit": { - auth: NewContractExecutionAuthorization(mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), NewAllowAllMessagesFilter())), + auth: NewContractExecutionAuthorization(mustGrant(myContractAddr, NewMaxFundsLimit(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), NewAllowAllMessagesFilter())), msg: &MsgExecuteContract{ Sender: sdk.AccAddress(randBytes(SDKAddrLen)).String(), Contract: myContractAddr.String(), Msg: []byte(`{"foo":"bar"}`), - Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2))), + Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(2))), }, expResult: authztypes.AcceptResponse{Accept: false}, }, @@ -646,7 +648,7 @@ func TestAcceptGrantedMessage(t *testing.T) { Sender: sdk.AccAddress(randBytes(SDKAddrLen)).String(), Contract: myContractAddr.String(), Msg: []byte(`{"foo":"bar"}`), - Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())), + Funds: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.OneInt())), }, expResult: authztypes.AcceptResponse{Accept: false}, }, @@ -711,7 +713,7 @@ func TestAcceptGrantedMessage(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - ctx := sdk.Context{}.WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx := sdk.Context{}.WithGasMeter(storetypes.NewInfiniteGasMeter()) gotResult, gotErr := spec.auth.Accept(ctx, spec.msg) if spec.expErr != nil { require.ErrorIs(t, gotErr, spec.expErr) @@ -959,7 +961,7 @@ func TestStoreCodeAuthorizationAccept(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - ctx := sdk.Context{}.WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx := sdk.Context{}.WithGasMeter(storetypes.NewInfiniteGasMeter()) gotResult, gotErr := spec.auth.Accept(ctx, spec.msg) if spec.expErr != nil { require.ErrorIs(t, gotErr, spec.expErr) diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go index 45f6677b10..277af11d5f 100644 --- a/x/wasm/types/codec.go +++ b/x/wasm/types/codec.go @@ -3,14 +3,10 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" "github.com/cosmos/cosmos-sdk/x/authz" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the concrete types and interface @@ -132,23 +128,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &StoreAndInstantiateContractProposal{}, ) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/wasm module codec. - - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/wasm/types/context.go b/x/wasm/types/context.go index 006e397624..60d5dedc04 100644 --- a/x/wasm/types/context.go +++ b/x/wasm/types/context.go @@ -1,6 +1,8 @@ package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -25,7 +27,7 @@ func WithTXCounter(ctx sdk.Context, counter uint32) sdk.Context { // TXCounter returns the tx counter value and found bool from the context. // The result will be (0, false) for external queries or simulations where no counter available. -func TXCounter(ctx sdk.Context) (uint32, bool) { +func TXCounter(ctx context.Context) (uint32, bool) { val, ok := ctx.Value(contextKeyTXCount).(uint32) return val, ok } @@ -36,7 +38,7 @@ func WithQueryStackSize(ctx sdk.Context, counter uint32) sdk.Context { } // QueryStackSize reads the stack position for smart queries from the context -func QueryStackSize(ctx sdk.Context) (uint32, bool) { +func QueryStackSize(ctx context.Context) (uint32, bool) { val, ok := ctx.Value(contextKeyQueryStackSize).(uint32) return val, ok } @@ -50,7 +52,7 @@ func WithSubMsgAuthzPolicy(ctx sdk.Context, policy AuthorizationPolicy) sdk.Cont } // SubMsgAuthzPolicy reads the authorization policy for submessages from the context -func SubMsgAuthzPolicy(ctx sdk.Context) (AuthorizationPolicy, bool) { +func SubMsgAuthzPolicy(ctx context.Context) (AuthorizationPolicy, bool) { val, ok := ctx.Value(contextKeySubMsgAuthzPolicy).(AuthorizationPolicy) return val, ok } @@ -64,7 +66,7 @@ func WithGasRegister(ctx sdk.Context, gr GasRegister) sdk.Context { } // GasRegisterFromContext reads the gas register from the context -func GasRegisterFromContext(ctx sdk.Context) (GasRegister, bool) { +func GasRegisterFromContext(ctx context.Context) (GasRegister, bool) { val, ok := ctx.Value(contextKeyGasRegister).(GasRegister) return val, ok } diff --git a/x/wasm/types/errors.go b/x/wasm/types/errors.go index 58aa5caf1a..00ea45dc68 100644 --- a/x/wasm/types/errors.go +++ b/x/wasm/types/errors.go @@ -1,7 +1,7 @@ package types import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" errorsmod "cosmossdk.io/errors" ) @@ -86,6 +86,9 @@ var ( ErrNoSuchCodeFn = WasmVMFlavouredErrorFactory(errorsmod.Register(DefaultCodespace, 28, "no such code"), func(id uint64) error { return wasmvmtypes.NoSuchCode{CodeID: id} }, ) + + // ErrVMError means an error occurred in wasmvm (not in the contract itself, but in the host environment) + ErrVMError = errorsmod.Register(DefaultCodespace, 29, "wasmvm error") ) // WasmVMErrorable mapped error type in wasmvm and are not redacted @@ -149,3 +152,34 @@ func (e WasmVMFlavouredError) Wrap(desc string) error { return errorsmod.Wrap(e, func (e WasmVMFlavouredError) Wrapf(desc string, args ...interface{}) error { return errorsmod.Wrapf(e, desc, args...) } + +// DeterministicError is a wrapper type around an error that the creator guarantees to have +// a deterministic error message. +// This means that the `Error()` function must always return the same string on all nodes. +// The DeterministicError has the same error message as the wrapped error. +// DeterministicErrors are not redacted when returned to a contract, +// so not upholding this guarantee can lead to consensus failures. +type DeterministicError struct { + error +} + +var _ error = DeterministicError{} + +// MarkErrorDeterministic marks an error as deterministic. +// Make sure to only do that if the error message is deterministic between systems. +// See [DeterministicError] for more details. +func MarkErrorDeterministic(e error) DeterministicError { + return DeterministicError{error: e} +} + +// Unwrap implements the built-in errors.Unwrap +func (e DeterministicError) Unwrap() error { + return e.error +} + +// Cause is the same as unwrap but used by ABCIInfo +// By returning the wrapped error here, we ensure that the DeterministicError inherits +// the ABCIInfo of the wrapped error. +func (e DeterministicError) Cause() error { + return e.Unwrap() +} diff --git a/x/wasm/types/errors_test.go b/x/wasm/types/errors_test.go index 5e1034f628..45d98c9299 100644 --- a/x/wasm/types/errors_test.go +++ b/x/wasm/types/errors_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -94,3 +94,19 @@ func TestWasmVMFlavouredError(t *testing.T) { t.Run(name, spec.exec) } } + +func TestDeterministicError(t *testing.T) { + inner := ErrInstantiateFailed + err := MarkErrorDeterministic(inner) + + // behaves like a wrapper around inner error + assert.Equal(t, inner.Error(), err.Error()) + assert.Equal(t, inner, err.Cause()) + assert.Equal(t, inner, err.Unwrap()) + + // also works with ABCIInfo + codespace, code, _ := errorsmod.ABCIInfo(err, false) + innerCodeSpace, innerCode, _ := errorsmod.ABCIInfo(inner, false) + assert.Equal(t, innerCodeSpace, codespace) + assert.Equal(t, innerCode, code) +} diff --git a/x/wasm/types/events.go b/x/wasm/types/events.go index 5abe563a34..db44bb4da7 100644 --- a/x/wasm/types/events.go +++ b/x/wasm/types/events.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index 720baaaaf4..d2df911997 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -3,51 +3,50 @@ package types import ( "context" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // BankViewKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper type BankViewKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin + GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) DenomsMetadata(ctx context.Context, req *banktypes.QueryDenomsMetadataRequest) (*banktypes.QueryDenomsMetadataResponse, error) } // Burner is a subset of the sdk bank keeper methods type Burner interface { - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // BankKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper type BankKeeper interface { BankViewKeeper Burner - IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error + IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error BlockedAddr(addr sdk.AccAddress) bool - SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error } // AccountKeeper defines a subset of methods implemented by the cosmos-sdk account keeper type AccountKeeper interface { // Return a new account with the next account number and the specified address. Does not save the new account to the store. - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // Retrieve an account from the store. - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // Set an account in the store. - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + SetAccount(ctx context.Context, acc sdk.AccountI) } // DistributionKeeper defines a subset of methods implemented by the cosmos-sdk distribution keeper @@ -61,19 +60,19 @@ type DistributionKeeper interface { // StakingKeeper defines a subset of methods implemented by the cosmos-sdk staking keeper type StakingKeeper interface { // BondDenom - Bondable coin denomination - BondDenom(ctx sdk.Context) (res string) + BondDenom(ctx context.Context) (string, error) // GetValidator get a single validator - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) // GetBondedValidatorsByPower get the current group of bonded validators sorted by power-rank - GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator + GetBondedValidatorsByPower(ctx context.Context) ([]stakingtypes.Validator, error) // GetAllDelegatorDelegations return all delegations for a delegator - GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []stakingtypes.Delegation + GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]stakingtypes.Delegation, error) // GetDelegation return a specific delegation - GetDelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) + GetDelegation(ctx context.Context, + delAddr sdk.AccAddress, valAddr sdk.ValAddress) (stakingtypes.Delegation, error) // HasReceivingRedelegation check if validator is receiving a redelegation - HasReceivingRedelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool + HasReceivingRedelegation(ctx context.Context, + delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error) } // ChannelKeeper defines the expected IBC channel keeper diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index a77d823a3b..918ad214e3 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -1,29 +1,31 @@ package types import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + "context" + + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" ) // ViewKeeper provides read only operations type ViewKeeper interface { - GetContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress) []ContractCodeHistoryEntry - QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) - QueryRaw(ctx sdk.Context, contractAddress sdk.AccAddress, key []byte) []byte - HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool - GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *ContractInfo - IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, ContractInfo) bool) - IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) - IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) - IterateContractState(ctx sdk.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool) - GetCodeInfo(ctx sdk.Context, codeID uint64) *CodeInfo - IterateCodeInfos(ctx sdk.Context, cb func(uint64, CodeInfo) bool) - GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error) - IsPinnedCode(ctx sdk.Context, codeID uint64) bool - GetParams(ctx sdk.Context) Params + GetContractHistory(ctx context.Context, contractAddr sdk.AccAddress) []ContractCodeHistoryEntry + QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) + QueryRaw(ctx context.Context, contractAddress sdk.AccAddress, key []byte) []byte + HasContractInfo(ctx context.Context, contractAddress sdk.AccAddress) bool + GetContractInfo(ctx context.Context, contractAddress sdk.AccAddress) *ContractInfo + IterateContractInfo(ctx context.Context, cb func(sdk.AccAddress, ContractInfo) bool) + IterateContractsByCreator(ctx context.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) + IterateContractsByCode(ctx context.Context, codeID uint64, cb func(address sdk.AccAddress) bool) + IterateContractState(ctx context.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool) + GetCodeInfo(ctx context.Context, codeID uint64) *CodeInfo + IterateCodeInfos(ctx context.Context, cb func(uint64, CodeInfo) bool) + GetByteCode(ctx context.Context, codeID uint64) ([]byte, error) + IsPinnedCode(ctx context.Context, codeID uint64) bool + GetParams(ctx context.Context) Params } // ContractOpsKeeper contains mutable operations on a contract. diff --git a/x/wasm/types/gas_register.go b/x/wasm/types/gas_register.go index da5e989149..ca6e11c235 100644 --- a/x/wasm/types/gas_register.go +++ b/x/wasm/types/gas_register.go @@ -1,12 +1,12 @@ package types import ( - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -21,6 +21,7 @@ const ( // Rough timing have 88k gas at 90us, which is equal to 1k sdk gas... (one read)" // as well as manual Wasmer benchmarks from 2019. This was then multiplied by 150_000 // in the 0.16 -> 1.0 upgrade (https://github.com/CosmWasm/cosmwasm/pull/1120). + // In the 2.0 upgrade, this was reduced by a factor of 1000 (https://github.com/CosmWasm/cosmwasm/pull/1884). // // The multiplier deserves more reproducible benchmarking and a strategy that allows easy adjustments. // This is tracked in https://github.com/CosmWasm/wasmd/issues/566 and https://github.com/CosmWasm/wasmd/issues/631. @@ -30,11 +31,16 @@ const ( // // Please note that all gas prices returned to wasmvm should have this multiplied. // Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938055852 - DefaultGasMultiplier uint64 = 140_000_000 + DefaultGasMultiplier uint64 = 140_000 // DefaultInstanceCost is how much SDK gas we charge each time we load a WASM instance. // Creating a new instance is costly, and this helps put a recursion limit to contracts calling contracts. // Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938056803 DefaultInstanceCost uint64 = 60_000 + // DefaultInstanceCostDiscount is charged instead of DefaultInstanceCost for cases where + // we assume the contract is loaded from an in-memory cache. + // For a long time it was implicitly just 0 in those cases. + // Now we use something small that roughly reflects the 45µs startup time (30x cheaper than DefaultInstanceCost). + DefaultInstanceCostDiscount uint64 = 2_000 // DefaultCompileCost is how much SDK gas is charged *per byte* for compiling WASM code. // Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938056803 DefaultCompileCost uint64 = 3 @@ -69,50 +75,55 @@ func DefaultPerByteUncompressCost() wasmvmtypes.UFraction { // GasRegister abstract source for gas costs type GasRegister interface { - // NewContractInstanceCosts costs to create a new contract instance from code - NewContractInstanceCosts(pinned bool, msgLen int) sdk.Gas - // CompileCosts costs to persist and "compile" a new wasm contract - CompileCosts(byteLength int) sdk.Gas // UncompressCosts costs to unpack a new wasm contract - UncompressCosts(byteLength int) sdk.Gas - // InstantiateContractCosts costs when interacting with a wasm contract - InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas + UncompressCosts(byteLength int) storetypes.Gas + // SetupContractCost are charged when interacting with a Wasm contract, i.e. every time + // the contract is prepared for execution through any entry point (execute/instantiate/sudo/query/ibc_*/...). + SetupContractCost(discount bool, msgLen int) storetypes.Gas // ReplyCosts costs to to handle a message reply - ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas + ReplyCosts(discount bool, reply wasmvmtypes.Reply) storetypes.Gas // EventCosts costs to persist an event - EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas + EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Array[wasmvmtypes.Event]) storetypes.Gas // ToWasmVMGas converts from Cosmos SDK gas units to [CosmWasm gas] (aka. wasmvm gas) // // [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md - ToWasmVMGas(source sdk.Gas) uint64 + ToWasmVMGas(source storetypes.Gas) uint64 // FromWasmVMGas converts from [CosmWasm gas] (aka. wasmvm gas) to Cosmos SDK gas units // // [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md - FromWasmVMGas(source uint64) sdk.Gas + FromWasmVMGas(source uint64) storetypes.Gas } // WasmGasRegisterConfig config type type WasmGasRegisterConfig struct { - // InstanceCost costs when interacting with a wasm contract - InstanceCost sdk.Gas + // InstanceCost are charged when interacting with a Wasm contract. + // "Instance" refers to the in-memory Instance of the Wasm runtime, not the contract address on chain. + // InstanceCost are part of a contract's setup cost. + InstanceCost storetypes.Gas + // InstanceCostDiscount is a discounted version of InstanceCost. It is charged whenever + // we can reasonably assume that a contract is in one of the in-memory caches. E.g. + // when the contract is pinned or we send a reply to a contract that was executed before. + // See also https://github.com/CosmWasm/wasmd/issues/1798 for more thinking around + // discount cases. + InstanceCostDiscount storetypes.Gas // CompileCosts costs to persist and "compile" a new wasm contract - CompileCost sdk.Gas + CompileCost storetypes.Gas // UncompressCost costs per byte to unpack a contract UncompressCost wasmvmtypes.UFraction // GasMultiplier is how many cosmwasm gas points = 1 sdk gas point // SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/02c6c9fafd58da88550ab4d7d494724a477c8a68/store/types/gas.go#L153-L164 - GasMultiplier sdk.Gas + GasMultiplier storetypes.Gas // EventPerAttributeCost is how much SDK gas is charged *per byte* for attribute data in events. // This is used with len(key) + len(value) - EventPerAttributeCost sdk.Gas + EventPerAttributeCost storetypes.Gas // EventAttributeDataCost is how much SDK gas is charged *per byte* for attribute data in events. // This is used with len(key) + len(value) - EventAttributeDataCost sdk.Gas + EventAttributeDataCost storetypes.Gas // EventAttributeDataFreeTier number of bytes of total attribute data that is free of charge EventAttributeDataFreeTier uint64 // ContractMessageDataCost SDK gas charged *per byte* of the message that goes to the contract // This is used with len(msg) - ContractMessageDataCost sdk.Gas + ContractMessageDataCost storetypes.Gas // CustomEventCost cost per custom event CustomEventCost uint64 } @@ -121,6 +132,7 @@ type WasmGasRegisterConfig struct { func DefaultGasRegisterConfig() WasmGasRegisterConfig { return WasmGasRegisterConfig{ InstanceCost: DefaultInstanceCost, + InstanceCostDiscount: DefaultInstanceCostDiscount, CompileCost: DefaultCompileCost, GasMultiplier: DefaultGasMultiplier, EventPerAttributeCost: DefaultPerAttributeCost, @@ -152,70 +164,62 @@ func NewWasmGasRegister(c WasmGasRegisterConfig) WasmGasRegister { } } -// NewContractInstanceCosts costs to create a new contract instance from code -func (g WasmGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) storetypes.Gas { - return g.InstantiateContractCosts(pinned, msgLen) -} - -// CompileCosts costs to persist and "compile" a new wasm contract -func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas { - if byteLength < 0 { - panic(errorsmod.Wrap(ErrInvalid, "negative length")) - } - return g.c.CompileCost * uint64(byteLength) -} - // UncompressCosts costs to unpack a new wasm contract -func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas { +func (g WasmGasRegister) UncompressCosts(byteLength int) storetypes.Gas { if byteLength < 0 { panic(errorsmod.Wrap(ErrInvalid, "negative length")) } return g.c.UncompressCost.Mul(uint64(byteLength)).Floor() } -// InstantiateContractCosts costs when interacting with a wasm contract -func (g WasmGasRegister) InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas { +// SetupContractCost costs when interacting with a wasm contract. +// Set discount to true in cases where you can reasonably assume the contract +// is loaded from an in-memory cache (e.g. pinned contracts or replys). +func (g WasmGasRegister) SetupContractCost(discount bool, msgLen int) storetypes.Gas { if msgLen < 0 { panic(errorsmod.Wrap(ErrInvalid, "negative length")) } - dataCosts := sdk.Gas(msgLen) * g.c.ContractMessageDataCost - if pinned { - return dataCosts + dataCost := storetypes.Gas(msgLen) * g.c.ContractMessageDataCost + if discount { + return g.c.InstanceCostDiscount + dataCost + } else { + return g.c.InstanceCost + dataCost } - return g.c.InstanceCost + dataCosts } -// ReplyCosts costs to to handle a message reply -func (g WasmGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Gas { - var eventGas sdk.Gas +// ReplyCosts costs to to handle a message reply. +// Set discount to true in cases where you can reasonably assume the contract +// is loaded from an in-memory cache (e.g. pinned contracts or replys). +func (g WasmGasRegister) ReplyCosts(discount bool, reply wasmvmtypes.Reply) storetypes.Gas { + var eventGas storetypes.Gas msgLen := len(reply.Result.Err) if reply.Result.Ok != nil { msgLen += len(reply.Result.Ok.Data) var attrs []wasmvmtypes.EventAttribute for _, e := range reply.Result.Ok.Events { - eventGas += sdk.Gas(len(e.Type)) * g.c.EventAttributeDataCost + eventGas += storetypes.Gas(len(e.Type)) * g.c.EventAttributeDataCost attrs = append(attrs, e.Attributes...) } // apply free tier on the whole set not per event eventGas += g.EventCosts(attrs, nil) } - return eventGas + g.InstantiateContractCosts(pinned, msgLen) + return eventGas + g.SetupContractCost(discount, msgLen) } // EventCosts costs to persist an event -func (g WasmGasRegister) EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas { +func (g WasmGasRegister) EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Array[wasmvmtypes.Event]) storetypes.Gas { gas, remainingFreeTier := g.eventAttributeCosts(attrs, g.c.EventAttributeDataFreeTier) for _, e := range events { gas += g.c.CustomEventCost - gas += sdk.Gas(len(e.Type)) * g.c.EventAttributeDataCost // no free tier with event type - var attrCost sdk.Gas + gas += storetypes.Gas(len(e.Type)) * g.c.EventAttributeDataCost // no free tier with event type + var attrCost storetypes.Gas attrCost, remainingFreeTier = g.eventAttributeCosts(e.Attributes, remainingFreeTier) gas += attrCost } return gas } -func (g WasmGasRegister) eventAttributeCosts(attrs []wasmvmtypes.EventAttribute, freeTier uint64) (sdk.Gas, uint64) { +func (g WasmGasRegister) eventAttributeCosts(attrs []wasmvmtypes.EventAttribute, freeTier uint64) (storetypes.Gas, uint64) { if len(attrs) == 0 { return 0, freeTier } @@ -225,10 +229,10 @@ func (g WasmGasRegister) eventAttributeCosts(attrs []wasmvmtypes.EventAttribute, } storedBytes, freeTier = calcWithFreeTier(storedBytes, freeTier) // total Length * costs + attribute count * costs - r := sdk.NewIntFromUint64(g.c.EventAttributeDataCost).Mul(sdk.NewIntFromUint64(storedBytes)). - Add(sdk.NewIntFromUint64(g.c.EventPerAttributeCost).Mul(sdk.NewIntFromUint64(uint64(len(attrs))))) + r := sdkmath.NewIntFromUint64(g.c.EventAttributeDataCost).Mul(sdkmath.NewIntFromUint64(storedBytes)). + Add(sdkmath.NewIntFromUint64(g.c.EventPerAttributeCost).Mul(sdkmath.NewIntFromUint64(uint64(len(attrs))))) if !r.IsUint64() { - panic(sdk.ErrorOutOfGas{Descriptor: "overflow"}) + panic(storetypes.ErrorOutOfGas{Descriptor: "overflow"}) } return r.Uint64(), freeTier } @@ -248,7 +252,7 @@ func calcWithFreeTier(storedBytes, freeTier uint64) (uint64, uint64) { func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64 { x := source * g.c.GasMultiplier if x < source { - panic(sdk.ErrorOutOfGas{Descriptor: "overflow"}) + panic(storetypes.ErrorOutOfGas{Descriptor: "overflow"}) } return x } @@ -256,6 +260,6 @@ func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64 { // FromWasmVMGas converts from [CosmWasm gas] (aka. wasmvm gas) to Cosmos SDK gas units // // [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md -func (g WasmGasRegister) FromWasmVMGas(source uint64) sdk.Gas { +func (g WasmGasRegister) FromWasmVMGas(source uint64) storetypes.Gas { return source / g.c.GasMultiplier } diff --git a/x/wasm/types/gas_register_test.go b/x/wasm/types/gas_register_test.go index 34155d4784..45e9719cbf 100644 --- a/x/wasm/types/gas_register_test.go +++ b/x/wasm/types/gas_register_test.go @@ -5,138 +5,37 @@ import ( "strings" "testing" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/stretchr/testify/assert" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" ) -func TestCompileCosts(t *testing.T) { - specs := map[string]struct { - srcLen int - srcConfig WasmGasRegisterConfig - exp sdk.Gas - expPanic bool - }{ - "one byte": { - srcLen: 1, - srcConfig: DefaultGasRegisterConfig(), - exp: sdk.Gas(3), // DefaultCompileCost - }, - "zero byte": { - srcLen: 0, - srcConfig: DefaultGasRegisterConfig(), - exp: sdk.Gas(0), - }, - "negative len": { - srcLen: -1, - srcConfig: DefaultGasRegisterConfig(), - expPanic: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - if spec.expPanic { - assert.Panics(t, func() { - NewWasmGasRegister(spec.srcConfig).CompileCosts(spec.srcLen) - }) - return - } - gotGas := NewWasmGasRegister(spec.srcConfig).CompileCosts(spec.srcLen) - assert.Equal(t, spec.exp, gotGas) - }) - } -} - -func TestNewContractInstanceCosts(t *testing.T) { +func TestSetupContractCost(t *testing.T) { specs := map[string]struct { srcLen int srcConfig WasmGasRegisterConfig pinned bool - exp sdk.Gas - expPanic bool - }{ - "small msg - pinned": { - srcLen: 1, - srcConfig: DefaultGasRegisterConfig(), - pinned: true, - exp: DefaultContractMessageDataCost, - }, - "big msg - pinned": { - srcLen: math.MaxUint32, - srcConfig: DefaultGasRegisterConfig(), - pinned: true, - exp: DefaultContractMessageDataCost * sdk.Gas(math.MaxUint32), - }, - "empty msg - pinned": { - srcLen: 0, - pinned: true, - srcConfig: DefaultGasRegisterConfig(), - exp: sdk.Gas(0), - }, - "small msg - unpinned": { - srcLen: 1, - srcConfig: DefaultGasRegisterConfig(), - exp: DefaultContractMessageDataCost + DefaultInstanceCost, - }, - "big msg - unpinned": { - srcLen: math.MaxUint32, - srcConfig: DefaultGasRegisterConfig(), - exp: DefaultContractMessageDataCost*math.MaxUint32 + DefaultInstanceCost, - }, - "empty msg - unpinned": { - srcLen: 0, - srcConfig: DefaultGasRegisterConfig(), - exp: DefaultInstanceCost, - }, - - "negative len": { - srcLen: -1, - srcConfig: DefaultGasRegisterConfig(), - expPanic: true, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - if spec.expPanic { - assert.Panics(t, func() { - NewWasmGasRegister(spec.srcConfig).NewContractInstanceCosts(spec.pinned, spec.srcLen) - }) - return - } - gotGas := NewWasmGasRegister(spec.srcConfig).NewContractInstanceCosts(spec.pinned, spec.srcLen) - assert.Equal(t, spec.exp, gotGas) - }) - } -} - -func TestContractInstanceCosts(t *testing.T) { - // same as TestNewContractInstanceCosts currently - specs := map[string]struct { - srcLen int - srcConfig WasmGasRegisterConfig - pinned bool - exp sdk.Gas + exp storetypes.Gas expPanic bool }{ "small msg - pinned": { srcLen: 1, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: DefaultContractMessageDataCost, + exp: DefaultInstanceCostDiscount + DefaultContractMessageDataCost, }, "big msg - pinned": { srcLen: math.MaxUint32, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: DefaultContractMessageDataCost * math.MaxUint32, + exp: DefaultInstanceCostDiscount + DefaultContractMessageDataCost*math.MaxUint32, }, "empty msg - pinned": { srcLen: 0, pinned: true, srcConfig: DefaultGasRegisterConfig(), - exp: sdk.Gas(0), + exp: DefaultInstanceCostDiscount, }, "small msg - unpinned": { srcLen: 1, @@ -153,7 +52,6 @@ func TestContractInstanceCosts(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost, }, - "negative len": { srcLen: -1, srcConfig: DefaultGasRegisterConfig(), @@ -164,11 +62,11 @@ func TestContractInstanceCosts(t *testing.T) { t.Run(name, func(t *testing.T) { if spec.expPanic { assert.Panics(t, func() { - NewWasmGasRegister(spec.srcConfig).InstantiateContractCosts(spec.pinned, spec.srcLen) + NewWasmGasRegister(spec.srcConfig).SetupContractCost(spec.pinned, spec.srcLen) }) return } - gotGas := NewWasmGasRegister(spec.srcConfig).InstantiateContractCosts(spec.pinned, spec.srcLen) + gotGas := NewWasmGasRegister(spec.srcConfig).SetupContractCost(spec.pinned, spec.srcLen) assert.Equal(t, spec.exp, gotGas) }) } @@ -179,10 +77,10 @@ func TestReplyCost(t *testing.T) { src wasmvmtypes.Reply srcConfig WasmGasRegisterConfig pinned bool - exp sdk.Gas + exp storetypes.Gas expPanic bool }{ - "subcall response with events and data - pinned": { + "submessage reply with events and data - pinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -195,9 +93,9 @@ func TestReplyCost(t *testing.T) { }, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost, // 3 == len("foo") + exp: DefaultInstanceCostDiscount + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost, // 3 == len("foo") }, - "subcall response with events - pinned": { + "submessage reply with events - pinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -209,9 +107,9 @@ func TestReplyCost(t *testing.T) { }, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo") + exp: DefaultInstanceCostDiscount + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo") }, - "subcall response with events exceeds free tier- pinned": { + "submessage reply with events exceeds free tier - pinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -223,9 +121,9 @@ func TestReplyCost(t *testing.T) { }, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo"), 6 == len("myData") + exp: DefaultInstanceCostDiscount + (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo"), 6 == len("myData") }, - "subcall response error - pinned": { + "submessage reply error - pinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Err: "foo", @@ -233,9 +131,9 @@ func TestReplyCost(t *testing.T) { }, srcConfig: DefaultGasRegisterConfig(), pinned: true, - exp: 3 * DefaultContractMessageDataCost, + exp: DefaultInstanceCostDiscount + 3*DefaultContractMessageDataCost, }, - "subcall response with events and data - unpinned": { + "submessage reply with events and data - unpinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -249,7 +147,7 @@ func TestReplyCost(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost, }, - "subcall response with events - unpinned": { + "submessage reply with events - unpinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -262,7 +160,7 @@ func TestReplyCost(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost, }, - "subcall response with events exceeds free tier- unpinned": { + "submessage reply with events exceeds free tier - unpinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -275,7 +173,7 @@ func TestReplyCost(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost + (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo"), 6 == len("myData") }, - "subcall response error - unpinned": { + "submessage reply error - unpinned": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Err: "foo", @@ -284,7 +182,7 @@ func TestReplyCost(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost + 3*DefaultContractMessageDataCost, }, - "subcall response with empty events": { + "submessage reply with empty events": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{ @@ -295,7 +193,7 @@ func TestReplyCost(t *testing.T) { srcConfig: DefaultGasRegisterConfig(), exp: DefaultInstanceCost, }, - "subcall response with events unset": { + "submessage reply with events unset": { src: wasmvmtypes.Reply{ Result: wasmvmtypes.SubMsgResult{ Ok: &wasmvmtypes.SubMsgResponse{}, @@ -323,8 +221,8 @@ func TestEventCosts(t *testing.T) { // most cases are covered in TestReplyCost already. This ensures some edge cases specs := map[string]struct { srcAttrs []wasmvmtypes.EventAttribute - srcEvents wasmvmtypes.Events - expGas sdk.Gas + srcEvents wasmvmtypes.Array[wasmvmtypes.Event] + expGas storetypes.Gas }{ "empty events": { srcEvents: make([]wasmvmtypes.Event, 1), @@ -435,7 +333,7 @@ func TestFromWasmVMGasConversion(t *testing.T) { func TestUncompressCosts(t *testing.T) { specs := map[string]struct { lenIn int - exp sdk.Gas + exp storetypes.Gas expPanic bool }{ "0": { diff --git a/x/wasm/types/genesis.go b/x/wasm/types/genesis.go index 4dd85e03fc..83acd3379c 100644 --- a/x/wasm/types/genesis.go +++ b/x/wasm/types/genesis.go @@ -36,7 +36,7 @@ func (s GenesisState) ValidateBasic() error { } for i := range s.GenMsgs { if err := s.GenMsgs[i].ValidateBasic(); err != nil { - return sdkerrors.Wrapf(err, "gen message: %d", i) + return errorsmod.Wrapf(err, "gen message: %d", i) } } return nil @@ -97,11 +97,16 @@ func (m GenesisState_GenMsgs) AsMsg() sdk.Msg { } func (m GenesisState_GenMsgs) ValidateBasic() error { - msg := m.AsMsg() - if msg == nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "unknown message") + if msg := m.GetStoreCode(); msg != nil { + return msg.ValidateBasic() + } + if msg := m.GetInstantiateContract(); msg != nil { + return msg.ValidateBasic() + } + if msg := m.GetExecuteContract(); msg != nil { + return msg.ValidateBasic() } - return msg.ValidateBasic() + return errorsmod.Wrapf(sdkerrors.ErrInvalidType, "unknown message") } // ValidateGenesis performs basic validation of supply genesis data returning an diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go index ab633c4e74..938e7e6755 100644 --- a/x/wasm/types/genesis.pb.go +++ b/x/wasm/types/genesis.pb.go @@ -5,18 +5,22 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,9 +43,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -54,12 +60,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -119,9 +128,11 @@ func (*GenesisState_GenMsgs) ProtoMessage() {} func (*GenesisState_GenMsgs) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{0, 0} } + func (m *GenesisState_GenMsgs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState_GenMsgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState_GenMsgs.Marshal(b, m, deterministic) @@ -134,12 +145,15 @@ func (m *GenesisState_GenMsgs) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *GenesisState_GenMsgs) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState_GenMsgs.Merge(m, src) } + func (m *GenesisState_GenMsgs) XXX_Size() int { return m.Size() } + func (m *GenesisState_GenMsgs) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState_GenMsgs.DiscardUnknown(m) } @@ -218,9 +232,11 @@ func (*Code) ProtoMessage() {} func (*Code) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{1} } + func (m *Code) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Code) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Code.Marshal(b, m, deterministic) @@ -233,12 +249,15 @@ func (m *Code) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Code) XXX_Merge(src proto.Message) { xxx_messageInfo_Code.Merge(m, src) } + func (m *Code) XXX_Size() int { return m.Size() } + func (m *Code) XXX_DiscardUnknown() { xxx_messageInfo_Code.DiscardUnknown(m) } @@ -287,9 +306,11 @@ func (*Contract) ProtoMessage() {} func (*Contract) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{2} } + func (m *Contract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Contract.Marshal(b, m, deterministic) @@ -302,12 +323,15 @@ func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Contract) XXX_Merge(src proto.Message) { xxx_messageInfo_Contract.Merge(m, src) } + func (m *Contract) XXX_Size() int { return m.Size() } + func (m *Contract) XXX_DiscardUnknown() { xxx_messageInfo_Contract.DiscardUnknown(m) } @@ -354,9 +378,11 @@ func (*Sequence) ProtoMessage() {} func (*Sequence) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{3} } + func (m *Sequence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Sequence.Marshal(b, m, deterministic) @@ -369,12 +395,15 @@ func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Sequence) XXX_Merge(src proto.Message) { xxx_messageInfo_Sequence.Merge(m, src) } + func (m *Sequence) XXX_Size() int { return m.Size() } + func (m *Sequence) XXX_DiscardUnknown() { xxx_messageInfo_Sequence.DiscardUnknown(m) } @@ -406,51 +435,52 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/genesis.proto", fileDescriptor_2ab3f539b23472a6) } var fileDescriptor_2ab3f539b23472a6 = []byte{ - // 699 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0x24, 0x4e, 0x93, 0x69, 0xbe, 0xaf, 0xfd, 0xb6, 0xfd, 0x8a, 0xb1, 0x8a, 0x13, - 0x05, 0x54, 0x85, 0x0a, 0x25, 0x6a, 0x39, 0x72, 0x00, 0xdc, 0x56, 0x34, 0x54, 0x45, 0xe0, 0x1e, - 0x90, 0x2a, 0x55, 0x91, 0x6b, 0x6f, 0x5d, 0x8b, 0xda, 0x1b, 0xb2, 0x9b, 0x52, 0x9f, 0x79, 0x01, - 0x9e, 0x02, 0x71, 0xe4, 0xc0, 0x8d, 0x17, 0xe8, 0xb1, 0x47, 0x4e, 0x11, 0x4a, 0x0f, 0x48, 0x3c, - 0x05, 0xda, 0x5d, 0xdb, 0x31, 0x75, 0x7a, 0x59, 0x79, 0x67, 0xfe, 0xf3, 0xdb, 0xd9, 0xf1, 0xcc, - 0x82, 0xe1, 0x10, 0x1a, 0x7c, 0xb0, 0x69, 0xd0, 0x15, 0xcb, 0xf9, 0x46, 0xd7, 0xc3, 0x21, 0xa6, - 0x3e, 0xed, 0x0c, 0x86, 0x84, 0x11, 0xb4, 0x98, 0xf8, 0x3b, 0x62, 0x39, 0xdf, 0xd0, 0x97, 0x3d, - 0xe2, 0x11, 0xe1, 0xec, 0xf2, 0x2f, 0xa9, 0xd3, 0x57, 0x73, 0x1c, 0x16, 0x0d, 0x70, 0x4c, 0xd1, - 0xef, 0xe6, 0xbd, 0x17, 0xb1, 0xeb, 0x3f, 0x3b, 0xf0, 0x43, 0xd2, 0x15, 0xab, 0x34, 0xb5, 0xbe, - 0xa9, 0x50, 0x7f, 0x21, 0xb3, 0x38, 0x60, 0x36, 0xc3, 0xe8, 0x09, 0x54, 0x06, 0xf6, 0xd0, 0x0e, - 0xa8, 0xa6, 0x34, 0x95, 0xf6, 0xfc, 0xa6, 0xd6, 0xb9, 0x99, 0x55, 0xe7, 0xb5, 0xf0, 0x9b, 0xb5, - 0xcb, 0x71, 0xa3, 0xf0, 0xe5, 0xd7, 0xd7, 0x75, 0xc5, 0x8a, 0x43, 0xd0, 0x4b, 0x50, 0x1d, 0xe2, - 0x62, 0xaa, 0x15, 0x9b, 0xa5, 0xf6, 0xfc, 0xe6, 0x4a, 0x3e, 0x76, 0x8b, 0xb8, 0xd8, 0x5c, 0xe5, - 0x91, 0xbf, 0xc7, 0x8d, 0x05, 0x21, 0x7e, 0x44, 0x02, 0x9f, 0xe1, 0x60, 0xc0, 0x22, 0x09, 0x93, - 0x08, 0x74, 0x08, 0x35, 0x87, 0x84, 0x6c, 0x68, 0x3b, 0x8c, 0x6a, 0x25, 0xc1, 0xd3, 0x67, 0xf1, - 0xa4, 0xc4, 0x6c, 0xc6, 0xcc, 0xa5, 0x34, 0xe8, 0x26, 0x77, 0x8a, 0xe3, 0x6c, 0x8a, 0xdf, 0x8f, - 0x70, 0xe8, 0x60, 0xaa, 0x95, 0x6f, 0x63, 0x1f, 0xc4, 0x92, 0x29, 0x3b, 0x0d, 0xca, 0xb1, 0x53, - 0x0f, 0x3a, 0x82, 0xaa, 0x87, 0xc3, 0x7e, 0x40, 0x3d, 0xaa, 0xa9, 0x02, 0xbd, 0x96, 0x47, 0x67, - 0x4b, 0xce, 0x37, 0xfb, 0xd4, 0xa3, 0xa6, 0x1e, 0x1f, 0x83, 0x92, 0xf8, 0xe9, 0x29, 0xd6, 0x9c, - 0x27, 0x45, 0xfa, 0xc7, 0x22, 0xcc, 0xc5, 0x01, 0xe8, 0x29, 0x00, 0x65, 0x64, 0x88, 0xfb, 0xbc, - 0x62, 0xf1, 0xff, 0x32, 0xf2, 0x87, 0xed, 0x53, 0xef, 0x80, 0xcb, 0x78, 0xed, 0x77, 0x0b, 0x56, - 0x8d, 0x26, 0x1b, 0x74, 0x04, 0xcb, 0x7e, 0x48, 0x99, 0x1d, 0x32, 0xdf, 0x66, 0x1c, 0x23, 0x0b, - 0xa4, 0x15, 0x05, 0xaa, 0x3d, 0x13, 0xd5, 0x9b, 0x06, 0x24, 0xc5, 0xdf, 0x2d, 0x58, 0x4b, 0x7e, - 0xde, 0x8c, 0xde, 0xc0, 0x22, 0xbe, 0xc0, 0xce, 0x28, 0x8b, 0x2e, 0x09, 0xf4, 0x83, 0x99, 0xe8, - 0x1d, 0x29, 0xce, 0x60, 0x17, 0xf0, 0xdf, 0x26, 0x53, 0x85, 0x12, 0x1d, 0x05, 0xad, 0xcf, 0x0a, - 0x94, 0xc5, 0x0d, 0xee, 0xc3, 0x1c, 0xbf, 0x7c, 0xdf, 0x77, 0xc5, 0xfd, 0xcb, 0x26, 0x4c, 0xc6, - 0x8d, 0x0a, 0x77, 0xf5, 0xb6, 0xad, 0x0a, 0x77, 0xf5, 0x5c, 0x64, 0xf2, 0x56, 0xe2, 0xa2, 0xf0, - 0x84, 0xc4, 0x77, 0xd3, 0x67, 0xb7, 0x66, 0x2f, 0x3c, 0x21, 0xd9, 0xc6, 0xae, 0x3a, 0xb1, 0x11, - 0xdd, 0x03, 0x10, 0x8c, 0xe3, 0x88, 0x61, 0x2a, 0x6e, 0x51, 0xb7, 0x04, 0xd5, 0xe4, 0x06, 0xb4, - 0x02, 0x95, 0x81, 0x1f, 0x86, 0xd8, 0xd5, 0xca, 0x4d, 0xa5, 0x5d, 0xb5, 0xe2, 0x5d, 0xeb, 0x7b, - 0x11, 0xaa, 0x69, 0x3d, 0x1e, 0xc2, 0x62, 0x52, 0x87, 0xbe, 0xed, 0xba, 0x43, 0x4c, 0xe5, 0x94, - 0xd5, 0xac, 0x85, 0xc4, 0xfe, 0x5c, 0x9a, 0xd1, 0x2b, 0xf8, 0x27, 0x95, 0x66, 0xd2, 0x36, 0x6e, - 0x9f, 0x80, 0x9b, 0xa9, 0xd7, 0x9d, 0x8c, 0x03, 0xf5, 0xe0, 0xdf, 0x94, 0x47, 0x79, 0xd7, 0xc5, - 0x23, 0x75, 0x67, 0xc6, 0x8f, 0x20, 0x2e, 0x3e, 0xcb, 0x92, 0xd2, 0x4c, 0xe4, 0x0b, 0xe1, 0xc3, - 0xff, 0x29, 0x4a, 0x94, 0xe4, 0xd4, 0xe7, 0x1d, 0x15, 0xc5, 0x83, 0xb4, 0x7e, 0x7b, 0x8a, 0xa2, - 0x01, 0xa5, 0x78, 0x27, 0x64, 0xc3, 0x28, 0x7b, 0x48, 0x3a, 0xb7, 0x19, 0x51, 0xcb, 0x84, 0x6a, - 0x32, 0x84, 0xa8, 0x09, 0x15, 0xdf, 0xed, 0xbf, 0xc3, 0x91, 0x28, 0x59, 0xdd, 0xac, 0x4d, 0xc6, - 0x0d, 0xb5, 0xb7, 0xbd, 0x87, 0x23, 0x4b, 0xf5, 0xdd, 0x3d, 0x1c, 0xa1, 0x65, 0x50, 0xcf, 0xed, - 0xb3, 0x11, 0x16, 0xb5, 0x2a, 0x5b, 0x72, 0x63, 0x3e, 0xbb, 0x9c, 0x18, 0xca, 0xd5, 0xc4, 0x50, - 0x7e, 0x4e, 0x0c, 0xe5, 0xd3, 0xb5, 0x51, 0xb8, 0xba, 0x36, 0x0a, 0x3f, 0xae, 0x8d, 0xc2, 0xe1, - 0x9a, 0xe7, 0xb3, 0xd3, 0xd1, 0x71, 0xc7, 0x21, 0x41, 0x77, 0x8b, 0xd0, 0xe0, 0x6d, 0xf2, 0x68, - 0xba, 0xdd, 0x0b, 0xf9, 0x78, 0x8a, 0x77, 0xf5, 0xb8, 0x22, 0x9e, 0xca, 0xc7, 0x7f, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x0d, 0x23, 0x27, 0xdc, 0xc0, 0x05, 0x00, 0x00, + // 718 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0x4d, 0x4f, 0x13, 0x41, + 0x18, 0xc7, 0xbb, 0x7d, 0xa3, 0x1d, 0xaa, 0xe0, 0x50, 0x71, 0x6d, 0x70, 0xdb, 0x54, 0x43, 0x1a, + 0xa2, 0x6d, 0xc0, 0xa3, 0x07, 0x75, 0x81, 0x48, 0x25, 0x18, 0xdd, 0x1e, 0x4c, 0x48, 0x48, 0xb3, + 0xec, 0x0e, 0xcb, 0x44, 0x76, 0xa7, 0x76, 0xa6, 0xc8, 0x9e, 0xfd, 0x02, 0x7e, 0x0a, 0xe3, 0xd1, + 0x03, 0x1f, 0x82, 0x23, 0x31, 0x31, 0xf1, 0xd4, 0x98, 0x72, 0x30, 0xf1, 0x53, 0x98, 0x79, 0xd9, + 0xed, 0xca, 0x96, 0xcb, 0xa6, 0x33, 0xff, 0xff, 0xf3, 0x9b, 0x79, 0x9e, 0x3e, 0xcf, 0x00, 0xc3, + 0x21, 0xd4, 0xff, 0x64, 0x53, 0xbf, 0x23, 0x3e, 0xa7, 0xeb, 0x1d, 0x0f, 0x05, 0x88, 0x62, 0xda, + 0x1e, 0x0c, 0x09, 0x23, 0x70, 0x31, 0xd2, 0xdb, 0xe2, 0x73, 0xba, 0x5e, 0xab, 0x7a, 0xc4, 0x23, + 0x42, 0xec, 0xf0, 0x5f, 0xd2, 0x57, 0x5b, 0x49, 0x71, 0x58, 0x38, 0x40, 0x8a, 0x52, 0xbb, 0x9f, + 0x56, 0xcf, 0x94, 0x74, 0xc7, 0xf6, 0x71, 0x40, 0x3a, 0xe2, 0x9b, 0x74, 0x13, 0xda, 0x97, 0x87, + 0xc8, 0x85, 0x94, 0x9a, 0xe7, 0x05, 0x50, 0x79, 0x25, 0x2f, 0xd8, 0x63, 0x36, 0x43, 0xf0, 0x19, + 0x28, 0x0e, 0xec, 0xa1, 0xed, 0x53, 0x5d, 0x6b, 0x68, 0xad, 0xf9, 0x0d, 0xbd, 0x7d, 0xfd, 0xc2, + 0xed, 0xb7, 0x42, 0x37, 0xcb, 0x17, 0xe3, 0x7a, 0xe6, 0xdb, 0x9f, 0xef, 0x6b, 0x9a, 0xa5, 0x42, + 0xe0, 0x6b, 0x50, 0x70, 0x88, 0x8b, 0xa8, 0x9e, 0x6d, 0xe4, 0x5a, 0xf3, 0x1b, 0xcb, 0xe9, 0xd8, + 0x4d, 0xe2, 0x22, 0x73, 0x85, 0x47, 0xfe, 0x1d, 0xd7, 0x17, 0x84, 0xf9, 0x31, 0xf1, 0x31, 0x43, + 0xfe, 0x80, 0x85, 0x12, 0x26, 0x11, 0x70, 0x1f, 0x94, 0x1d, 0x12, 0xb0, 0xa1, 0xed, 0x30, 0xaa, + 0xe7, 0x04, 0xaf, 0x36, 0x8b, 0x27, 0x2d, 0x66, 0x43, 0x31, 0x97, 0xe2, 0xa0, 0xeb, 0xdc, 0x29, + 0x8e, 0xb3, 0x29, 0xfa, 0x38, 0x42, 0x81, 0x83, 0xa8, 0x9e, 0xbf, 0x89, 0xdd, 0x53, 0x96, 0x29, + 0x3b, 0x0e, 0x4a, 0xb1, 0x63, 0x05, 0x1e, 0x80, 0x92, 0x87, 0x82, 0xbe, 0x4f, 0x3d, 0xaa, 0x17, + 0x04, 0x7a, 0x35, 0x8d, 0x4e, 0x96, 0x9c, 0x2f, 0xf6, 0xa8, 0x47, 0xcd, 0x9a, 0x3a, 0x06, 0x46, + 0xf1, 0xd3, 0x53, 0xac, 0x39, 0x4f, 0x9a, 0x6a, 0x9f, 0xb3, 0x60, 0x4e, 0x05, 0xc0, 0xe7, 0x00, + 0x50, 0x46, 0x86, 0xa8, 0xcf, 0x2b, 0xa6, 0xfe, 0x2f, 0x23, 0x7d, 0xd8, 0x1e, 0xf5, 0x7a, 0xdc, + 0xc6, 0x6b, 0xbf, 0x93, 0xb1, 0xca, 0x34, 0x5a, 0xc0, 0x03, 0x50, 0xc5, 0x01, 0x65, 0x76, 0xc0, + 0xb0, 0xcd, 0x38, 0x46, 0x16, 0x48, 0xcf, 0x0a, 0x54, 0x6b, 0x26, 0xaa, 0x3b, 0x0d, 0x88, 0x8a, + 0xbf, 0x93, 0xb1, 0x96, 0x70, 0x7a, 0x1b, 0xbe, 0x03, 0x8b, 0xe8, 0x0c, 0x39, 0xa3, 0x24, 0x3a, + 0x27, 0xd0, 0x8f, 0x66, 0xa2, 0xb7, 0xa5, 0x39, 0x81, 0x5d, 0x40, 0xff, 0x6f, 0x99, 0x05, 0x90, + 0xa3, 0x23, 0xbf, 0xf9, 0x55, 0x03, 0x79, 0x91, 0xc1, 0x43, 0x30, 0xc7, 0x93, 0xef, 0x63, 0x57, + 0xe4, 0x9f, 0x37, 0xc1, 0x64, 0x5c, 0x2f, 0x72, 0xa9, 0xbb, 0x65, 0x15, 0xb9, 0xd4, 0x75, 0xa1, + 0xc9, 0x5b, 0x89, 0x9b, 0x82, 0x23, 0xa2, 0x72, 0xab, 0xcd, 0x6e, 0xcd, 0x6e, 0x70, 0x44, 0x92, + 0x8d, 0x5d, 0x72, 0xd4, 0x26, 0x7c, 0x00, 0x80, 0x60, 0x1c, 0x86, 0x0c, 0x51, 0x91, 0x45, 0xc5, + 0x12, 0x54, 0x93, 0x6f, 0xc0, 0x65, 0x50, 0x1c, 0xe0, 0x20, 0x40, 0xae, 0x9e, 0x6f, 0x68, 0xad, + 0x92, 0xa5, 0x56, 0xcd, 0x9f, 0x59, 0x50, 0x8a, 0xeb, 0xb1, 0x09, 0x16, 0xa3, 0x3a, 0xf4, 0x6d, + 0xd7, 0x1d, 0x22, 0x2a, 0xa7, 0xac, 0x6c, 0xea, 0x3f, 0xce, 0x9f, 0x54, 0xd5, 0x60, 0xbe, 0x94, + 0x4a, 0x8f, 0x0d, 0x71, 0xe0, 0x59, 0x0b, 0x51, 0x84, 0xda, 0x86, 0x6f, 0xc0, 0xad, 0x18, 0x92, + 0x48, 0xc8, 0xb8, 0x79, 0x36, 0xae, 0x27, 0x55, 0x71, 0x12, 0x02, 0xec, 0x82, 0xdb, 0x31, 0x8f, + 0xf2, 0x7e, 0x54, 0xc3, 0x76, 0x6f, 0xc6, 0x5f, 0x44, 0x5c, 0x74, 0x92, 0x24, 0xc5, 0x37, 0x91, + 0x6f, 0x07, 0x06, 0x77, 0x63, 0x94, 0x28, 0xd6, 0x31, 0xe6, 0xbd, 0x16, 0xaa, 0x11, 0x5b, 0xbb, + 0xf9, 0x8a, 0xa2, 0x35, 0xa5, 0x79, 0x3b, 0x60, 0xc3, 0x30, 0x79, 0x48, 0x3c, 0xd1, 0x09, 0x53, + 0xd3, 0x04, 0xa5, 0x68, 0x3c, 0x61, 0x03, 0x14, 0xb1, 0xdb, 0xff, 0x80, 0x42, 0x51, 0xcc, 0x8a, + 0x59, 0x9e, 0x8c, 0xeb, 0x85, 0xee, 0xd6, 0x2e, 0x0a, 0xad, 0x02, 0x76, 0x77, 0x51, 0x08, 0xab, + 0xa0, 0x70, 0x6a, 0x9f, 0x8c, 0x90, 0xa8, 0x55, 0xde, 0x92, 0x0b, 0xf3, 0xc5, 0xc5, 0xc4, 0xd0, + 0x2e, 0x27, 0x86, 0xf6, 0x7b, 0x62, 0x68, 0x5f, 0xae, 0x8c, 0xcc, 0xe5, 0x95, 0x91, 0xf9, 0x75, + 0x65, 0x64, 0xf6, 0x57, 0x3d, 0xcc, 0x8e, 0x47, 0x87, 0x6d, 0x87, 0xf8, 0x9d, 0x4d, 0x42, 0xfd, + 0xf7, 0xd1, 0x4b, 0xeb, 0x76, 0xce, 0xe4, 0x8b, 0x2b, 0x1e, 0xe3, 0xc3, 0xa2, 0x78, 0x44, 0x9f, + 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xe0, 0xc5, 0x38, 0xf5, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -595,6 +625,7 @@ func (m *GenesisState_GenMsgs_StoreCode) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } + func (m *GenesisState_GenMsgs_InstantiateContract) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -616,6 +647,7 @@ func (m *GenesisState_GenMsgs_InstantiateContract) MarshalToSizedBuffer(dAtA []b } return len(dAtA) - i, nil } + func (m *GenesisState_GenMsgs_ExecuteContract) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -637,6 +669,7 @@ func (m *GenesisState_GenMsgs_ExecuteContract) MarshalToSizedBuffer(dAtA []byte) } return len(dAtA) - i, nil } + func (m *Code) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -806,6 +839,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -865,6 +899,7 @@ func (m *GenesisState_GenMsgs_StoreCode) Size() (n int) { } return n } + func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { if m == nil { return 0 @@ -877,6 +912,7 @@ func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { } return n } + func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { if m == nil { return 0 @@ -889,6 +925,7 @@ func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { } return n } + func (m *Code) Size() (n int) { if m == nil { return 0 @@ -956,9 +993,11 @@ func (m *Sequence) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1178,6 +1217,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1333,6 +1373,7 @@ func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { } return nil } + func (m *Code) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1489,6 +1530,7 @@ func (m *Code) Unmarshal(dAtA []byte) error { } return nil } + func (m *Contract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1672,6 +1714,7 @@ func (m *Contract) Unmarshal(dAtA []byte) error { } return nil } + func (m *Sequence) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1775,6 +1818,7 @@ func (m *Sequence) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/iavl_range_test.go b/x/wasm/types/iavl_range_test.go index 85607dab23..f734561504 100644 --- a/x/wasm/types/iavl_range_test.go +++ b/x/wasm/types/iavl_range_test.go @@ -3,12 +3,13 @@ package types import ( "testing" - dbm "github.com/cometbft/cometbft-db" iavl2 "github.com/cosmos/iavl" + dbm "github.com/cosmos/iavl/db" "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/store" - "github.com/cosmos/cosmos-sdk/store/iavl" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/iavl" ) // This is modeled close to @@ -16,8 +17,7 @@ import ( // and designed to ensure the IAVL store handles bounds the same way as the mock storage we use in Rust contract tests func TestIavlRangeBounds(t *testing.T) { memdb := dbm.NewMemDB() - tree, err := iavl2.NewMutableTree(memdb, 50, false) - require.NoError(t, err) + tree := iavl2.NewMutableTree(memdb, 50, false, log.NewTestLogger(t)) kvstore := iavl.UnsafeNewStore(tree) // values to compare with diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go index 2a5af9b454..0e250491f9 100644 --- a/x/wasm/types/ibc.pb.go +++ b/x/wasm/types/ibc.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -44,9 +47,11 @@ func (*MsgIBCSend) ProtoMessage() {} func (*MsgIBCSend) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{0} } + func (m *MsgIBCSend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgIBCSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgIBCSend.Marshal(b, m, deterministic) @@ -59,12 +64,15 @@ func (m *MsgIBCSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *MsgIBCSend) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgIBCSend.Merge(m, src) } + func (m *MsgIBCSend) XXX_Size() int { return m.Size() } + func (m *MsgIBCSend) XXX_DiscardUnknown() { xxx_messageInfo_MsgIBCSend.DiscardUnknown(m) } @@ -83,9 +91,11 @@ func (*MsgIBCSendResponse) ProtoMessage() {} func (*MsgIBCSendResponse) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{1} } + func (m *MsgIBCSendResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgIBCSendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgIBCSendResponse.Marshal(b, m, deterministic) @@ -98,12 +108,15 @@ func (m *MsgIBCSendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *MsgIBCSendResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgIBCSendResponse.Merge(m, src) } + func (m *MsgIBCSendResponse) XXX_Size() int { return m.Size() } + func (m *MsgIBCSendResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgIBCSendResponse.DiscardUnknown(m) } @@ -121,9 +134,11 @@ func (*MsgIBCCloseChannel) ProtoMessage() {} func (*MsgIBCCloseChannel) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{2} } + func (m *MsgIBCCloseChannel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgIBCCloseChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgIBCCloseChannel.Marshal(b, m, deterministic) @@ -136,12 +151,15 @@ func (m *MsgIBCCloseChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *MsgIBCCloseChannel) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgIBCCloseChannel.Merge(m, src) } + func (m *MsgIBCCloseChannel) XXX_Size() int { return m.Size() } + func (m *MsgIBCCloseChannel) XXX_DiscardUnknown() { xxx_messageInfo_MsgIBCCloseChannel.DiscardUnknown(m) } @@ -297,6 +315,7 @@ func encodeVarintIbc(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgIBCSend) Size() (n int) { if m == nil { return 0 @@ -348,9 +367,11 @@ func (m *MsgIBCCloseChannel) Size() (n int) { func sovIbc(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozIbc(x uint64) (n int) { return sovIbc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgIBCSend) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -505,6 +526,7 @@ func (m *MsgIBCSend) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgIBCSendResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -574,6 +596,7 @@ func (m *MsgIBCSendResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -656,6 +679,7 @@ func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error { } return nil } + func skipIbc(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/params.go b/x/wasm/types/params.go index 9793ee68a0..4b923b1bd3 100644 --- a/x/wasm/types/params.go +++ b/x/wasm/types/params.go @@ -2,7 +2,6 @@ package types import ( "encoding/json" - "fmt" "github.com/cosmos/gogoproto/jsonpb" "github.com/pkg/errors" @@ -104,25 +103,13 @@ func (p Params) ValidateBasic() error { if err := validateAccessType(p.InstantiateDefaultPermission); err != nil { return errors.Wrap(err, "instantiate default permission") } - if err := validateAccessConfig(p.CodeUploadAccess); err != nil { + if err := p.CodeUploadAccess.ValidateBasic(); err != nil { return errors.Wrap(err, "upload access") } return nil } -func validateAccessConfig(i interface{}) error { - v, ok := i.(AccessConfig) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - return v.ValidateBasic() -} - -func validateAccessType(i interface{}) error { - a, ok := i.(AccessType) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } +func validateAccessType(a AccessType) error { if a == AccessTypeUnspecified { return errorsmod.Wrap(ErrEmpty, "type") } diff --git a/x/wasm/types/params_legacy.go b/x/wasm/types/params_legacy.go deleted file mode 100644 index db38cb8bee..0000000000 --- a/x/wasm/types/params_legacy.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov -controlled execution of MsgUpdateParams messages. These types remains solely -for migration purposes and will be removed in a future release. -*/ -package types - -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - -var ( - ParamStoreKeyUploadAccess = []byte("uploadAccess") - ParamStoreKeyInstantiateAccess = []byte("instantiateAccess") -) - -// Deprecated: Type declaration for parameters -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs returns the parameter set pairs. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig), - paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType), - } -} diff --git a/x/wasm/types/proposal_legacy.pb.go b/x/wasm/types/proposal_legacy.pb.go index f91fa0ba3f..79c8e2af1d 100644 --- a/x/wasm/types/proposal_legacy.pb.go +++ b/x/wasm/types/proposal_legacy.pb.go @@ -798,82 +798,84 @@ func init() { } var fileDescriptor_68e9c908a42bedfa = []byte{ - // 1194 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcb, 0x6f, 0x1b, 0x45, - 0x18, 0xf7, 0xc4, 0xf6, 0xda, 0x1e, 0x1b, 0x70, 0xb7, 0x69, 0x32, 0x6d, 0xc3, 0xae, 0xd9, 0x56, - 0x91, 0x55, 0x11, 0x5b, 0x09, 0x0f, 0x81, 0x79, 0x48, 0xde, 0x50, 0x44, 0x2a, 0x22, 0x45, 0x1b, - 0x45, 0x95, 0xb8, 0x2c, 0xe3, 0xdd, 0xf1, 0x66, 0x85, 0xbd, 0x6b, 0xed, 0xac, 0xf3, 0xf8, 0x17, - 0x90, 0x90, 0x38, 0x82, 0xf8, 0x07, 0x2a, 0x4e, 0x95, 0xe8, 0x1f, 0x00, 0x48, 0x48, 0x51, 0x4f, - 0x15, 0xa7, 0x9e, 0x0c, 0x75, 0x0e, 0xbd, 0x71, 0xc8, 0x0d, 0x4e, 0x68, 0x66, 0xd6, 0x89, 0x93, - 0xd8, 0xd9, 0x34, 0x4d, 0x5a, 0x0e, 0x5c, 0x36, 0x99, 0xfd, 0xbe, 0x59, 0xff, 0x1e, 0x33, 0xdf, - 0xce, 0xb7, 0x70, 0xd6, 0xf2, 0x69, 0x7b, 0x13, 0xd3, 0x76, 0x95, 0x5f, 0x36, 0xe6, 0xab, 0x9d, - 0xc0, 0xef, 0xf8, 0x14, 0xb7, 0xcc, 0x16, 0x71, 0xb0, 0xb5, 0x5d, 0xe9, 0x04, 0x7e, 0xe8, 0xcb, - 0xc5, 0x41, 0x5e, 0x85, 0x5f, 0x36, 0xe6, 0xaf, 0x4d, 0x3a, 0xbe, 0xe3, 0xf3, 0x60, 0x95, 0xfd, - 0x27, 0xf2, 0xae, 0x5d, 0x65, 0x79, 0x3e, 0x35, 0x45, 0x40, 0x0c, 0xa2, 0x90, 0x22, 0x46, 0xd5, - 0x06, 0xa6, 0xa4, 0xba, 0x31, 0xdf, 0x20, 0x21, 0x9e, 0xaf, 0x5a, 0xbe, 0xeb, 0x45, 0xf1, 0x99, - 0x63, 0x50, 0xc2, 0xed, 0x0e, 0x19, 0xcc, 0xbe, 0x84, 0xdb, 0xae, 0xe7, 0x57, 0xf9, 0x55, 0xdc, - 0xd2, 0x7e, 0x4d, 0xc2, 0x4b, 0xab, 0xa1, 0x1f, 0x90, 0x45, 0xdf, 0x26, 0x2b, 0x11, 0x6c, 0x79, - 0x12, 0xa6, 0x43, 0x37, 0x6c, 0x11, 0x04, 0x4a, 0xa0, 0x9c, 0x33, 0xc4, 0x40, 0x2e, 0xc1, 0xbc, - 0x4d, 0xa8, 0x15, 0xb8, 0x9d, 0xd0, 0xf5, 0x3d, 0x34, 0xc1, 0x63, 0xc3, 0xb7, 0xe4, 0x2a, 0x94, - 0x82, 0xae, 0x67, 0x62, 0x8a, 0x92, 0x2c, 0xa8, 0xa3, 0xdf, 0x1f, 0xcc, 0x4d, 0x46, 0x04, 0xea, - 0xb6, 0x1d, 0x10, 0x4a, 0x57, 0xc3, 0xc0, 0xf5, 0x1c, 0x23, 0x1d, 0x74, 0xbd, 0x3a, 0x95, 0xdf, - 0x85, 0xaf, 0x32, 0xa0, 0x66, 0x63, 0x3b, 0x24, 0xa6, 0xe5, 0xdb, 0x04, 0xa5, 0x4a, 0xa0, 0x5c, - 0xd0, 0x8b, 0xfd, 0x9e, 0x5a, 0xb8, 0x5b, 0x5f, 0x5d, 0xd6, 0xb7, 0x43, 0x0e, 0xcd, 0x28, 0xb0, - 0xbc, 0xc1, 0x48, 0x5e, 0x83, 0x53, 0xae, 0x47, 0x43, 0xec, 0x85, 0x2e, 0x0e, 0x89, 0xd9, 0x21, - 0x41, 0xdb, 0xa5, 0x94, 0xa1, 0xca, 0x94, 0x40, 0x39, 0xbf, 0xa0, 0x54, 0x8e, 0x6a, 0x5d, 0xa9, - 0x5b, 0x16, 0xa1, 0x74, 0xd1, 0xf7, 0x9a, 0xae, 0x63, 0x5c, 0x19, 0x9a, 0xbd, 0xb2, 0x3f, 0x59, - 0x7e, 0x1d, 0xc2, 0xae, 0xd7, 0x71, 0x3d, 0x01, 0x25, 0x5b, 0x02, 0xe5, 0xac, 0x91, 0xe3, 0x77, - 0xf8, 0xaf, 0x4e, 0x41, 0x89, 0xfa, 0xdd, 0xc0, 0x22, 0x28, 0xc7, 0xb9, 0x47, 0x23, 0x19, 0xc1, - 0x4c, 0xa3, 0xeb, 0xb6, 0x6c, 0x12, 0x20, 0xc8, 0x03, 0x83, 0xa1, 0x7c, 0x1d, 0xe6, 0xd8, 0xa3, - 0xcc, 0x75, 0x4c, 0xd7, 0x51, 0x9e, 0x51, 0x33, 0xb2, 0xec, 0xc6, 0x67, 0x98, 0xae, 0xd7, 0x3e, - 0x78, 0xf8, 0x60, 0xee, 0x5a, 0xa4, 0x8e, 0xe3, 0x6f, 0x54, 0x22, 0x3f, 0x2b, 0x8b, 0xbe, 0x17, - 0x12, 0x2f, 0xfc, 0xfa, 0xe9, 0xfd, 0x5b, 0x53, 0xdc, 0xc6, 0x63, 0x06, 0x21, 0x70, 0x27, 0x95, - 0x4d, 0x17, 0xa5, 0x3b, 0xa9, 0xac, 0x54, 0xcc, 0x68, 0x0f, 0x93, 0xf0, 0xfa, 0xd2, 0x01, 0x21, - 0x36, 0x3f, 0xc0, 0x56, 0xf8, 0xe2, 0xed, 0xac, 0xc0, 0x34, 0xb6, 0xdb, 0xae, 0xc7, 0x5d, 0x3c, - 0x31, 0x9f, 0xa7, 0xc9, 0x37, 0x60, 0x86, 0xcb, 0xe3, 0xda, 0x28, 0x5d, 0x02, 0xe5, 0x94, 0x0e, - 0xfb, 0x3d, 0x55, 0x62, 0x4c, 0x97, 0x3e, 0x31, 0x24, 0x16, 0x5a, 0xb2, 0x19, 0xfa, 0x16, 0x6e, - 0x90, 0x16, 0x92, 0x04, 0x7a, 0x3e, 0x90, 0xcb, 0x30, 0xd9, 0xa6, 0x0e, 0xb7, 0xbb, 0xa0, 0x4f, - 0xfd, 0xd3, 0x53, 0x65, 0x03, 0x6f, 0x0e, 0x98, 0x2f, 0x13, 0x4a, 0xb1, 0x43, 0x0c, 0x96, 0x22, - 0x37, 0x61, 0xba, 0xd9, 0xf5, 0x6c, 0x8a, 0xb2, 0xa5, 0x64, 0x39, 0xbf, 0x70, 0xb5, 0x12, 0x21, - 0x62, 0x7b, 0x68, 0x48, 0x73, 0xd7, 0xd3, 0xdf, 0xd9, 0xe9, 0xa9, 0x89, 0x1f, 0xff, 0x50, 0xcb, - 0x8e, 0x1b, 0xae, 0x77, 0x1b, 0x15, 0xcb, 0x6f, 0x47, 0xdb, 0x2f, 0xfa, 0x33, 0x47, 0xed, 0xaf, - 0xa2, 0x1d, 0xc5, 0x26, 0xd0, 0x7b, 0x4f, 0xef, 0xdf, 0x02, 0x86, 0x78, 0x7c, 0xed, 0x76, 0xbc, - 0x9d, 0x25, 0x6e, 0xe7, 0x09, 0x56, 0x21, 0xa0, 0xfd, 0x9d, 0x84, 0x33, 0x23, 0x32, 0x16, 0xfe, - 0x77, 0xf3, 0x45, 0xba, 0x29, 0xcb, 0x30, 0x45, 0x71, 0x2b, 0xe4, 0x3b, 0xbd, 0x60, 0xf0, 0xff, - 0xe5, 0x69, 0x98, 0x69, 0xba, 0x5b, 0x26, 0x43, 0x0a, 0x79, 0x6d, 0x90, 0x9a, 0xee, 0xd6, 0x32, - 0x75, 0x6a, 0x9f, 0xc6, 0x5b, 0xff, 0xc6, 0x38, 0xeb, 0x17, 0x86, 0xbc, 0xff, 0x7e, 0x02, 0x4e, - 0x2f, 0xbb, 0x4e, 0x70, 0x9e, 0x9b, 0xf8, 0x6d, 0x98, 0xb5, 0xa2, 0x67, 0xc5, 0x1a, 0xb9, 0x9f, - 0x79, 0x3a, 0x2f, 0x23, 0xd7, 0xa4, 0x58, 0xd7, 0x6a, 0xf5, 0x78, 0x81, 0x66, 0xb8, 0x40, 0x63, - 0xd8, 0x23, 0xa0, 0xfd, 0x05, 0xe0, 0xe4, 0x6a, 0xd7, 0xf6, 0x2f, 0x44, 0x98, 0xe4, 0xa9, 0x85, - 0x89, 0x38, 0xa7, 0xe2, 0x39, 0x7f, 0x1c, 0xcf, 0xf9, 0xaa, 0x28, 0xef, 0x23, 0x58, 0x21, 0xa0, - 0x7d, 0x93, 0x84, 0xd3, 0xb7, 0xb7, 0x88, 0xd5, 0x7d, 0x99, 0x15, 0xfd, 0x6c, 0xab, 0x27, 0x12, - 0x29, 0xfd, 0x0c, 0xdb, 0x59, 0xba, 0xd8, 0xe2, 0x7c, 0xea, 0x05, 0x38, 0x46, 0x71, 0xe6, 0xc7, - 0x04, 0xbc, 0xbc, 0xd6, 0xb1, 0x71, 0x48, 0xea, 0xac, 0xdc, 0x3d, 0xb7, 0x17, 0x4b, 0x30, 0xe7, - 0x91, 0x4d, 0x53, 0x94, 0x58, 0x61, 0xc7, 0x9b, 0x7b, 0x3d, 0xb5, 0xb8, 0x8d, 0xdb, 0xad, 0x9a, - 0xb6, 0x1f, 0xd2, 0xc6, 0xeb, 0xed, 0x91, 0x4d, 0x0e, 0xe5, 0x6c, 0x2e, 0xd5, 0x3e, 0x8a, 0xd7, - 0x04, 0x71, 0x4d, 0x46, 0xb0, 0x46, 0x40, 0xfb, 0x19, 0x40, 0x79, 0xb1, 0x45, 0x70, 0x70, 0x3e, - 0x72, 0x9c, 0x69, 0x3b, 0xd6, 0x3e, 0x8c, 0xe7, 0x30, 0xcd, 0x39, 0x1c, 0x47, 0x8a, 0x80, 0xf6, - 0x0b, 0x80, 0xc5, 0x15, 0x71, 0xb8, 0xa3, 0xcf, 0x4d, 0xe0, 0x7d, 0x98, 0x8d, 0x4a, 0x26, 0xdb, - 0x5d, 0xc9, 0x72, 0x4a, 0x57, 0xfa, 0x3d, 0x35, 0x23, 0x6a, 0x26, 0xdd, 0xeb, 0xa9, 0xaf, 0x09, - 0x67, 0x07, 0x49, 0x9a, 0x91, 0x11, 0x75, 0x94, 0xd6, 0x6a, 0xf1, 0x2c, 0xae, 0x70, 0x16, 0x47, - 0xc1, 0x22, 0xa0, 0xfd, 0x06, 0xa0, 0xbc, 0x36, 0x38, 0xa2, 0xbe, 0x54, 0x16, 0xa7, 0xf6, 0xe2, - 0x38, 0x5c, 0x04, 0xb4, 0x1f, 0x00, 0x94, 0x87, 0xcf, 0xe8, 0x62, 0xd1, 0x0d, 0xbf, 0x88, 0xc0, - 0xd8, 0x17, 0xd1, 0x97, 0x63, 0xdb, 0x81, 0x89, 0xd3, 0xb4, 0x03, 0x7a, 0x8e, 0xd5, 0x16, 0x51, - 0x2f, 0x46, 0x77, 0x06, 0xda, 0x4f, 0x13, 0x50, 0x15, 0x88, 0x0e, 0xbf, 0xc2, 0x9b, 0xae, 0xb3, - 0x2f, 0xf9, 0xec, 0x21, 0xc9, 0xf5, 0xe2, 0x5e, 0x4f, 0x2d, 0x08, 0xb1, 0xf8, 0x6d, 0x6d, 0x60, - 0xc2, 0x7b, 0x23, 0x4c, 0xd0, 0xa7, 0xf6, 0x7a, 0xaa, 0x2c, 0xb2, 0x87, 0x82, 0xda, 0x61, 0x73, - 0x2c, 0x78, 0x05, 0x73, 0xdc, 0xa6, 0xc5, 0x7f, 0xda, 0xec, 0x72, 0x48, 0xc2, 0xa9, 0xfc, 0xc2, - 0xcd, 0x93, 0x69, 0x0a, 0xfc, 0xc3, 0x64, 0x2f, 0xe3, 0x63, 0x61, 0x5a, 0x5b, 0x8a, 0xb7, 0xf1, - 0xe6, 0x50, 0x59, 0x18, 0xab, 0x07, 0x02, 0xda, 0x77, 0x69, 0x78, 0x83, 0x37, 0x2f, 0x75, 0xcf, - 0xfe, 0x4f, 0x34, 0x28, 0xe7, 0xdf, 0x6f, 0xa6, 0xcf, 0xaf, 0xdf, 0x94, 0x8e, 0xf6, 0x9b, 0x93, - 0x83, 0x03, 0x78, 0x46, 0xc8, 0x22, 0x8e, 0xd9, 0xfb, 0x27, 0xe8, 0xec, 0x88, 0x13, 0x74, 0xee, - 0x19, 0x5e, 0xb9, 0xf0, 0x62, 0x4f, 0xd0, 0x07, 0xdd, 0x72, 0x7e, 0x5c, 0xb7, 0x5c, 0x38, 0xa1, - 0x5b, 0x7e, 0xe5, 0x48, 0xb7, 0xbc, 0x1c, 0xbf, 0x2c, 0xcb, 0x07, 0xdd, 0xf2, 0xc9, 0x0b, 0x0e, - 0x01, 0xfd, 0xf3, 0x9d, 0x27, 0x4a, 0xe2, 0xf1, 0x13, 0x25, 0x71, 0xaf, 0xaf, 0x80, 0x9d, 0xbe, - 0x02, 0x1e, 0xf5, 0x15, 0xf0, 0x67, 0x5f, 0x01, 0xdf, 0xee, 0x2a, 0x89, 0x47, 0xbb, 0x4a, 0xe2, - 0xf1, 0xae, 0x92, 0xf8, 0x62, 0x76, 0x88, 0xf9, 0xa2, 0x4f, 0xdb, 0x77, 0x07, 0x9f, 0x56, 0xec, - 0xea, 0x96, 0xf8, 0xc4, 0xc2, 0xd9, 0x37, 0x24, 0xfe, 0x35, 0xe5, 0xad, 0x7f, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xe5, 0x17, 0x08, 0x1e, 0x0b, 0x12, 0x00, 0x00, + // 1223 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc4, 0xf6, 0xda, 0x1e, 0x1b, 0x70, 0xb7, 0x69, 0x32, 0x6d, 0xc3, 0xda, 0x6c, 0xab, + 0xc8, 0x8a, 0x88, 0xad, 0x04, 0x84, 0x8a, 0xf9, 0x21, 0xd9, 0xa1, 0x15, 0xa9, 0x88, 0x14, 0x6d, + 0x14, 0x55, 0xe2, 0xb2, 0xac, 0x77, 0x27, 0x9b, 0x05, 0x7b, 0xc6, 0xda, 0x59, 0xe7, 0xc7, 0xbf, + 0x80, 0x84, 0xc4, 0xb9, 0xfc, 0x03, 0x85, 0x03, 0x8a, 0x44, 0x2f, 0xdc, 0x00, 0x09, 0x29, 0xe2, + 0x54, 0x71, 0xea, 0xc9, 0x50, 0xe7, 0x90, 0x03, 0xb7, 0x1c, 0x39, 0x20, 0x34, 0x33, 0xeb, 0xc4, + 0x49, 0xec, 0x38, 0x4d, 0x42, 0xda, 0x03, 0x97, 0xb5, 0x67, 0xde, 0x9b, 0x9d, 0xf7, 0x7d, 0xdf, + 0xcc, 0x9b, 0x79, 0x0b, 0x27, 0x6d, 0xca, 0x1a, 0xeb, 0x16, 0x6b, 0x94, 0xc4, 0x63, 0x6d, 0xa6, + 0xd4, 0xf4, 0x69, 0x93, 0x32, 0xab, 0x6e, 0xd6, 0xb1, 0x6b, 0xd9, 0x9b, 0xc5, 0xa6, 0x4f, 0x03, + 0xaa, 0x66, 0xbb, 0x7e, 0x45, 0xf1, 0x58, 0x9b, 0xb9, 0x31, 0xea, 0x52, 0x97, 0x0a, 0x63, 0x89, + 0xff, 0x93, 0x7e, 0x37, 0xae, 0x73, 0x3f, 0xca, 0x4c, 0x69, 0x90, 0x8d, 0xd0, 0xa4, 0xc9, 0x56, + 0xa9, 0x66, 0x31, 0x5c, 0x5a, 0x9b, 0xa9, 0xe1, 0xc0, 0x9a, 0x29, 0xd9, 0xd4, 0x23, 0xa1, 0x7d, + 0xe2, 0x58, 0x28, 0xc1, 0x66, 0x13, 0x77, 0x47, 0x5f, 0xb1, 0x1a, 0x1e, 0xa1, 0x25, 0xf1, 0x94, + 0x5d, 0xfa, 0x2f, 0x51, 0x78, 0x65, 0x29, 0xa0, 0x3e, 0x9e, 0xa3, 0x0e, 0x5e, 0x0c, 0xc3, 0x56, + 0x47, 0x61, 0x3c, 0xf0, 0x82, 0x3a, 0x46, 0x20, 0x0f, 0x0a, 0x29, 0x43, 0x36, 0xd4, 0x3c, 0x4c, + 0x3b, 0x98, 0xd9, 0xbe, 0xd7, 0x0c, 0x3c, 0x4a, 0xd0, 0x88, 0xb0, 0xf5, 0x76, 0xa9, 0x25, 0xa8, + 0xf8, 0x2d, 0x62, 0x5a, 0x0c, 0x45, 0xb9, 0xb1, 0x8a, 0x7e, 0x7f, 0x3c, 0x3d, 0x1a, 0x02, 0xa8, + 0x38, 0x8e, 0x8f, 0x19, 0x5b, 0x0a, 0x7c, 0x8f, 0xb8, 0x46, 0xdc, 0x6f, 0x91, 0x0a, 0x53, 0xdf, + 0x81, 0xaf, 0xf2, 0x40, 0xcd, 0xda, 0x66, 0x80, 0x4d, 0x9b, 0x3a, 0x18, 0xc5, 0xf2, 0xa0, 0x90, + 0xa9, 0x66, 0x3b, 0xed, 0x5c, 0xe6, 0x41, 0x65, 0x69, 0xa1, 0xba, 0x19, 0x88, 0xd0, 0x8c, 0x0c, + 0xf7, 0xeb, 0xb6, 0xd4, 0x65, 0x38, 0xe6, 0x11, 0x16, 0x58, 0x24, 0xf0, 0xac, 0x00, 0x9b, 0x4d, + 0xec, 0x37, 0x3c, 0xc6, 0x78, 0x54, 0x89, 0x3c, 0x28, 0xa4, 0x67, 0xb5, 0xe2, 0x51, 0xae, 0x8b, + 0x15, 0xdb, 0xc6, 0x8c, 0xcd, 0x51, 0xb2, 0xe2, 0xb9, 0xc6, 0xb5, 0x9e, 0xd1, 0x8b, 0xfb, 0x83, + 0xd5, 0xd7, 0x21, 0x6c, 0x91, 0xa6, 0x47, 0x64, 0x28, 0xc9, 0x3c, 0x28, 0x24, 0x8d, 0x94, 0xe8, + 0x11, 0xb3, 0x8e, 0x41, 0x85, 0xd1, 0x96, 0x6f, 0x63, 0x94, 0x12, 0xd8, 0xc3, 0x96, 0x8a, 0x60, + 0xa2, 0xd6, 0xf2, 0xea, 0x0e, 0xf6, 0x11, 0x14, 0x86, 0x6e, 0x53, 0xbd, 0x09, 0x53, 0xfc, 0x55, + 0xe6, 0xaa, 0xc5, 0x56, 0x51, 0x9a, 0x43, 0x33, 0x92, 0xbc, 0xe3, 0x63, 0x8b, 0xad, 0x96, 0xdf, + 0xfb, 0xed, 0xf1, 0xf4, 0x8d, 0x90, 0x1d, 0x97, 0xae, 0x15, 0x43, 0x3d, 0x8b, 0x73, 0x94, 0x04, + 0x98, 0x04, 0x5f, 0xee, 0x6e, 0x4d, 0x8d, 0x09, 0x19, 0x8f, 0x09, 0x84, 0xc0, 0xfd, 0x58, 0x32, + 0x9e, 0x55, 0xee, 0xc7, 0x92, 0x4a, 0x36, 0xa1, 0xff, 0x15, 0x85, 0x37, 0xe7, 0x0f, 0x00, 0xf1, + 0xf1, 0xbe, 0x65, 0x07, 0x97, 0x2f, 0x67, 0x11, 0xc6, 0x2d, 0xa7, 0xe1, 0x11, 0xa1, 0xe2, 0x89, + 0xfe, 0xc2, 0x4d, 0xbd, 0x05, 0x13, 0x82, 0x1e, 0xcf, 0x41, 0xf1, 0x3c, 0x28, 0xc4, 0xaa, 0xb0, + 0xd3, 0xce, 0x29, 0x1c, 0xe9, 0xfc, 0x47, 0x86, 0xc2, 0x4d, 0xf3, 0x0e, 0x8f, 0xbe, 0x6e, 0xd5, + 0x70, 0x1d, 0x29, 0x32, 0x7a, 0xd1, 0x50, 0xef, 0xc0, 0x68, 0x83, 0xb9, 0x42, 0xee, 0x4c, 0x75, + 0xf2, 0xef, 0x76, 0x4e, 0x35, 0xac, 0xf5, 0x2e, 0xf2, 0x05, 0xcc, 0x98, 0xe5, 0xe2, 0x87, 0xbb, + 0x5b, 0x53, 0x69, 0x8f, 0xd4, 0x3d, 0x82, 0xcd, 0xcf, 0x19, 0x25, 0x06, 0x1f, 0xa2, 0xae, 0xc3, + 0xf8, 0x4a, 0x8b, 0x38, 0x0c, 0x25, 0xf3, 0xd1, 0x42, 0x7a, 0xf6, 0x7a, 0x31, 0x8c, 0x90, 0xef, + 0xa9, 0x1e, 0x0d, 0x3c, 0x52, 0xbd, 0xb7, 0xdd, 0xce, 0x45, 0xbe, 0xfb, 0x23, 0x57, 0x70, 0xbd, + 0x60, 0xb5, 0x55, 0x2b, 0xda, 0xb4, 0x11, 0x6e, 0xc7, 0xf0, 0x67, 0x9a, 0x39, 0x5f, 0x84, 0x3b, + 0x8c, 0x0f, 0x60, 0x7c, 0xc2, 0x8c, 0xdc, 0xf3, 0x26, 0xdf, 0x95, 0xec, 0xd1, 0xee, 0xd6, 0x14, + 0x30, 0xe4, 0x7c, 0xe5, 0xbb, 0xc3, 0xf5, 0xce, 0x0b, 0xbd, 0x4f, 0xd0, 0x12, 0x01, 0xfd, 0x61, + 0x0c, 0x4e, 0xf4, 0xf1, 0x98, 0xfd, 0x5f, 0xee, 0x97, 0x4a, 0x6e, 0x55, 0x85, 0x31, 0x66, 0xd5, + 0x03, 0x91, 0x2b, 0x32, 0x86, 0xf8, 0xaf, 0x8e, 0xc3, 0xc4, 0x8a, 0xb7, 0x61, 0x72, 0x28, 0x50, + 0x64, 0x17, 0x65, 0xc5, 0xdb, 0x58, 0x60, 0x6e, 0xf9, 0xde, 0xf0, 0xb5, 0xf1, 0xc6, 0xa0, 0xb5, + 0x31, 0xdb, 0xb3, 0x38, 0xbe, 0x1d, 0x81, 0xe3, 0x0b, 0x9e, 0xeb, 0x5f, 0x64, 0x1a, 0x78, 0x1b, + 0x26, 0xed, 0xf0, 0x5d, 0x43, 0x95, 0xde, 0xf7, 0x3c, 0x9d, 0xd8, 0xa1, 0xac, 0xca, 0x73, 0xcb, + 0x5a, 0xae, 0x0c, 0x27, 0x6c, 0x42, 0x10, 0x36, 0x80, 0x0d, 0x04, 0xf4, 0x7f, 0x00, 0x1c, 0x5d, + 0x6a, 0x39, 0xf4, 0x3f, 0x21, 0x2a, 0x7a, 0x6a, 0xa2, 0x42, 0x0e, 0x62, 0xcf, 0xcf, 0xc1, 0x87, + 0xc3, 0x39, 0xb8, 0x2e, 0x0f, 0x90, 0x3e, 0x28, 0x11, 0xd0, 0xbf, 0x8f, 0xc2, 0xf1, 0xbb, 0x1b, + 0xd8, 0x6e, 0xbd, 0xc8, 0x33, 0xe3, 0x6c, 0xab, 0x2b, 0x24, 0x2d, 0x7e, 0x8e, 0x7c, 0xa0, 0x5c, + 0x72, 0xfa, 0x3f, 0xf5, 0x8a, 0x1d, 0x20, 0x09, 0x02, 0xfa, 0x57, 0x23, 0xf0, 0xea, 0x72, 0xd3, + 0xb1, 0x02, 0x5c, 0xe1, 0x09, 0xf5, 0xdc, 0x62, 0xcd, 0xc3, 0x14, 0xc1, 0xeb, 0xa6, 0x4c, 0xe2, + 0x52, 0xaf, 0x37, 0xf7, 0xda, 0xb9, 0xec, 0xa6, 0xd5, 0xa8, 0x97, 0xf5, 0x7d, 0x93, 0x3e, 0x58, + 0x10, 0x82, 0xd7, 0x45, 0x28, 0x67, 0x93, 0xb1, 0xfc, 0xc1, 0x70, 0x4e, 0x90, 0xe0, 0xa4, 0x0f, + 0x6a, 0x04, 0xf4, 0x9f, 0x00, 0x54, 0xe7, 0xea, 0xd8, 0xf2, 0x2f, 0x86, 0x8e, 0x33, 0xed, 0xdf, + 0xf2, 0xfb, 0xc3, 0x31, 0x8c, 0x0b, 0x0c, 0xc7, 0x23, 0x45, 0x40, 0xff, 0x19, 0xc0, 0xec, 0xa2, + 0xbc, 0x5f, 0xb2, 0x73, 0x03, 0x78, 0x17, 0x26, 0xc3, 0x9c, 0xcb, 0xb7, 0x5f, 0xb4, 0x10, 0xab, + 0x6a, 0x9d, 0x76, 0x2e, 0x21, 0x93, 0x2e, 0xdb, 0x6b, 0xe7, 0x5e, 0x93, 0xca, 0x76, 0x9d, 0x74, + 0x23, 0x21, 0x13, 0x31, 0x2b, 0x97, 0x87, 0xa3, 0xb8, 0x26, 0x50, 0x1c, 0x0d, 0x16, 0x01, 0xfd, + 0x57, 0x00, 0xd5, 0xe5, 0xee, 0x2d, 0xf9, 0x85, 0xa2, 0x38, 0xb5, 0x16, 0xc7, 0xc3, 0x45, 0x40, + 0xff, 0x06, 0x40, 0xb5, 0xb7, 0x4c, 0x90, 0x8b, 0xae, 0xf7, 0x24, 0x03, 0x03, 0x4f, 0xb2, 0xcf, + 0x06, 0x56, 0x24, 0x23, 0xa7, 0xa9, 0x48, 0xaa, 0x29, 0x9e, 0x6c, 0x64, 0xbe, 0xe8, 0x5f, 0x9c, + 0xe8, 0x3f, 0x8c, 0xc0, 0x9c, 0x8c, 0xe8, 0xf0, 0x1d, 0x60, 0xc5, 0x73, 0xf7, 0x29, 0x9f, 0x3c, + 0x44, 0x79, 0x35, 0xbb, 0xd7, 0xce, 0x65, 0x24, 0x59, 0xa2, 0x5b, 0xef, 0x8a, 0x70, 0xa7, 0x8f, + 0x08, 0xd5, 0xb1, 0xbd, 0x76, 0x4e, 0x95, 0xde, 0x3d, 0x46, 0xfd, 0xb0, 0x38, 0x36, 0xbc, 0x66, + 0x89, 0xb8, 0x4d, 0x5b, 0x4c, 0x6d, 0xb6, 0x44, 0x48, 0x52, 0xa9, 0xf4, 0xec, 0xed, 0x93, 0x61, + 0xca, 0xf8, 0x7b, 0xc1, 0x5e, 0xb5, 0x8e, 0x99, 0x59, 0x79, 0x7e, 0xb8, 0x8c, 0xb7, 0x7b, 0xd2, + 0xc2, 0x40, 0x3e, 0x10, 0xd0, 0x7f, 0x8c, 0xc3, 0x5b, 0xa2, 0x7e, 0xaa, 0x10, 0xe7, 0xa5, 0xa8, + 0x91, 0x2e, 0xbe, 0xe4, 0x8d, 0x5f, 0x5c, 0xc9, 0xab, 0x1c, 0x2d, 0x79, 0x47, 0xbb, 0x57, 0xfc, + 0x84, 0xa4, 0x45, 0x5e, 0xe4, 0xf7, 0xef, 0xe8, 0xc9, 0x3e, 0x77, 0xf4, 0xd4, 0x39, 0xce, 0x64, + 0x78, 0xc9, 0x77, 0xf4, 0x83, 0x8a, 0x3e, 0x3d, 0xa8, 0xa2, 0xcf, 0x9c, 0x50, 0xd1, 0xbf, 0x72, + 0xa4, 0xa2, 0x5f, 0x18, 0xbe, 0x6e, 0x0b, 0x07, 0x15, 0xfd, 0xc9, 0x2b, 0x12, 0x81, 0xea, 0x27, + 0xdb, 0xcf, 0xb4, 0xc8, 0xd3, 0x67, 0x5a, 0xe4, 0x51, 0x47, 0x03, 0xdb, 0x1d, 0x0d, 0x3c, 0xe9, + 0x68, 0xe0, 0xcf, 0x8e, 0x06, 0xbe, 0xde, 0xd1, 0x22, 0x4f, 0x76, 0xb4, 0xc8, 0xd3, 0x1d, 0x2d, + 0xf2, 0xe9, 0x64, 0x0f, 0x15, 0x73, 0x94, 0x35, 0x1e, 0x74, 0x3f, 0xff, 0x38, 0xa5, 0x0d, 0xf9, + 0x19, 0x48, 0xd0, 0x51, 0x53, 0xc4, 0x17, 0x9f, 0xb7, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xef, + 0x55, 0x12, 0x27, 0xaf, 0x12, 0x00, 0x00, } func (this *StoreCodeProposal) Equal(that interface{}) bool { diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index a9a2bdbaf1..8b53310a7f 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -7,7 +7,12 @@ import ( bytes "bytes" context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes" + _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,15 +22,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -46,9 +50,11 @@ func (*QueryContractInfoRequest) ProtoMessage() {} func (*QueryContractInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{0} } + func (m *QueryContractInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoRequest.Marshal(b, m, deterministic) @@ -61,12 +67,15 @@ func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryContractInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoRequest.Merge(m, src) } + func (m *QueryContractInfoRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoRequest.DiscardUnknown(m) } @@ -87,9 +96,11 @@ func (*QueryContractInfoResponse) ProtoMessage() {} func (*QueryContractInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{1} } + func (m *QueryContractInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoResponse.Marshal(b, m, deterministic) @@ -102,12 +113,15 @@ func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryContractInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoResponse.Merge(m, src) } + func (m *QueryContractInfoResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoResponse.DiscardUnknown(m) } @@ -129,9 +143,11 @@ func (*QueryContractHistoryRequest) ProtoMessage() {} func (*QueryContractHistoryRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{2} } + func (m *QueryContractHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryRequest.Marshal(b, m, deterministic) @@ -144,12 +160,15 @@ func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractHistoryRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryRequest.Merge(m, src) } + func (m *QueryContractHistoryRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryRequest.DiscardUnknown(m) } @@ -170,9 +189,11 @@ func (*QueryContractHistoryResponse) ProtoMessage() {} func (*QueryContractHistoryResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{3} } + func (m *QueryContractHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryResponse.Marshal(b, m, deterministic) @@ -185,12 +206,15 @@ func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractHistoryResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryResponse.Merge(m, src) } + func (m *QueryContractHistoryResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryResponse.DiscardUnknown(m) } @@ -211,9 +235,11 @@ func (*QueryContractsByCodeRequest) ProtoMessage() {} func (*QueryContractsByCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{4} } + func (m *QueryContractsByCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeRequest.Marshal(b, m, deterministic) @@ -226,12 +252,15 @@ func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractsByCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeRequest.Merge(m, src) } + func (m *QueryContractsByCodeRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeRequest.DiscardUnknown(m) } @@ -253,9 +282,11 @@ func (*QueryContractsByCodeResponse) ProtoMessage() {} func (*QueryContractsByCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{5} } + func (m *QueryContractsByCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeResponse.Marshal(b, m, deterministic) @@ -268,12 +299,15 @@ func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractsByCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeResponse.Merge(m, src) } + func (m *QueryContractsByCodeResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeResponse.DiscardUnknown(m) } @@ -295,9 +329,11 @@ func (*QueryAllContractStateRequest) ProtoMessage() {} func (*QueryAllContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{6} } + func (m *QueryAllContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateRequest.Marshal(b, m, deterministic) @@ -310,12 +346,15 @@ func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryAllContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateRequest.Merge(m, src) } + func (m *QueryAllContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QueryAllContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateRequest.DiscardUnknown(m) } @@ -336,9 +375,11 @@ func (*QueryAllContractStateResponse) ProtoMessage() {} func (*QueryAllContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{7} } + func (m *QueryAllContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateResponse.Marshal(b, m, deterministic) @@ -351,12 +392,15 @@ func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryAllContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateResponse.Merge(m, src) } + func (m *QueryAllContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QueryAllContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateResponse.DiscardUnknown(m) } @@ -377,9 +421,11 @@ func (*QueryRawContractStateRequest) ProtoMessage() {} func (*QueryRawContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{8} } + func (m *QueryRawContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateRequest.Marshal(b, m, deterministic) @@ -392,12 +438,15 @@ func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryRawContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateRequest.Merge(m, src) } + func (m *QueryRawContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QueryRawContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateRequest.DiscardUnknown(m) } @@ -417,9 +466,11 @@ func (*QueryRawContractStateResponse) ProtoMessage() {} func (*QueryRawContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{9} } + func (m *QueryRawContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateResponse.Marshal(b, m, deterministic) @@ -432,12 +483,15 @@ func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryRawContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateResponse.Merge(m, src) } + func (m *QueryRawContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QueryRawContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateResponse.DiscardUnknown(m) } @@ -459,9 +513,11 @@ func (*QuerySmartContractStateRequest) ProtoMessage() {} func (*QuerySmartContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{10} } + func (m *QuerySmartContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateRequest.Marshal(b, m, deterministic) @@ -474,12 +530,15 @@ func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QuerySmartContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateRequest.Merge(m, src) } + func (m *QuerySmartContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QuerySmartContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateRequest.DiscardUnknown(m) } @@ -499,9 +558,11 @@ func (*QuerySmartContractStateResponse) ProtoMessage() {} func (*QuerySmartContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{11} } + func (m *QuerySmartContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateResponse.Marshal(b, m, deterministic) @@ -514,12 +575,15 @@ func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QuerySmartContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateResponse.Merge(m, src) } + func (m *QuerySmartContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateResponse.DiscardUnknown(m) } @@ -537,9 +601,11 @@ func (*QueryCodeRequest) ProtoMessage() {} func (*QueryCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{12} } + func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeRequest.Marshal(b, m, deterministic) @@ -552,12 +618,15 @@ func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *QueryCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeRequest.Merge(m, src) } + func (m *QueryCodeRequest) XXX_Size() int { return m.Size() } + func (m *QueryCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) } @@ -578,9 +647,11 @@ func (*CodeInfoResponse) ProtoMessage() {} func (*CodeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{13} } + func (m *CodeInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfoResponse.Marshal(b, m, deterministic) @@ -593,12 +664,15 @@ func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *CodeInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfoResponse.Merge(m, src) } + func (m *CodeInfoResponse) XXX_Size() int { return m.Size() } + func (m *CodeInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfoResponse.DiscardUnknown(m) } @@ -617,9 +691,11 @@ func (*QueryCodeResponse) ProtoMessage() {} func (*QueryCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{14} } + func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeResponse.Marshal(b, m, deterministic) @@ -632,12 +708,15 @@ func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *QueryCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeResponse.Merge(m, src) } + func (m *QueryCodeResponse) XXX_Size() int { return m.Size() } + func (m *QueryCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) } @@ -656,9 +735,11 @@ func (*QueryCodesRequest) ProtoMessage() {} func (*QueryCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{15} } + func (m *QueryCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesRequest.Marshal(b, m, deterministic) @@ -671,12 +752,15 @@ func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *QueryCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesRequest.Merge(m, src) } + func (m *QueryCodesRequest) XXX_Size() int { return m.Size() } + func (m *QueryCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesRequest.DiscardUnknown(m) } @@ -696,9 +780,11 @@ func (*QueryCodesResponse) ProtoMessage() {} func (*QueryCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{16} } + func (m *QueryCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesResponse.Marshal(b, m, deterministic) @@ -711,12 +797,15 @@ func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesResponse.Merge(m, src) } + func (m *QueryCodesResponse) XXX_Size() int { return m.Size() } + func (m *QueryCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesResponse.DiscardUnknown(m) } @@ -736,9 +825,11 @@ func (*QueryPinnedCodesRequest) ProtoMessage() {} func (*QueryPinnedCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{17} } + func (m *QueryPinnedCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesRequest.Marshal(b, m, deterministic) @@ -751,12 +842,15 @@ func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryPinnedCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesRequest.Merge(m, src) } + func (m *QueryPinnedCodesRequest) XXX_Size() int { return m.Size() } + func (m *QueryPinnedCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesRequest.DiscardUnknown(m) } @@ -777,9 +871,11 @@ func (*QueryPinnedCodesResponse) ProtoMessage() {} func (*QueryPinnedCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{18} } + func (m *QueryPinnedCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesResponse.Marshal(b, m, deterministic) @@ -792,12 +888,15 @@ func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryPinnedCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesResponse.Merge(m, src) } + func (m *QueryPinnedCodesResponse) XXX_Size() int { return m.Size() } + func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesResponse.DiscardUnknown(m) } @@ -805,8 +904,7 @@ func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPinnedCodesResponse proto.InternalMessageInfo // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -814,9 +912,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{19} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -829,12 +929,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -853,9 +956,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{20} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -868,12 +973,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -895,9 +1003,11 @@ func (*QueryContractsByCreatorRequest) ProtoMessage() {} func (*QueryContractsByCreatorRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{21} } + func (m *QueryContractsByCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCreatorRequest.Marshal(b, m, deterministic) @@ -910,12 +1020,15 @@ func (m *QueryContractsByCreatorRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QueryContractsByCreatorRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCreatorRequest.Merge(m, src) } + func (m *QueryContractsByCreatorRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCreatorRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCreatorRequest.DiscardUnknown(m) } @@ -937,9 +1050,11 @@ func (*QueryContractsByCreatorResponse) ProtoMessage() {} func (*QueryContractsByCreatorResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{22} } + func (m *QueryContractsByCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCreatorResponse.Marshal(b, m, deterministic) @@ -952,18 +1067,118 @@ func (m *QueryContractsByCreatorResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QueryContractsByCreatorResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCreatorResponse.Merge(m, src) } + func (m *QueryContractsByCreatorResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCreatorResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCreatorResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryContractsByCreatorResponse proto.InternalMessageInfo +// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC +// method. +type QueryBuildAddressRequest struct { + // CodeHash is the hash of the code + CodeHash string `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // CreatorAddress is the address of the contract instantiator + CreatorAddress string `protobuf:"bytes,2,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` + // Salt is a hex encoded salt + Salt string `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"` + // InitArgs are optional json encoded init args to be used in contract address + // building if provided + InitArgs []byte `protobuf:"bytes,4,opt,name=init_args,json=initArgs,proto3" json:"init_args,omitempty"` +} + +func (m *QueryBuildAddressRequest) Reset() { *m = QueryBuildAddressRequest{} } +func (m *QueryBuildAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBuildAddressRequest) ProtoMessage() {} +func (*QueryBuildAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{23} +} + +func (m *QueryBuildAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *QueryBuildAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuildAddressRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *QueryBuildAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuildAddressRequest.Merge(m, src) +} + +func (m *QueryBuildAddressRequest) XXX_Size() int { + return m.Size() +} + +func (m *QueryBuildAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuildAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuildAddressRequest proto.InternalMessageInfo + +// QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC +// method. +type QueryBuildAddressResponse struct { + // Address is the contract address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryBuildAddressResponse) Reset() { *m = QueryBuildAddressResponse{} } +func (m *QueryBuildAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBuildAddressResponse) ProtoMessage() {} +func (*QueryBuildAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{24} +} + +func (m *QueryBuildAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *QueryBuildAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuildAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} + +func (m *QueryBuildAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuildAddressResponse.Merge(m, src) +} + +func (m *QueryBuildAddressResponse) XXX_Size() int { + return m.Size() +} + +func (m *QueryBuildAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuildAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuildAddressResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryContractInfoRequest)(nil), "cosmwasm.wasm.v1.QueryContractInfoRequest") proto.RegisterType((*QueryContractInfoResponse)(nil), "cosmwasm.wasm.v1.QueryContractInfoResponse") @@ -988,97 +1203,108 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasm.wasm.v1.QueryParamsResponse") proto.RegisterType((*QueryContractsByCreatorRequest)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorRequest") proto.RegisterType((*QueryContractsByCreatorResponse)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorResponse") + proto.RegisterType((*QueryBuildAddressRequest)(nil), "cosmwasm.wasm.v1.QueryBuildAddressRequest") + proto.RegisterType((*QueryBuildAddressResponse)(nil), "cosmwasm.wasm.v1.QueryBuildAddressResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1346 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x1f, 0x93, 0x96, 0x3a, 0x43, 0x69, 0x8d, 0x49, 0xd7, 0xd1, 0x52, - 0xd2, 0xd4, 0x6d, 0x77, 0x9b, 0xb4, 0x55, 0x45, 0x11, 0x42, 0x71, 0x0a, 0xa4, 0x15, 0x15, 0xe9, - 0x56, 0xa2, 0x12, 0x1c, 0xcc, 0xd8, 0x3b, 0x71, 0x56, 0x8a, 0x77, 0xdc, 0x9d, 0x49, 0x52, 0x2b, - 0x0a, 0xa0, 0x4a, 0x9c, 0xe0, 0x00, 0xaa, 0x38, 0x70, 0x41, 0x1c, 0x2a, 0xa8, 0xc4, 0x05, 0x71, - 0xaa, 0xb8, 0x72, 0xc9, 0x31, 0x12, 0x17, 0x4e, 0x16, 0x38, 0x48, 0xa0, 0xfc, 0x09, 0x3d, 0xa1, - 0x9d, 0x9d, 0xb5, 0x77, 0x6d, 0x6f, 0xec, 0x54, 0x16, 0x17, 0x6b, 0x77, 0x67, 0xde, 0xbc, 0xcf, - 0xfb, 0xce, 0xcc, 0x7b, 0x4f, 0x86, 0x53, 0x15, 0xca, 0x6a, 0x9b, 0x98, 0xd5, 0x74, 0xf1, 0xb3, - 0x31, 0xa7, 0xdf, 0x5f, 0x27, 0x4e, 0x43, 0xab, 0x3b, 0x94, 0x53, 0x94, 0xf1, 0x47, 0x35, 0xf1, - 0xb3, 0x31, 0x97, 0x3b, 0x51, 0xa5, 0x55, 0x2a, 0x06, 0x75, 0xf7, 0xc9, 0x9b, 0x97, 0xeb, 0x5d, - 0x85, 0x37, 0xea, 0x84, 0xf9, 0xa3, 0x55, 0x4a, 0xab, 0x6b, 0x44, 0xc7, 0x75, 0x4b, 0xc7, 0xb6, - 0x4d, 0x39, 0xe6, 0x16, 0xb5, 0xfd, 0xd1, 0x82, 0x6b, 0x4b, 0x99, 0x5e, 0xc6, 0x8c, 0x78, 0xce, - 0xf5, 0x8d, 0xb9, 0x32, 0xe1, 0x78, 0x4e, 0xaf, 0xe3, 0xaa, 0x65, 0x8b, 0xc9, 0x72, 0xee, 0x24, - 0xae, 0x59, 0x36, 0xd5, 0xc5, 0xaf, 0xf7, 0x49, 0xbd, 0x02, 0xb3, 0x77, 0x5c, 0xa3, 0x45, 0x6a, - 0x73, 0x07, 0x57, 0xf8, 0x4d, 0x7b, 0x85, 0x1a, 0xe4, 0xfe, 0x3a, 0x61, 0x1c, 0x65, 0x61, 0x12, - 0x9b, 0xa6, 0x43, 0x18, 0xcb, 0x82, 0x69, 0x30, 0x9b, 0x36, 0xfc, 0x57, 0xf5, 0x11, 0x80, 0x2f, - 0xf7, 0x31, 0x63, 0x75, 0x6a, 0x33, 0x12, 0x6d, 0x87, 0x3e, 0x80, 0xc7, 0x2a, 0xd2, 0xa2, 0x64, - 0xd9, 0x2b, 0x34, 0x3b, 0x36, 0x0d, 0x66, 0x27, 0xe6, 0x15, 0xad, 0x5b, 0x28, 0x2d, 0xb8, 0x70, - 0x71, 0x72, 0xa7, 0x99, 0x8f, 0xed, 0x36, 0xf3, 0x60, 0xbf, 0x99, 0x8f, 0x3d, 0xf9, 0xe7, 0xe7, - 0x02, 0x30, 0x8e, 0x56, 0x02, 0x13, 0xae, 0xc7, 0xff, 0xfd, 0x3e, 0x0f, 0xd4, 0x4f, 0xe1, 0x2b, - 0x21, 0xa8, 0x25, 0x8b, 0x71, 0xea, 0x34, 0x06, 0x86, 0x83, 0xde, 0x81, 0xb0, 0xa3, 0x95, 0x64, - 0x9a, 0xd1, 0x3c, 0x61, 0x35, 0x57, 0x58, 0xcd, 0xdb, 0x55, 0x29, 0xac, 0xb6, 0x8c, 0xab, 0x44, - 0xae, 0x6a, 0x04, 0x2c, 0xd5, 0xa7, 0x00, 0x4e, 0xf5, 0x27, 0x90, 0xca, 0xbc, 0x0f, 0x93, 0xc4, - 0xe6, 0x8e, 0x45, 0x5c, 0x84, 0x23, 0xb3, 0x13, 0xf3, 0x85, 0xe8, 0xc8, 0x17, 0xa9, 0x49, 0xa4, - 0xfd, 0xdb, 0x36, 0x77, 0x1a, 0xc5, 0xf4, 0x4e, 0x3b, 0x7a, 0x7f, 0x15, 0xf4, 0x6e, 0x1f, 0xf2, - 0xb3, 0x03, 0xc9, 0x3d, 0x9a, 0x10, 0xfa, 0x27, 0x5d, 0xda, 0xb1, 0x62, 0xc3, 0x05, 0xf0, 0xb5, - 0x3b, 0x05, 0x93, 0x15, 0x6a, 0x92, 0x92, 0x65, 0x0a, 0xed, 0xe2, 0x46, 0xc2, 0x7d, 0xbd, 0x69, - 0x8e, 0x4c, 0xba, 0xcf, 0xbb, 0xa5, 0x6b, 0x03, 0x48, 0xe9, 0xa6, 0x60, 0xda, 0xdf, 0x72, 0x4f, - 0xbc, 0xb4, 0xd1, 0xf9, 0x30, 0x3a, 0x1d, 0x3e, 0xf3, 0x39, 0x16, 0xd6, 0xd6, 0x7c, 0x94, 0xbb, - 0x1c, 0x73, 0xf2, 0xff, 0x9d, 0xa2, 0xc7, 0x00, 0x9e, 0x8e, 0x40, 0x90, 0x5a, 0x5c, 0x87, 0x89, - 0x1a, 0x35, 0xc9, 0x9a, 0x7f, 0x8a, 0x4e, 0xf5, 0x9e, 0xa2, 0xdb, 0xee, 0x78, 0xf0, 0xc8, 0x48, - 0x8b, 0xd1, 0x29, 0x75, 0x4f, 0x0a, 0x65, 0xe0, 0xcd, 0x43, 0x0a, 0x75, 0x1a, 0x42, 0xe1, 0xa3, - 0x64, 0x62, 0x8e, 0x05, 0xc2, 0x51, 0x23, 0x2d, 0xbe, 0xdc, 0xc0, 0x1c, 0xab, 0x97, 0x65, 0xf8, - 0xbd, 0x0b, 0xcb, 0xf0, 0x11, 0x8c, 0x0b, 0x4b, 0x20, 0x2c, 0xc5, 0xb3, 0x7a, 0x1f, 0x2a, 0xc2, - 0xe8, 0x6e, 0x0d, 0x3b, 0xfc, 0x90, 0x3c, 0x57, 0x7b, 0x79, 0x8a, 0x27, 0x9f, 0x35, 0xf3, 0x28, - 0x40, 0x70, 0x9b, 0x30, 0xe6, 0x2a, 0x11, 0xe0, 0xbc, 0x0d, 0xf3, 0x91, 0x2e, 0x25, 0x69, 0x21, - 0x48, 0x1a, 0xb9, 0xa6, 0x17, 0xc1, 0x79, 0x98, 0x91, 0x17, 0x60, 0xf0, 0xb5, 0x53, 0xbf, 0x1b, - 0x83, 0x19, 0x77, 0x62, 0x28, 0xef, 0x9e, 0xeb, 0x9a, 0x5d, 0xcc, 0xb4, 0x9a, 0xf9, 0x84, 0x98, - 0x76, 0x63, 0xbf, 0x99, 0x1f, 0xb3, 0xcc, 0xf6, 0xb5, 0xcd, 0xc2, 0x64, 0xc5, 0x21, 0x98, 0x53, - 0x47, 0xc4, 0x9b, 0x36, 0xfc, 0x57, 0x74, 0x07, 0xa6, 0x5d, 0x9c, 0xd2, 0x2a, 0x66, 0xab, 0xd9, - 0x23, 0x82, 0xfb, 0xca, 0xb3, 0x66, 0xfe, 0x52, 0xd5, 0xe2, 0xab, 0xeb, 0x65, 0xad, 0x42, 0x6b, - 0x7a, 0x85, 0xd6, 0x08, 0x2f, 0xaf, 0xf0, 0xce, 0xc3, 0x9a, 0x55, 0x66, 0x7a, 0xb9, 0xc1, 0x09, - 0xd3, 0x96, 0xc8, 0x83, 0xa2, 0xfb, 0x60, 0xa4, 0xdc, 0x65, 0x96, 0x30, 0x5b, 0x45, 0x1f, 0xc3, - 0x93, 0x96, 0xcd, 0x38, 0xb6, 0xb9, 0x85, 0x39, 0x29, 0xd5, 0x89, 0x53, 0xb3, 0x18, 0x73, 0x8f, - 0x5f, 0x22, 0x2a, 0xfd, 0x2f, 0x54, 0x2a, 0x84, 0xb1, 0x45, 0x6a, 0xaf, 0x58, 0xd5, 0xe0, 0x29, - 0x7e, 0x29, 0xb0, 0xd0, 0x72, 0x7b, 0x1d, 0x2f, 0xff, 0xdf, 0x8a, 0xa7, 0xe2, 0x99, 0xf1, 0x5b, - 0xf1, 0xd4, 0x78, 0x26, 0xa1, 0x3e, 0x04, 0x70, 0x32, 0x20, 0xa7, 0x54, 0xe8, 0xa6, 0x9b, 0x44, - 0x5c, 0x85, 0xdc, 0xda, 0x03, 0x84, 0x73, 0xb5, 0x5f, 0x06, 0x0e, 0x0b, 0x5b, 0x4c, 0xf9, 0xb5, - 0xc7, 0x48, 0x55, 0xe4, 0x18, 0x9a, 0x92, 0x5b, 0xeb, 0x1d, 0x97, 0xd4, 0x7e, 0x33, 0x2f, 0xde, - 0xbd, 0xcd, 0x94, 0x05, 0xe9, 0xa3, 0x00, 0x03, 0xf3, 0xf7, 0x34, 0x9c, 0x26, 0xc0, 0x73, 0xa7, - 0x89, 0x9f, 0x00, 0x44, 0xc1, 0xd5, 0x65, 0x88, 0xef, 0x41, 0xd8, 0x0e, 0xd1, 0xcf, 0x0f, 0xc3, - 0xc4, 0x18, 0x10, 0x39, 0xed, 0x07, 0x39, 0xc2, 0x6c, 0x81, 0xe1, 0x29, 0x01, 0xbb, 0x6c, 0xd9, - 0x36, 0x31, 0x0f, 0x10, 0xe4, 0xf9, 0xf3, 0xe6, 0x17, 0x40, 0xf6, 0x32, 0x21, 0x1f, 0x52, 0x96, - 0x19, 0x98, 0x92, 0x77, 0xc3, 0x13, 0x25, 0x5e, 0x9c, 0x68, 0x35, 0xf3, 0x49, 0xef, 0x72, 0x30, - 0x23, 0xe9, 0xdd, 0x8b, 0x11, 0x06, 0x7c, 0x42, 0xee, 0xce, 0x32, 0x76, 0x70, 0xcd, 0x8f, 0x55, - 0x35, 0xe0, 0x8b, 0xa1, 0xaf, 0x92, 0xee, 0x0d, 0x98, 0xa8, 0x8b, 0x2f, 0xf2, 0x3c, 0x64, 0x7b, - 0x37, 0xcc, 0xb3, 0x08, 0x65, 0x74, 0xcf, 0x44, 0xfd, 0x1a, 0xc8, 0xdc, 0x17, 0x2c, 0x9d, 0xde, - 0x6d, 0xf6, 0x25, 0x3e, 0x0b, 0x8f, 0xcb, 0xfb, 0x5d, 0x0a, 0xe7, 0xc0, 0x17, 0xe4, 0xe7, 0x85, - 0x11, 0xd7, 0xb0, 0x6f, 0x81, 0x4c, 0x8e, 0xfd, 0x98, 0x64, 0xd0, 0x17, 0x21, 0x6a, 0x37, 0x83, - 0x92, 0x8a, 0xf8, 0xa5, 0x7d, 0xd2, 0x1f, 0x59, 0xf0, 0x07, 0x46, 0xb6, 0x33, 0xf3, 0xbf, 0x1d, - 0x83, 0xe3, 0x82, 0x0d, 0x7d, 0x03, 0xe0, 0xd1, 0x60, 0xa3, 0x89, 0xfa, 0xb4, 0x63, 0x51, 0xdd, - 0x71, 0xee, 0xfc, 0x50, 0x73, 0x3d, 0xff, 0xea, 0x85, 0x87, 0xbf, 0xff, 0xfd, 0x68, 0x6c, 0x06, - 0x9d, 0xd1, 0x7b, 0x5a, 0x7d, 0x3f, 0x52, 0x7d, 0x4b, 0x8a, 0xb0, 0x8d, 0x7e, 0x00, 0xf0, 0x78, - 0x57, 0x0b, 0x89, 0x2e, 0x0e, 0x70, 0x17, 0x6e, 0x76, 0x73, 0xda, 0xb0, 0xd3, 0x25, 0xe0, 0x15, - 0x01, 0xa8, 0xa1, 0x0b, 0xc3, 0x00, 0xea, 0xab, 0x12, 0xea, 0x71, 0x00, 0x54, 0x36, 0x6c, 0x03, - 0x41, 0xc3, 0x9d, 0xe5, 0x40, 0xd0, 0xae, 0x3e, 0x50, 0x9d, 0x17, 0xa0, 0x17, 0x50, 0xa1, 0x1f, - 0xa8, 0x49, 0xf4, 0x2d, 0x79, 0xcd, 0xb7, 0xf5, 0x4e, 0x77, 0xf8, 0x23, 0x80, 0x99, 0xee, 0x66, - 0x0a, 0x45, 0x39, 0x8e, 0x68, 0xfc, 0x72, 0xfa, 0xd0, 0xf3, 0x87, 0x21, 0xed, 0x91, 0x94, 0x09, - 0xa8, 0x5f, 0x00, 0xcc, 0x74, 0xf7, 0x3d, 0x91, 0xa4, 0x11, 0x9d, 0x57, 0x24, 0x69, 0x54, 0x43, - 0xa5, 0xbe, 0x29, 0x48, 0xaf, 0xa1, 0xab, 0x43, 0x91, 0x3a, 0x78, 0x53, 0xdf, 0xea, 0x34, 0x4c, - 0xdb, 0xe8, 0x57, 0x00, 0x51, 0x6f, 0x13, 0x84, 0x2e, 0x45, 0x60, 0x44, 0xb6, 0x68, 0xb9, 0xb9, - 0x43, 0x58, 0x48, 0xf4, 0xb7, 0x04, 0xfa, 0xeb, 0xe8, 0xda, 0x70, 0x22, 0xbb, 0x0b, 0x85, 0xe1, - 0x1b, 0x30, 0x2e, 0x8e, 0xad, 0x1a, 0x79, 0x0e, 0x3b, 0x67, 0xf5, 0xd5, 0x03, 0xe7, 0x48, 0xa2, - 0x59, 0x41, 0xa4, 0xa2, 0xe9, 0x41, 0x07, 0x14, 0x39, 0x70, 0x5c, 0x14, 0x29, 0x74, 0xd0, 0xba, - 0x7e, 0xe9, 0xc8, 0x9d, 0x39, 0x78, 0x92, 0xf4, 0xae, 0x08, 0xef, 0x59, 0x74, 0xb2, 0xbf, 0x77, - 0xf4, 0x25, 0x80, 0x13, 0x81, 0xfa, 0x88, 0xce, 0x45, 0xac, 0xda, 0x5b, 0xa7, 0x73, 0x85, 0x61, - 0xa6, 0x4a, 0x8c, 0x19, 0x81, 0x31, 0x8d, 0x94, 0xfe, 0x18, 0x4c, 0xaf, 0x0b, 0x23, 0xb4, 0x0d, - 0x13, 0x5e, 0x61, 0x43, 0x51, 0xe1, 0x85, 0xea, 0x67, 0xee, 0xb5, 0x01, 0xb3, 0x86, 0x76, 0xef, - 0x39, 0x7d, 0x0a, 0x20, 0xea, 0xad, 0x50, 0x91, 0x27, 0x37, 0xb2, 0xc0, 0x46, 0x9e, 0xdc, 0xe8, - 0xf2, 0x37, 0xcc, 0xa5, 0x63, 0xba, 0x2c, 0xcf, 0xfa, 0x56, 0x57, 0xf9, 0xde, 0x2e, 0x2e, 0xed, - 0xfc, 0xa5, 0xc4, 0x9e, 0xb4, 0x94, 0xd8, 0x4e, 0x4b, 0x01, 0xbb, 0x2d, 0x05, 0xfc, 0xd9, 0x52, - 0xc0, 0x57, 0x7b, 0x4a, 0x6c, 0x77, 0x4f, 0x89, 0xfd, 0xb1, 0xa7, 0xc4, 0x3e, 0x9c, 0x09, 0xb4, - 0xec, 0x8b, 0x94, 0xd5, 0xee, 0xf9, 0x2e, 0x4c, 0xfd, 0x81, 0xe7, 0x4a, 0xfc, 0xcb, 0x54, 0x4e, - 0x88, 0x7f, 0x82, 0x2e, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x05, 0x38, 0x11, 0xcc, 0x12, - 0x00, 0x00, + // 1493 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xf7, 0xa4, 0x8e, 0x63, 0x4f, 0xf2, 0x6d, 0x9d, 0xf9, 0x96, 0xd6, 0x75, 0xdb, 0x75, 0xb4, + 0x94, 0x90, 0xba, 0xad, 0xb7, 0x49, 0x0b, 0x15, 0x45, 0x08, 0xd9, 0x69, 0x69, 0x5a, 0x51, 0x9a, + 0xba, 0x12, 0x48, 0x20, 0x64, 0xc6, 0xde, 0x89, 0xb3, 0xc8, 0xde, 0x75, 0x77, 0x26, 0x6d, 0xad, + 0x28, 0x1c, 0x7a, 0x85, 0x03, 0x12, 0xe2, 0xd0, 0x72, 0x80, 0x43, 0x05, 0x95, 0x2a, 0xa4, 0x0a, + 0x38, 0x54, 0xfc, 0x05, 0x39, 0x56, 0x70, 0xe1, 0x64, 0x20, 0x45, 0x2a, 0xca, 0x9f, 0xd0, 0x13, + 0xda, 0x99, 0x59, 0x7b, 0xd7, 0xf6, 0xda, 0xdb, 0xe0, 0x03, 0x17, 0x6b, 0x77, 0xe7, 0xfd, 0xf8, + 0xcc, 0xe7, 0xbd, 0x79, 0xef, 0x8d, 0xe1, 0xa1, 0x8a, 0x45, 0xeb, 0x37, 0x31, 0xad, 0x6b, 0xfc, + 0xe7, 0xc6, 0xbc, 0x76, 0x7d, 0x8d, 0xd8, 0xcd, 0x5c, 0xc3, 0xb6, 0x98, 0x85, 0x92, 0xee, 0x6a, + 0x8e, 0xff, 0xdc, 0x98, 0x4f, 0xef, 0xad, 0x5a, 0x55, 0x8b, 0x2f, 0x6a, 0xce, 0x93, 0x90, 0x4b, + 0xf7, 0x5a, 0x61, 0xcd, 0x06, 0xa1, 0xee, 0x6a, 0xd5, 0xb2, 0xaa, 0x35, 0xa2, 0xe1, 0x86, 0xa1, + 0x61, 0xd3, 0xb4, 0x18, 0x66, 0x86, 0x65, 0xba, 0xab, 0x59, 0x47, 0xd7, 0xa2, 0x5a, 0x19, 0x53, + 0x22, 0x9c, 0x6b, 0x37, 0xe6, 0xcb, 0x84, 0xe1, 0x79, 0xad, 0x81, 0xab, 0x86, 0xc9, 0x85, 0xa5, + 0xec, 0x34, 0xae, 0x1b, 0xa6, 0xa5, 0xf1, 0x5f, 0xf9, 0xe9, 0x80, 0x50, 0x2f, 0x09, 0x4c, 0xe2, + 0x45, 0x2c, 0xa9, 0xef, 0xc0, 0xd4, 0x55, 0xc7, 0xde, 0xa2, 0x65, 0x32, 0x1b, 0x57, 0xd8, 0x45, + 0x73, 0xc5, 0x2a, 0x92, 0xeb, 0x6b, 0x84, 0x32, 0xb4, 0x00, 0x27, 0xb0, 0xae, 0xdb, 0x84, 0xd2, + 0x14, 0x98, 0x01, 0x73, 0x89, 0x42, 0xea, 0x97, 0x9f, 0x4e, 0xec, 0x95, 0xea, 0x79, 0xb1, 0x72, + 0x8d, 0xd9, 0x86, 0x59, 0x2d, 0xba, 0x82, 0xea, 0xf7, 0x00, 0x1e, 0xe8, 0x63, 0x90, 0x36, 0x2c, + 0x93, 0x92, 0x9d, 0x58, 0x44, 0xef, 0xc2, 0xff, 0x55, 0xa4, 0xad, 0x92, 0x61, 0xae, 0x58, 0xa9, + 0xb1, 0x19, 0x30, 0x37, 0xb9, 0xa0, 0xe4, 0xba, 0x79, 0xcf, 0x79, 0x5d, 0x16, 0xa6, 0x37, 0x5b, + 0x99, 0xc8, 0xe3, 0x56, 0x06, 0x6c, 0xb7, 0x32, 0x91, 0xfb, 0x4f, 0x1f, 0x66, 0x41, 0x71, 0xaa, + 0xe2, 0x11, 0x38, 0x1b, 0xfd, 0xfb, 0x9b, 0x0c, 0x50, 0xef, 0x00, 0x78, 0xd0, 0x87, 0x77, 0xc9, + 0xa0, 0xcc, 0xb2, 0x9b, 0xff, 0x82, 0x03, 0xf4, 0x16, 0x84, 0x9d, 0xa8, 0x48, 0xb8, 0xb3, 0x39, + 0xa9, 0xe3, 0x84, 0x30, 0x27, 0xf2, 0x47, 0x86, 0x30, 0xb7, 0x8c, 0xab, 0x44, 0xfa, 0x2b, 0x7a, + 0x34, 0xd5, 0x47, 0x00, 0x1e, 0xea, 0x8f, 0x4d, 0xd2, 0x79, 0x05, 0x4e, 0x10, 0x93, 0xd9, 0x06, + 0x71, 0xc0, 0xed, 0x9a, 0x9b, 0x5c, 0xc8, 0x06, 0x93, 0xb2, 0x68, 0xe9, 0x44, 0xea, 0x9f, 0x37, + 0x99, 0xdd, 0x2c, 0x24, 0x36, 0xdb, 0xc4, 0xb8, 0x56, 0xd0, 0x85, 0x3e, 0xc8, 0x5f, 0x1e, 0x8a, + 0x5c, 0xa0, 0xf1, 0x41, 0xff, 0xa4, 0x8b, 0x55, 0x5a, 0x68, 0x3a, 0x00, 0x5c, 0x56, 0xf7, 0xc3, + 0x89, 0x8a, 0xa5, 0x93, 0x92, 0xa1, 0x73, 0x56, 0xa3, 0xc5, 0x98, 0xf3, 0x7a, 0x51, 0x1f, 0x19, + 0x75, 0x5f, 0x77, 0x53, 0xd7, 0x06, 0x20, 0xa9, 0x7b, 0x15, 0x26, 0xdc, 0x6c, 0x10, 0xe4, 0x0d, + 0x8a, 0x6c, 0x47, 0x74, 0x74, 0x0c, 0xdd, 0x75, 0x11, 0xe6, 0x6b, 0x35, 0x17, 0xe4, 0x35, 0x86, + 0x19, 0xf9, 0x2f, 0x64, 0xde, 0x3d, 0x00, 0x0f, 0x07, 0x80, 0x93, 0xfc, 0x9d, 0x85, 0xb1, 0xba, + 0xa5, 0x93, 0x9a, 0x9b, 0x79, 0xfb, 0x7b, 0x33, 0xef, 0xb2, 0xb3, 0xee, 0x4d, 0x33, 0xa9, 0x31, + 0x3a, 0x0e, 0xaf, 0x4b, 0x0a, 0x8b, 0xf8, 0xe6, 0xc8, 0x28, 0x3c, 0x0c, 0x21, 0xf7, 0x5e, 0xd2, + 0x31, 0xc3, 0x1c, 0xdc, 0x54, 0x31, 0xc1, 0xbf, 0x9c, 0xc3, 0x0c, 0xab, 0xa7, 0x24, 0x31, 0xbd, + 0x2e, 0x25, 0x31, 0x08, 0x46, 0xb9, 0x26, 0xe0, 0x9a, 0xfc, 0x59, 0xfd, 0x0a, 0x40, 0x85, 0x6b, + 0x5d, 0xab, 0x63, 0x9b, 0x8d, 0x0c, 0xea, 0xf9, 0x5e, 0xa8, 0x85, 0xd9, 0x67, 0xad, 0x0c, 0xf2, + 0x80, 0xbb, 0x4c, 0x28, 0xc5, 0x55, 0x72, 0xf7, 0xe9, 0xc3, 0xec, 0xa4, 0x61, 0xd6, 0x0c, 0x93, + 0x94, 0x3e, 0xa6, 0x96, 0xe9, 0xdd, 0xd2, 0x87, 0x30, 0x13, 0x08, 0xae, 0x1d, 0x6d, 0xcf, 0xa6, + 0x42, 0xfb, 0x10, 0x9b, 0x3f, 0x06, 0x93, 0xf2, 0x24, 0x0e, 0x3f, 0xff, 0xea, 0xa3, 0x31, 0x98, + 0x74, 0x04, 0x7d, 0x5d, 0xe3, 0x68, 0x97, 0x74, 0x21, 0xb9, 0xd5, 0xca, 0xc4, 0xb8, 0xd8, 0xb9, + 0xed, 0x56, 0x66, 0xcc, 0xd0, 0xdb, 0xf5, 0x63, 0x01, 0x4e, 0x54, 0x6c, 0x82, 0x99, 0x65, 0x73, + 0x3e, 0x06, 0xd2, 0x28, 0x05, 0xd1, 0x55, 0x98, 0x70, 0x80, 0x96, 0x56, 0x31, 0x5d, 0x4d, 0xed, + 0xe2, 0x3b, 0x3c, 0xfd, 0xac, 0x95, 0x39, 0x59, 0x35, 0xd8, 0xea, 0x5a, 0x39, 0x57, 0xb1, 0xea, + 0x5a, 0xc5, 0xaa, 0x13, 0x56, 0x5e, 0x61, 0x9d, 0x87, 0x9a, 0x51, 0xa6, 0x5a, 0xb9, 0xc9, 0x08, + 0xcd, 0x2d, 0x91, 0x5b, 0x05, 0xe7, 0xa1, 0x18, 0x77, 0xcc, 0x2c, 0x61, 0xba, 0x8a, 0x3e, 0x82, + 0xfb, 0x0c, 0x93, 0x32, 0x6c, 0x32, 0x03, 0x33, 0x52, 0x6a, 0x10, 0xbb, 0x6e, 0x50, 0xea, 0x64, + 0x7b, 0x2c, 0xa8, 0x79, 0xe5, 0x2b, 0x15, 0x42, 0xe9, 0xa2, 0x65, 0xae, 0x18, 0x55, 0xef, 0xa1, + 0x79, 0xc1, 0x63, 0x68, 0xb9, 0x6d, 0x47, 0x74, 0xaf, 0x4b, 0xd1, 0x78, 0x34, 0x39, 0x7e, 0x29, + 0x1a, 0x1f, 0x4f, 0xc6, 0xd4, 0xdb, 0x00, 0x4e, 0x7b, 0x88, 0x96, 0xdc, 0x5d, 0x74, 0xea, 0x9c, + 0xc3, 0x9d, 0xd3, 0x39, 0x01, 0x77, 0xae, 0xf6, 0x6b, 0x12, 0x7e, 0xca, 0x0b, 0x71, 0xb7, 0x73, + 0x16, 0xe3, 0x15, 0xb9, 0x86, 0x0e, 0xc9, 0x24, 0x10, 0x89, 0x16, 0xdf, 0x6e, 0x65, 0xf8, 0xbb, + 0x08, 0xb3, 0x6c, 0xa7, 0x1f, 0x78, 0x30, 0x50, 0x37, 0xda, 0xfe, 0xaa, 0x04, 0x76, 0x5c, 0x95, + 0x1e, 0x00, 0x88, 0xbc, 0xd6, 0xe5, 0x16, 0xdf, 0x86, 0xb0, 0xbd, 0x45, 0xb7, 0x1c, 0x85, 0xd9, + 0xa3, 0x87, 0xe4, 0x84, 0xbb, 0xc9, 0x11, 0x16, 0x27, 0x0c, 0xf7, 0x73, 0xb0, 0xcb, 0x86, 0x69, + 0x12, 0x7d, 0x00, 0x21, 0x3b, 0x2f, 0xd3, 0x9f, 0x02, 0x39, 0xbd, 0xf9, 0x7c, 0x48, 0x5a, 0x66, + 0x61, 0x5c, 0x9e, 0x1a, 0x41, 0x4a, 0xb4, 0x30, 0xb9, 0xd5, 0xca, 0x4c, 0x88, 0x63, 0x43, 0x8b, + 0x13, 0xe2, 0xc4, 0x8c, 0x70, 0xc3, 0x7b, 0x65, 0x74, 0x96, 0xb1, 0x8d, 0xeb, 0xee, 0x5e, 0xd5, + 0x22, 0xfc, 0xbf, 0xef, 0xab, 0x44, 0xf7, 0x3a, 0x8c, 0x35, 0xf8, 0x17, 0x99, 0x0f, 0xa9, 0xde, + 0x80, 0x09, 0x0d, 0x5f, 0x03, 0x11, 0x2a, 0x4e, 0x22, 0x28, 0x3d, 0xdd, 0x5d, 0x9c, 0x66, 0x97, + 0xe2, 0x3c, 0xdc, 0x23, 0xcf, 0x77, 0x29, 0x6c, 0x5d, 0xdd, 0x2d, 0x15, 0xf2, 0x23, 0x6e, 0xa6, + 0x3f, 0x02, 0x59, 0x60, 0xfb, 0xa1, 0x95, 0x74, 0x5c, 0x80, 0xa8, 0x3d, 0xe4, 0x4a, 0xbc, 0x64, + 0xf8, 0x5c, 0x32, 0xed, 0xea, 0xe4, 0x5d, 0x95, 0xd1, 0x45, 0xf3, 0x81, 0x9b, 0x5b, 0x85, 0x35, + 0xa3, 0xa6, 0x4b, 0x07, 0x2e, 0xbb, 0x07, 0x65, 0x55, 0xe1, 0x25, 0x93, 0xf3, 0x2a, 0xea, 0x04, + 0x2f, 0x7e, 0x7d, 0xa8, 0x1f, 0x7b, 0x4e, 0xea, 0x11, 0x8c, 0x52, 0x5c, 0x63, 0xbc, 0x1a, 0x27, + 0x8a, 0xfc, 0xd9, 0xf1, 0x69, 0x98, 0x06, 0x2b, 0x61, 0xbb, 0x4a, 0x53, 0x51, 0xde, 0x5d, 0xe3, + 0xce, 0x87, 0xbc, 0x5d, 0xa5, 0xea, 0x15, 0x79, 0xeb, 0xf0, 0x83, 0xdd, 0xf9, 0xad, 0x63, 0xe1, + 0xf7, 0xdd, 0x70, 0x9c, 0x5b, 0x44, 0x5f, 0x02, 0x38, 0xe5, 0xbd, 0x59, 0xa0, 0x3e, 0x43, 0x76, + 0xd0, 0x15, 0x2a, 0x7d, 0x2c, 0x94, 0xac, 0xc0, 0xa9, 0x1e, 0xbf, 0xfd, 0xeb, 0x5f, 0x5f, 0x8c, + 0xcd, 0xa2, 0x23, 0x5a, 0xcf, 0x55, 0xd1, 0x0d, 0xb4, 0xb6, 0x2e, 0x01, 0x6e, 0xa0, 0x6f, 0x01, + 0xdc, 0xd3, 0x75, 0x31, 0x40, 0x27, 0x86, 0xb8, 0xf3, 0x5f, 0x6e, 0xd2, 0xb9, 0xb0, 0xe2, 0x12, + 0xe0, 0x69, 0x0e, 0x30, 0x87, 0x8e, 0x87, 0x01, 0xa8, 0xad, 0x4a, 0x50, 0xf7, 0x3c, 0x40, 0xe5, + 0x18, 0x3e, 0x14, 0xa8, 0xff, 0xbe, 0x30, 0x14, 0x68, 0xd7, 0x74, 0xaf, 0x2e, 0x70, 0xa0, 0xc7, + 0x51, 0xb6, 0x1f, 0x50, 0x9d, 0x68, 0xeb, 0xb2, 0x32, 0x6e, 0x68, 0x9d, 0xc9, 0xfe, 0x3b, 0x00, + 0x93, 0xdd, 0xe3, 0x2e, 0x0a, 0x72, 0x1c, 0x30, 0xb4, 0xa7, 0xb5, 0xd0, 0xf2, 0x61, 0x90, 0xf6, + 0x50, 0x4a, 0x39, 0xa8, 0x1f, 0x00, 0x4c, 0x76, 0xcf, 0x9f, 0x81, 0x48, 0x03, 0x66, 0xe3, 0x40, + 0xa4, 0x41, 0x83, 0xad, 0xfa, 0x06, 0x47, 0x7a, 0x06, 0xbd, 0x12, 0x0a, 0xa9, 0x8d, 0x6f, 0x6a, + 0xeb, 0x9d, 0xe9, 0x74, 0x03, 0xfd, 0x0c, 0x20, 0xea, 0x9d, 0x30, 0xd1, 0xc9, 0x00, 0x18, 0x81, + 0x93, 0x72, 0x7a, 0xfe, 0x39, 0x34, 0x24, 0xf4, 0x37, 0x39, 0xf4, 0xd7, 0xd0, 0x99, 0x70, 0x24, + 0x3b, 0x86, 0xfc, 0xe0, 0x9b, 0x30, 0xca, 0xd3, 0x56, 0x0d, 0xcc, 0xc3, 0x4e, 0xae, 0xbe, 0x38, + 0x50, 0x46, 0x22, 0x9a, 0xe3, 0x88, 0x54, 0x34, 0x33, 0x2c, 0x41, 0x91, 0x0d, 0xc7, 0x79, 0x5f, + 0x47, 0x83, 0xec, 0xba, 0x85, 0x39, 0x7d, 0x64, 0xb0, 0x90, 0xf4, 0xae, 0x70, 0xef, 0x29, 0xb4, + 0xaf, 0xbf, 0x77, 0xf4, 0x19, 0x80, 0x93, 0x9e, 0x91, 0x02, 0x1d, 0x0d, 0xb0, 0xda, 0x3b, 0xda, + 0xa4, 0xb3, 0x61, 0x44, 0x25, 0x8c, 0x59, 0x0e, 0x63, 0x06, 0x29, 0xfd, 0x61, 0x50, 0xad, 0xc1, + 0x95, 0xd0, 0x06, 0x8c, 0x89, 0x59, 0x00, 0x05, 0x6d, 0xcf, 0x37, 0x72, 0xa4, 0x5f, 0x1a, 0x22, + 0x15, 0xda, 0xbd, 0x70, 0xfa, 0x08, 0x40, 0xd4, 0xdb, 0xba, 0x03, 0x33, 0x37, 0x70, 0x26, 0x09, + 0xcc, 0xdc, 0xe0, 0xb9, 0x20, 0xcc, 0xa1, 0xa3, 0x9a, 0x6c, 0x9e, 0xda, 0x7a, 0x57, 0xdb, 0xdd, + 0x40, 0x77, 0x00, 0x9c, 0xf2, 0xb6, 0xc4, 0xc0, 0xde, 0xd5, 0xa7, 0xc9, 0x07, 0xf6, 0xae, 0x7e, + 0x3d, 0x56, 0x3d, 0xc9, 0x81, 0x66, 0xd1, 0xdc, 0x80, 0x23, 0x56, 0x76, 0x14, 0x5d, 0x70, 0x85, + 0xa5, 0xcd, 0x3f, 0x95, 0xc8, 0xfd, 0x2d, 0x25, 0xb2, 0xb9, 0xa5, 0x80, 0xc7, 0x5b, 0x0a, 0xf8, + 0x63, 0x4b, 0x01, 0x9f, 0x3f, 0x51, 0x22, 0x8f, 0x9f, 0x28, 0x91, 0xdf, 0x9e, 0x28, 0x91, 0xf7, + 0x67, 0x3d, 0x37, 0xb0, 0x45, 0x8b, 0xd6, 0xdf, 0x73, 0xad, 0xea, 0xda, 0x2d, 0x61, 0x9d, 0xff, + 0x83, 0x5a, 0x8e, 0xf1, 0xbf, 0x32, 0x4f, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x63, 0x9e, 0xb7, + 0x27, 0xa8, 0x15, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1108,6 +1334,7 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool { } return true } + func (this *CodeInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1141,6 +1368,7 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { } return true } + func (this *QueryCodeResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1170,8 +1398,10 @@ func (this *QueryCodeResponse) Equal(that interface{}) bool { } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -1203,6 +1433,8 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // ContractsByCreator gets the contracts by creator ContractsByCreator(ctx context.Context, in *QueryContractsByCreatorRequest, opts ...grpc.CallOption) (*QueryContractsByCreatorResponse, error) + // BuildAddress builds a contract address + BuildAddress(ctx context.Context, in *QueryBuildAddressRequest, opts ...grpc.CallOption) (*QueryBuildAddressResponse, error) } type queryClient struct { @@ -1312,6 +1544,15 @@ func (c *queryClient) ContractsByCreator(ctx context.Context, in *QueryContracts return out, nil } +func (c *queryClient) BuildAddress(ctx context.Context, in *QueryBuildAddressRequest, opts ...grpc.CallOption) (*QueryBuildAddressResponse, error) { + out := new(QueryBuildAddressResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/BuildAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ContractInfo gets the contract meta data @@ -1336,46 +1577,61 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // ContractsByCreator gets the contracts by creator ContractsByCreator(context.Context, *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) + // BuildAddress builds a contract address + BuildAddress(context.Context, *QueryBuildAddressRequest) (*QueryBuildAddressResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryContractInfoRequest) (*QueryContractInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } + func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") } + func (*UnimplementedQueryServer) ContractsByCode(ctx context.Context, req *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCode not implemented") } + func (*UnimplementedQueryServer) AllContractState(ctx context.Context, req *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllContractState not implemented") } + func (*UnimplementedQueryServer) RawContractState(ctx context.Context, req *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawContractState not implemented") } + func (*UnimplementedQueryServer) SmartContractState(ctx context.Context, req *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SmartContractState not implemented") } + func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") } + func (*UnimplementedQueryServer) Codes(ctx context.Context, req *QueryCodesRequest) (*QueryCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") } + func (*UnimplementedQueryServer) PinnedCodes(ctx context.Context, req *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PinnedCodes not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) ContractsByCreator(ctx context.Context, req *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCreator not implemented") } +func (*UnimplementedQueryServer) BuildAddress(ctx context.Context, req *QueryBuildAddressRequest) (*QueryBuildAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuildAddress not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } @@ -1578,6 +1834,24 @@ func _Query_ContractsByCreator_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_BuildAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBuildAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BuildAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/BuildAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BuildAddress(ctx, req.(*QueryBuildAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1626,6 +1900,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ContractsByCreator", Handler: _Query_ContractsByCreator_Handler, }, + { + MethodName: "BuildAddress", + Handler: _Query_BuildAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/query.proto", @@ -2537,41 +2815,123 @@ func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryBuildAddressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryContractInfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n + +func (m *QueryBuildAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryContractInfoResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryBuildAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.InitArgs) > 0 { + i -= len(m.InitArgs) + copy(dAtA[i:], m.InitArgs) + i = encodeVarintQuery(dAtA, i, uint64(len(m.InitArgs))) + i-- + dAtA[i] = 0x22 } - l = m.ContractInfo.Size() + if len(m.Salt) > 0 { + i -= len(m.Salt) + copy(dAtA[i:], m.Salt) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Salt))) + i-- + dAtA[i] = 0x1a + } + if len(m.CreatorAddress) > 0 { + i -= len(m.CreatorAddress) + copy(dAtA[i:], m.CreatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CreatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBuildAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBuildAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuildAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} + +func (m *QueryContractInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.ContractInfo.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -2915,12 +3275,52 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { return n } +func (m *QueryBuildAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CreatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Salt) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.InitArgs) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuildAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3003,6 +3403,7 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3118,6 +3519,7 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3236,6 +3638,7 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3356,6 +3759,7 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3461,6 +3865,7 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3579,6 +3984,7 @@ func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3697,6 +4103,7 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3817,6 +4224,7 @@ func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3933,6 +4341,7 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4017,6 +4426,7 @@ func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4133,6 +4543,7 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4217,6 +4628,7 @@ func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4286,6 +4698,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4454,6 +4867,7 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4574,6 +4988,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4660,6 +5075,7 @@ func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4780,6 +5196,7 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4866,6 +5283,7 @@ func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5028,6 +5446,7 @@ func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5078,6 +5497,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5161,6 +5581,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5279,6 +5700,7 @@ func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5397,6 +5819,271 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { } return nil } + +func (m *QueryBuildAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBuildAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuildAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CreatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Salt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitArgs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitArgs = append(m.InitArgs[:0], dAtA[iNdEx:postIndex]...) + if m.InitArgs == nil { + m.InitArgs = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func (m *QueryBuildAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBuildAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuildAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index 696252ab02..a07546a819 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractInfoRequest @@ -57,7 +59,6 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.ContractInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,12 +85,9 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M msg, err := server.ContractInfo(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractHistoryRequest @@ -122,7 +120,6 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -156,12 +153,9 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim msg, err := server.ContractHistory(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCodeRequest @@ -194,7 +188,6 @@ func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractsByCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -228,12 +221,9 @@ func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtim msg, err := server.ContractsByCode(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllContractStateRequest @@ -266,7 +256,6 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.AllContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -300,7 +289,6 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti msg, err := server.AllContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -338,7 +326,6 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.RawContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -376,7 +363,6 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti msg, err := server.RawContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -414,7 +400,6 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M msg, err := client.SmartContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -452,7 +437,6 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run msg, err := server.SmartContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -479,7 +463,6 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -506,12 +489,9 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler msg, err := server.Code(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryCodesRequest @@ -526,7 +506,6 @@ func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, cli msg, err := client.Codes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -542,12 +521,9 @@ func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshale msg, err := server.Codes(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPinnedCodesRequest @@ -562,7 +538,6 @@ func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.PinnedCodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -578,7 +553,6 @@ func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Ma msg, err := server.PinnedCodes(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -587,7 +561,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -596,12 +569,9 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractsByCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractsByCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCreatorRequest @@ -634,7 +604,6 @@ func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.M msg, err := client.ContractsByCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -668,7 +637,38 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run msg, err := server.ContractsByCreator(ctx, &protoReq) return msg, metadata, err +} + +var filter_Query_BuildAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + +func request_Query_BuildAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuildAddressRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuildAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BuildAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_Query_BuildAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuildAddressRequest + var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuildAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BuildAddress(ctx, &protoReq) + return msg, metadata, err } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -676,7 +676,6 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -697,7 +696,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -720,7 +718,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -743,7 +740,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -766,7 +762,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -789,7 +784,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -812,7 +806,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -835,7 +828,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -858,7 +850,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -881,7 +872,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -904,7 +894,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -927,7 +916,28 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + mux.Handle("GET", pattern_Query_BuildAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BuildAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + forward_Query_BuildAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil @@ -970,7 +980,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -988,7 +997,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1008,7 +1016,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1028,7 +1035,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1048,7 +1054,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1068,7 +1073,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1088,7 +1092,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1108,7 +1111,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1128,7 +1130,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1148,7 +1149,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1168,7 +1168,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1188,7 +1187,25 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + mux.Handle("GET", pattern_Query_BuildAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BuildAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + forward_Query_BuildAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil @@ -1216,6 +1233,8 @@ var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "codes", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ContractsByCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmwasm", "wasm", "v1", "contracts", "creator", "creator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BuildAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "contract", "build_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1240,4 +1259,6 @@ var ( forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_ContractsByCreator_0 = runtime.ForwardResponseMessage + + forward_Query_BuildAddress_0 = runtime.ForwardResponseMessage ) diff --git a/x/wasm/types/test_fixtures.go b/x/wasm/types/test_fixtures.go index be4c5725e5..23c3aea12f 100644 --- a/x/wasm/types/test_fixtures.go +++ b/x/wasm/types/test_fixtures.go @@ -4,7 +4,9 @@ import ( _ "embed" "math/rand" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" + + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -175,7 +177,7 @@ func MsgInstantiateContractFixture(mutators ...func(*MsgInstantiateContract)) *M Msg: []byte(`{"foo":"bar"}`), Funds: sdk.Coins{{ Denom: "stake", - Amount: sdk.NewInt(1), + Amount: sdkmath.NewInt(1), }}, } for _, m := range mutators { @@ -195,7 +197,7 @@ func MsgExecuteContractFixture(mutators ...func(*MsgExecuteContract)) *MsgExecut Msg: []byte(`{"do":"something"}`), Funds: sdk.Coins{{ Denom: "stake", - Amount: sdk.NewInt(1), + Amount: sdkmath.NewInt(1), }}, } for _, m := range mutators { diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go index d739cb49aa..ecd68bddf4 100644 --- a/x/wasm/types/tx.go +++ b/x/wasm/types/tx.go @@ -74,18 +74,6 @@ func (msg MsgStoreCode) ValidateBasic() error { return nil } -func (msg MsgStoreCode) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgStoreCode) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgInstantiateContract) Route() string { return RouterKey } @@ -107,8 +95,8 @@ func (msg MsgInstantiateContract) ValidateBasic() error { return errorsmod.Wrap(err, "label") } - if !msg.Funds.IsValid() { - return sdkerrors.ErrInvalidCoins + if err := msg.Funds.Validate(); err != nil { + return errorsmod.Wrap(err, "funds") } if len(msg.Admin) != 0 { @@ -122,18 +110,6 @@ func (msg MsgInstantiateContract) ValidateBasic() error { return nil } -func (msg MsgInstantiateContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgInstantiateContract) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgExecuteContract) Route() string { return RouterKey } @@ -150,8 +126,8 @@ func (msg MsgExecuteContract) ValidateBasic() error { return errorsmod.Wrap(err, "contract") } - if !msg.Funds.IsValid() { - return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "sentFunds") + if err := msg.Funds.Validate(); err != nil { + return errorsmod.Wrap(err, "funds") } if err := msg.Msg.ValidateBasic(); err != nil { return errorsmod.Wrap(err, "payload msg") @@ -159,18 +135,6 @@ func (msg MsgExecuteContract) ValidateBasic() error { return nil } -func (msg MsgExecuteContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgExecuteContract) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - // GetMsg returns the payload message send to the contract func (msg MsgExecuteContract) GetMsg() RawContractMessage { return msg.Msg @@ -212,18 +176,6 @@ func (msg MsgMigrateContract) ValidateBasic() error { return nil } -func (msg MsgMigrateContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgMigrateContract) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - // GetMsg returns the payload message send to the contract func (msg MsgMigrateContract) GetMsg() RawContractMessage { return msg.Msg @@ -263,18 +215,6 @@ func (msg MsgUpdateAdmin) ValidateBasic() error { return nil } -func (msg MsgUpdateAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUpdateAdmin) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgClearAdmin) Route() string { return RouterKey } @@ -293,18 +233,6 @@ func (msg MsgClearAdmin) ValidateBasic() error { return nil } -func (msg MsgClearAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgClearAdmin) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgIBCSend) Route() string { return RouterKey } @@ -317,14 +245,6 @@ func (msg MsgIBCSend) ValidateBasic() error { return nil } -func (msg MsgIBCSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgIBCSend) GetSigners() []sdk.AccAddress { - return nil -} - func (msg MsgIBCCloseChannel) Route() string { return RouterKey } @@ -337,14 +257,6 @@ func (msg MsgIBCCloseChannel) ValidateBasic() error { return nil } -func (msg MsgIBCCloseChannel) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgIBCCloseChannel) GetSigners() []sdk.AccAddress { - return nil -} - var _ sdk.Msg = &MsgInstantiateContract2{} func (msg MsgInstantiateContract2) Route() string { @@ -368,8 +280,8 @@ func (msg MsgInstantiateContract2) ValidateBasic() error { return errorsmod.Wrap(err, "label") } - if !msg.Funds.IsValid() { - return sdkerrors.ErrInvalidCoins + if err := msg.Funds.Validate(); err != nil { + return errorsmod.Wrap(err, "funds") } if len(msg.Admin) != 0 { @@ -386,18 +298,6 @@ func (msg MsgInstantiateContract2) ValidateBasic() error { return nil } -func (msg MsgInstantiateContract2) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgInstantiateContract2) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgUpdateInstantiateConfig) Route() string { return RouterKey } @@ -426,18 +326,6 @@ func (msg MsgUpdateInstantiateConfig) ValidateBasic() error { return nil } -func (msg MsgUpdateInstantiateConfig) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgUpdateInstantiateConfig) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} - func (msg MsgUpdateParams) Route() string { return RouterKey } @@ -446,18 +334,6 @@ func (msg MsgUpdateParams) Type() string { return "update-params" } -func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -473,20 +349,6 @@ func (msg MsgPinCodes) Type() string { return "pin-codes" } -func (msg MsgPinCodes) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgPinCodes) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -const maxCodeIDTotal = 50 - func (msg MsgPinCodes) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -494,6 +356,8 @@ func (msg MsgPinCodes) ValidateBasic() error { return validateCodeIDs(msg.CodeIDs) } +const maxCodeIDTotal = 50 + // ensure not empty, not duplicates and not exceeding max number func validateCodeIDs(codeIDs []uint64) error { switch n := len(codeIDs); { @@ -516,18 +380,6 @@ func (msg MsgUnpinCodes) Type() string { return "unpin-codes" } -func (msg MsgUnpinCodes) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgUnpinCodes) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgUnpinCodes) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -543,18 +395,6 @@ func (msg MsgSudoContract) Type() string { return "sudo-contract" } -func (msg MsgSudoContract) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgSudoContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgSudoContract) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -576,18 +416,6 @@ func (msg MsgStoreAndInstantiateContract) Type() string { return "store-and-instantiate-contract" } -func (msg MsgStoreAndInstantiateContract) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgStoreAndInstantiateContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgStoreAndInstantiateContract) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -597,8 +425,8 @@ func (msg MsgStoreAndInstantiateContract) ValidateBasic() error { return errorsmod.Wrap(err, "label") } - if !msg.Funds.IsValid() { - return sdkerrors.ErrInvalidCoins + if err := msg.Funds.Validate(); err != nil { + return errorsmod.Wrap(err, "funds") } if len(msg.Admin) != 0 { @@ -635,18 +463,6 @@ func (msg MsgAddCodeUploadParamsAddresses) Type() string { return "add-code-upload-params-addresses" } -func (msg MsgAddCodeUploadParamsAddresses) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgAddCodeUploadParamsAddresses) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgAddCodeUploadParamsAddresses) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -667,18 +483,6 @@ func (msg MsgRemoveCodeUploadParamsAddresses) Type() string { return "remove-code-upload-params-addresses" } -func (msg MsgRemoveCodeUploadParamsAddresses) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgRemoveCodeUploadParamsAddresses) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgRemoveCodeUploadParamsAddresses) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -714,18 +518,6 @@ func (msg MsgStoreAndMigrateContract) Type() string { return "store-and-migrate-contract" } -func (msg MsgStoreAndMigrateContract) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{authority} -} - -func (msg MsgStoreAndMigrateContract) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgStoreAndMigrateContract) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrap(err, "authority") @@ -783,11 +575,3 @@ func (msg MsgUpdateContractLabel) ValidateBasic() error { } return nil } - -func (msg MsgUpdateContractLabel) GetSigners() []sdk.AccAddress { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { // should never happen as valid basic rejects invalid addresses - panic(err.Error()) - } - return []sdk.AccAddress{senderAddr} -} diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index aee5c4869d..32d0b3d1d2 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -1707,114 +1707,116 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) } var fileDescriptor_4f74d82755520264 = []byte{ - // 1701 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x19, 0xcb, 0x6f, 0x1b, 0xc5, - 0x3b, 0x1b, 0x3b, 0x8e, 0x3d, 0xc9, 0xaf, 0x4d, 0xb7, 0x6e, 0xe2, 0x6c, 0x5b, 0xdb, 0xdd, 0x3e, - 0xe2, 0xe6, 0x97, 0xda, 0x89, 0x29, 0x85, 0x1a, 0x2e, 0x71, 0x8a, 0x44, 0x2a, 0x0c, 0xd1, 0x46, - 0x69, 0x05, 0xaa, 0x64, 0xad, 0xbd, 0x93, 0xcd, 0xaa, 0xde, 0x5d, 0xe3, 0x59, 0xe7, 0x71, 0xe0, - 0x02, 0x12, 0x12, 0x88, 0x03, 0x17, 0xfe, 0x04, 0x24, 0xe0, 0x42, 0x0f, 0x1c, 0x38, 0xf6, 0x84, - 0x2a, 0x40, 0xa8, 0xe2, 0xc4, 0x05, 0x03, 0x29, 0x52, 0xb9, 0x21, 0xf5, 0xc8, 0x09, 0xed, 0xcc, - 0xee, 0x7a, 0xbc, 0x9e, 0x5d, 0x3b, 0x49, 0x2b, 0x90, 0xb8, 0x24, 0x3b, 0x33, 0xdf, 0xf7, 0xcd, - 0xf7, 0x7e, 0x8c, 0xc1, 0x6c, 0xdd, 0x44, 0xfa, 0x8e, 0x8c, 0xf4, 0x02, 0xfe, 0xb3, 0xbd, 0x54, - 0xb0, 0x76, 0xf3, 0xcd, 0x96, 0x69, 0x99, 0xfc, 0x94, 0x7b, 0x94, 0xc7, 0x7f, 0xb6, 0x97, 0x84, - 0xb4, 0xbd, 0x63, 0xa2, 0x42, 0x4d, 0x46, 0xb0, 0xb0, 0xbd, 0x54, 0x83, 0x96, 0xbc, 0x54, 0xa8, - 0x9b, 0x9a, 0x41, 0x30, 0x84, 0x19, 0xe7, 0x5c, 0x47, 0xaa, 0x4d, 0x49, 0x47, 0xaa, 0x73, 0x90, - 0x54, 0x4d, 0xd5, 0xc4, 0x9f, 0x05, 0xfb, 0xcb, 0xd9, 0x3d, 0xd3, 0x7f, 0xf7, 0x5e, 0x13, 0x22, - 0xe7, 0x74, 0x96, 0x10, 0xab, 0x12, 0x34, 0xb2, 0x70, 0x8e, 0x4e, 0xc8, 0xba, 0x66, 0x98, 0x05, - 0xfc, 0x97, 0x6c, 0x89, 0xbf, 0x73, 0x60, 0xb2, 0x82, 0xd4, 0x75, 0xcb, 0x6c, 0xc1, 0x15, 0x53, - 0x81, 0xfc, 0x34, 0x88, 0x21, 0x68, 0x28, 0xb0, 0x95, 0xe2, 0xb2, 0x5c, 0x2e, 0x21, 0x39, 0x2b, - 0xfe, 0x1a, 0x38, 0x66, 0xdf, 0x56, 0xad, 0xed, 0x59, 0xb0, 0x5a, 0x37, 0x15, 0x98, 0x1a, 0xcd, - 0x72, 0xb9, 0xc9, 0xf2, 0xd4, 0x7e, 0x27, 0x33, 0x79, 0x7b, 0x79, 0xbd, 0x52, 0xde, 0xb3, 0x30, - 0x05, 0x69, 0xd2, 0x86, 0x73, 0x57, 0xfc, 0x06, 0x98, 0xd6, 0x0c, 0x64, 0xc9, 0x86, 0xa5, 0xc9, - 0x16, 0xac, 0x36, 0x61, 0x4b, 0xd7, 0x10, 0xd2, 0x4c, 0x23, 0x35, 0x96, 0xe5, 0x72, 0x13, 0xc5, - 0x74, 0xde, 0xaf, 0xae, 0xfc, 0x72, 0xbd, 0x0e, 0x11, 0x5a, 0x31, 0x8d, 0x4d, 0x4d, 0x95, 0x4e, - 0x51, 0xd8, 0x6b, 0x1e, 0x72, 0xe9, 0xdc, 0xbb, 0x8f, 0xef, 0xcd, 0x3b, 0xbc, 0x7d, 0xf8, 0xf8, - 0xde, 0xfc, 0x09, 0xac, 0x0a, 0x5a, 0x92, 0x9b, 0xd1, 0x78, 0x64, 0x2a, 0x7a, 0x33, 0x1a, 0x8f, - 0x4e, 0x8d, 0x89, 0xb7, 0x41, 0x92, 0x3e, 0x93, 0x20, 0x6a, 0x9a, 0x06, 0x82, 0xfc, 0x79, 0x30, - 0x6e, 0xcb, 0x52, 0xd5, 0x14, 0x2c, 0x6e, 0xb4, 0x0c, 0xf6, 0x3b, 0x99, 0x98, 0x0d, 0xb2, 0x7a, - 0x43, 0x8a, 0xd9, 0x47, 0xab, 0x0a, 0x2f, 0x80, 0x78, 0x7d, 0x0b, 0xd6, 0xef, 0xa2, 0xb6, 0x4e, - 0x84, 0x96, 0xbc, 0xb5, 0x78, 0x7f, 0x14, 0x4c, 0x57, 0x90, 0xba, 0xda, 0x65, 0x72, 0xc5, 0x34, - 0xac, 0x96, 0x5c, 0xb7, 0x02, 0x35, 0x99, 0x04, 0x63, 0xb2, 0xa2, 0x6b, 0x06, 0xa6, 0x95, 0x90, - 0xc8, 0x82, 0xe6, 0x24, 0x12, 0xc8, 0x49, 0x12, 0x8c, 0x35, 0xe4, 0x1a, 0x6c, 0xa4, 0xa2, 0x04, - 0x15, 0x2f, 0xf8, 0x1c, 0x88, 0xe8, 0x48, 0xc5, 0xfa, 0x9c, 0x2c, 0x4f, 0xff, 0xd5, 0xc9, 0xf0, - 0x92, 0xbc, 0xe3, 0xb2, 0x51, 0x81, 0x08, 0xc9, 0x2a, 0x94, 0x6c, 0x10, 0x7e, 0x13, 0x8c, 0x6d, - 0xb6, 0x0d, 0x05, 0xa5, 0x62, 0xd9, 0x48, 0x6e, 0xa2, 0x38, 0x9b, 0x77, 0xdc, 0xc3, 0x76, 0xcc, - 0xbc, 0xe3, 0x98, 0xf9, 0x15, 0x53, 0x33, 0xca, 0xcf, 0x3f, 0xe8, 0x64, 0x46, 0xbe, 0xf8, 0x25, - 0x93, 0x53, 0x35, 0x6b, 0xab, 0x5d, 0xcb, 0xd7, 0x4d, 0xdd, 0xf1, 0x25, 0xe7, 0xdf, 0x15, 0xa4, - 0xdc, 0x75, 0xfc, 0xce, 0x46, 0x40, 0x9f, 0x3d, 0xbe, 0x37, 0xcf, 0x49, 0x84, 0x7c, 0xe9, 0xff, - 0x3e, 0xeb, 0x9c, 0x76, 0xad, 0xc3, 0xd0, 0x93, 0xf8, 0x3a, 0x48, 0xb3, 0x4f, 0x3c, 0x2b, 0xa5, - 0xc0, 0xb8, 0xac, 0x28, 0x2d, 0x88, 0x90, 0xa3, 0x4a, 0x77, 0xc9, 0xf3, 0x20, 0xaa, 0xc8, 0x96, - 0xec, 0x98, 0x05, 0x7f, 0x8b, 0x7f, 0x8e, 0x82, 0x19, 0x36, 0xc1, 0xe2, 0x7f, 0xd8, 0x26, 0xb6, - 0xaa, 0x90, 0xdc, 0xb0, 0x52, 0xe3, 0x44, 0x55, 0xf6, 0x37, 0x3f, 0x03, 0xc6, 0x37, 0xb5, 0xdd, - 0xaa, 0xcd, 0x69, 0x3c, 0xcb, 0xe5, 0xe2, 0x52, 0x6c, 0x53, 0xdb, 0xad, 0x20, 0xb5, 0xb4, 0xe0, - 0x33, 0xe0, 0x99, 0x10, 0x03, 0x16, 0xc5, 0x37, 0x40, 0x26, 0xe0, 0xe8, 0x90, 0x26, 0x7c, 0x6f, - 0x14, 0xf0, 0x15, 0xa4, 0xbe, 0xb2, 0x0b, 0xeb, 0xed, 0x21, 0x22, 0xca, 0x0e, 0x50, 0x07, 0xc6, - 0x31, 0xa0, 0xb7, 0x76, 0x0d, 0x11, 0x39, 0x80, 0x21, 0xc6, 0x9e, 0x6d, 0x70, 0xcc, 0xf9, 0x74, - 0x3b, 0xe3, 0xea, 0xd6, 0x27, 0xae, 0xb8, 0x08, 0x84, 0xfe, 0x5d, 0x4f, 0xa3, 0xae, 0xde, 0x38, - 0x4a, 0x6f, 0xf7, 0x39, 0xac, 0xb7, 0x8a, 0xa6, 0xb6, 0xe4, 0x23, 0xea, 0x6d, 0x28, 0xdf, 0x77, - 0x94, 0x1b, 0x1d, 0xa8, 0xdc, 0x60, 0xa1, 0x7d, 0xbc, 0x3a, 0x42, 0xfb, 0x76, 0x43, 0x85, 0x7e, - 0x9f, 0x03, 0xc7, 0x2a, 0x48, 0xdd, 0x68, 0x2a, 0xb2, 0x05, 0x97, 0x71, 0xe0, 0x06, 0x09, 0x7c, - 0x1a, 0x24, 0x0c, 0xb8, 0x53, 0xa5, 0x43, 0x3d, 0x6e, 0xc0, 0x1d, 0x82, 0x44, 0x6b, 0x23, 0xd2, - 0xab, 0x8d, 0xd2, 0x79, 0x1f, 0xfb, 0x27, 0x5d, 0xf6, 0xa9, 0x5b, 0xc5, 0x14, 0x2e, 0x05, 0xd4, - 0x8e, 0xcb, 0xb6, 0xa8, 0x82, 0xff, 0x55, 0x90, 0xba, 0xd2, 0x80, 0x72, 0x2b, 0x9c, 0xc1, 0x30, - 0x1e, 0x44, 0x1f, 0x0f, 0xbc, 0xcb, 0x43, 0x97, 0xae, 0x38, 0x03, 0x4e, 0xf5, 0x6c, 0x78, 0x1c, - 0xfc, 0xc1, 0x61, 0xbd, 0x12, 0xe6, 0x7a, 0x23, 0x75, 0x53, 0x53, 0x03, 0xf9, 0xa1, 0xbc, 0x60, - 0x34, 0xd0, 0x0b, 0xee, 0x00, 0xc1, 0xd6, 0x6a, 0x40, 0x99, 0x8f, 0x0c, 0x55, 0xe6, 0x53, 0x06, - 0xdc, 0x59, 0x65, 0x56, 0xfa, 0x82, 0x4f, 0xec, 0x4c, 0xaf, 0xea, 0xfb, 0x64, 0x11, 0x2f, 0x00, - 0x31, 0xf8, 0xd4, 0x53, 0xc8, 0x97, 0x1c, 0x38, 0xee, 0x81, 0xad, 0xc9, 0x2d, 0x59, 0x47, 0xfc, - 0x35, 0x90, 0x90, 0xdb, 0xd6, 0x96, 0xd9, 0xd2, 0xac, 0x3d, 0xa2, 0x88, 0x72, 0xea, 0xc7, 0xaf, - 0xae, 0x24, 0x9d, 0x44, 0xb0, 0x4c, 0x32, 0xd6, 0xba, 0xd5, 0xd2, 0x0c, 0x55, 0xea, 0x82, 0xf2, - 0x2f, 0x81, 0x58, 0x13, 0x53, 0xc0, 0x4a, 0x9a, 0x28, 0xa6, 0xfa, 0x85, 0x25, 0x37, 0x94, 0x13, - 0x76, 0xe6, 0x20, 0xd9, 0xc0, 0x41, 0x21, 0x91, 0xd1, 0x25, 0x66, 0x8b, 0x98, 0xec, 0x15, 0x91, - 0xe0, 0x8a, 0xb3, 0xb8, 0xac, 0xd1, 0x5b, 0x9e, 0x30, 0x5f, 0x13, 0x61, 0xd6, 0xdb, 0x8a, 0xe9, - 0x05, 0xfd, 0x61, 0x85, 0x79, 0x2a, 0xc9, 0x34, 0x54, 0x2a, 0x9a, 0x4d, 0xf1, 0x0a, 0x96, 0x8a, - 0xde, 0x0a, 0x0d, 0xf6, 0x4f, 0x39, 0x30, 0x51, 0x41, 0xea, 0x9a, 0x66, 0xd8, 0x4e, 0x78, 0x78, - 0x93, 0x5d, 0xb7, 0xa5, 0xc4, 0x8e, 0x6d, 0x1b, 0x2d, 0x92, 0x8b, 0x96, 0xd3, 0xfb, 0x9d, 0xcc, - 0x38, 0xf1, 0x6c, 0xf4, 0xa4, 0x93, 0x39, 0xbe, 0x27, 0xeb, 0x8d, 0x92, 0xe8, 0x02, 0x89, 0xd2, - 0x38, 0xf1, 0x76, 0x44, 0x72, 0x41, 0xaf, 0x68, 0x53, 0xae, 0x68, 0x2e, 0x5f, 0xe2, 0x29, 0x70, - 0x92, 0x5a, 0x7a, 0x86, 0xfa, 0x9c, 0xc3, 0x99, 0x60, 0xc3, 0x68, 0xfe, 0x83, 0x02, 0x5c, 0xec, - 0x17, 0xc0, 0xcb, 0x25, 0x5d, 0xce, 0x9c, 0x5c, 0xd2, 0xdd, 0xf0, 0x84, 0xf8, 0x2e, 0x8a, 0x3b, - 0x36, 0xdc, 0x4d, 0x2f, 0x1b, 0x0a, 0xab, 0xf7, 0x3d, 0xac, 0x54, 0xfd, 0x53, 0x46, 0xe4, 0x88, - 0x53, 0x46, 0xf4, 0x08, 0x53, 0x06, 0x7f, 0x16, 0x80, 0xb6, 0x2d, 0x3f, 0x61, 0x65, 0x0c, 0xb7, - 0x48, 0x89, 0xb6, 0xab, 0x91, 0x6e, 0xd7, 0x18, 0xa3, 0xbb, 0x46, 0xaf, 0x21, 0x1c, 0x67, 0x34, - 0x84, 0xf1, 0x03, 0xf4, 0x21, 0x89, 0x67, 0xdb, 0x10, 0xda, 0x39, 0xdf, 0x6c, 0xb7, 0xea, 0x30, - 0x05, 0x9c, 0x9c, 0x8f, 0x57, 0x76, 0xab, 0x56, 0x6b, 0x6b, 0x0d, 0xbb, 0x18, 0x4c, 0x90, 0x56, - 0xcd, 0x59, 0xda, 0xe5, 0x13, 0xbb, 0xd3, 0x96, 0x8c, 0xb6, 0x52, 0x93, 0xce, 0x24, 0x64, 0x2a, - 0xf0, 0x55, 0x19, 0x6d, 0x95, 0xae, 0xf5, 0x7b, 0xd5, 0xf9, 0x9e, 0xa1, 0x8c, 0xed, 0x2a, 0xe2, - 0x2d, 0x70, 0x29, 0x1c, 0xe2, 0x90, 0x3d, 0xe4, 0x37, 0x1c, 0xee, 0x4a, 0x97, 0x15, 0xc5, 0xb6, - 0xd5, 0x46, 0xb3, 0x61, 0xca, 0x0a, 0x49, 0x9b, 0x8e, 0xf7, 0x1d, 0x21, 0xf8, 0x8a, 0x20, 0x21, - 0xbb, 0x44, 0x70, 0xf4, 0x25, 0xca, 0xc9, 0x27, 0x9d, 0xcc, 0x14, 0x09, 0x39, 0xef, 0x48, 0x94, - 0xba, 0x60, 0xa5, 0x17, 0xfa, 0xf5, 0x73, 0xc1, 0xd5, 0x4f, 0x18, 0x93, 0xe2, 0x65, 0x30, 0x37, - 0x00, 0xc4, 0x8b, 0xcc, 0xef, 0x39, 0x5c, 0xfb, 0x24, 0xa8, 0x9b, 0xdb, 0xf0, 0xdf, 0x21, 0x76, - 0xa9, 0x5f, 0xec, 0x39, 0x57, 0xec, 0x01, 0x7c, 0x8a, 0x0b, 0x60, 0x7e, 0x30, 0x94, 0x27, 0xfc, - 0xcf, 0xa3, 0xb8, 0xc5, 0x71, 0x3d, 0xc9, 0xdf, 0x04, 0x3f, 0xbd, 0x94, 0x74, 0xd4, 0x87, 0x8f, - 0xc8, 0x51, 0x52, 0x12, 0x5d, 0x9e, 0xa3, 0xec, 0xf2, 0x3c, 0x78, 0xe8, 0x2c, 0x15, 0xfb, 0xad, - 0x92, 0xf1, 0x07, 0xab, 0xbf, 0x33, 0xdf, 0xc3, 0xbe, 0x15, 0x70, 0xfa, 0xd4, 0x5e, 0x54, 0xbc, - 0x58, 0x8e, 0x50, 0xb1, 0xfc, 0x2d, 0x47, 0xb5, 0xd6, 0xee, 0x95, 0xaf, 0xe1, 0xbc, 0xba, 0xd8, - 0xdb, 0xb9, 0x86, 0xd8, 0xd4, 0x37, 0x04, 0x90, 0x1c, 0xdd, 0x1d, 0x02, 0x08, 0xb9, 0xab, 0xfe, - 0x06, 0x3c, 0x84, 0x60, 0xb7, 0x35, 0x0f, 0x7c, 0xef, 0x60, 0x70, 0x2c, 0x66, 0x71, 0xf5, 0x64, - 0x9c, 0xb8, 0x3a, 0x2c, 0xfe, 0x70, 0x0c, 0x44, 0x2a, 0x48, 0xe5, 0xd7, 0x41, 0xa2, 0xfb, 0x30, - 0xc7, 0xf0, 0x17, 0xfa, 0x49, 0x4b, 0xb8, 0x14, 0x7e, 0xee, 0x19, 0xe8, 0x6d, 0x70, 0x92, 0x55, - 0xb1, 0x73, 0x4c, 0x74, 0x06, 0xa4, 0xb0, 0x38, 0x2c, 0xa4, 0x77, 0xa5, 0x05, 0x92, 0xcc, 0xd7, - 0x98, 0xcb, 0xc3, 0x52, 0x2a, 0x0a, 0x4b, 0x43, 0x83, 0x7a, 0xb7, 0x42, 0x70, 0xdc, 0xff, 0x80, - 0x70, 0x81, 0x49, 0xc5, 0x07, 0x25, 0x2c, 0x0c, 0x03, 0x45, 0x5f, 0xe3, 0x4f, 0x35, 0xec, 0x6b, - 0x7c, 0x50, 0x01, 0xd7, 0x04, 0xc5, 0xd5, 0x9b, 0x60, 0x82, 0x9e, 0x70, 0xb3, 0x4c, 0x64, 0x0a, - 0x42, 0xc8, 0x0d, 0x82, 0xf0, 0x48, 0xdf, 0x02, 0x80, 0x1a, 0x4d, 0x33, 0x4c, 0xbc, 0x2e, 0x80, - 0x30, 0x37, 0x00, 0xc0, 0xa3, 0xfb, 0x0e, 0x98, 0x09, 0x9a, 0x37, 0x17, 0x42, 0x98, 0xeb, 0x83, - 0x16, 0xae, 0x1e, 0x04, 0xda, 0xbb, 0xfe, 0x0e, 0x98, 0xec, 0x99, 0xee, 0xce, 0x85, 0x50, 0x21, - 0x20, 0xc2, 0xe5, 0x81, 0x20, 0x34, 0xf5, 0x9e, 0x71, 0x8b, 0x4d, 0x9d, 0x06, 0x09, 0xa0, 0xce, - 0x1c, 0x7d, 0xd6, 0x40, 0xdc, 0x1b, 0x71, 0xce, 0x32, 0xd1, 0xdc, 0x63, 0xe1, 0x62, 0xe8, 0x31, - 0x6d, 0x64, 0x6a, 0xea, 0x60, 0x1b, 0xb9, 0x0b, 0x10, 0x60, 0xe4, 0xfe, 0x61, 0x80, 0xff, 0x80, - 0x03, 0xa7, 0xc3, 0x26, 0x81, 0xc5, 0xe0, 0xb4, 0xc4, 0xc6, 0x10, 0x5e, 0x3c, 0x28, 0x86, 0xc7, - 0xcb, 0x27, 0x1c, 0xc8, 0x0c, 0xea, 0x7d, 0xd8, 0xbe, 0x34, 0x00, 0x4b, 0x78, 0xf9, 0x30, 0x58, - 0x1e, 0x5f, 0x1f, 0x71, 0xe0, 0x4c, 0x68, 0x1f, 0xca, 0xce, 0x6e, 0x61, 0x28, 0xc2, 0xf5, 0x03, - 0xa3, 0xd0, 0x71, 0x19, 0xd4, 0x24, 0x2d, 0x84, 0xea, 0xde, 0x9f, 0xc1, 0xae, 0x1e, 0x04, 0x9a, - 0x2e, 0x40, 0xac, 0x42, 0x1e, 0x96, 0xaf, 0x7a, 0x20, 0x03, 0x0a, 0x50, 0x48, 0x41, 0x2d, 0xdf, - 0x78, 0xf0, 0x5b, 0x7a, 0xe4, 0xc1, 0x7e, 0x9a, 0x7b, 0xb8, 0x9f, 0xe6, 0x7e, 0xdd, 0x4f, 0x73, - 0x1f, 0x3f, 0x4a, 0x8f, 0x3c, 0x7c, 0x94, 0x1e, 0xf9, 0xe9, 0x51, 0x7a, 0xe4, 0xad, 0x4b, 0xd4, - 0xf8, 0xb4, 0x62, 0x22, 0xfd, 0xb6, 0xfb, 0xd3, 0x9a, 0x52, 0xd8, 0x25, 0x3f, 0xb1, 0xe1, 0x11, - 0xaa, 0x16, 0xc3, 0x3f, 0x99, 0x3d, 0xf7, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x6a, 0x38, - 0xdb, 0xfc, 0x1b, 0x00, 0x00, + // 1744 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x19, 0x4b, 0x6f, 0x1b, 0xd5, + 0x3a, 0x13, 0xbf, 0xbf, 0xf8, 0xb6, 0xe9, 0x34, 0x6d, 0x9c, 0x49, 0x6b, 0xa7, 0xd3, 0x36, 0x71, + 0x73, 0x53, 0x3b, 0xf1, 0xed, 0xed, 0x6d, 0x7d, 0xef, 0x26, 0x4e, 0x2f, 0x22, 0x15, 0x96, 0x22, + 0x47, 0xa1, 0x02, 0x55, 0xb2, 0x26, 0x9e, 0x93, 0xc9, 0x50, 0x7b, 0xc6, 0xf8, 0x8c, 0xf3, 0x58, + 0x20, 0xa1, 0x0a, 0x21, 0x81, 0x58, 0xb0, 0xe9, 0x06, 0xd6, 0x48, 0xc0, 0x86, 0x2c, 0xf8, 0x09, + 0x08, 0x55, 0x88, 0x45, 0x85, 0x40, 0xea, 0x2a, 0x40, 0xba, 0xc8, 0x8a, 0x4d, 0x97, 0x2c, 0x10, + 0x9a, 0x73, 0x66, 0xc6, 0xe3, 0xf1, 0xcc, 0xf8, 0x15, 0xb5, 0x2c, 0xd8, 0x24, 0x73, 0xce, 0xf7, + 0x38, 0xdf, 0xfb, 0x7c, 0xdf, 0x31, 0x4c, 0x55, 0x54, 0x5c, 0xdb, 0x15, 0x70, 0x2d, 0x4b, 0xfe, + 0xec, 0x2c, 0x65, 0xb5, 0xbd, 0x4c, 0xbd, 0xa1, 0x6a, 0x2a, 0x3b, 0x6e, 0x82, 0x32, 0xe4, 0xcf, + 0xce, 0x12, 0x97, 0xd4, 0x77, 0x54, 0x9c, 0xdd, 0x14, 0x30, 0xca, 0xee, 0x2c, 0x6d, 0x22, 0x4d, + 0x58, 0xca, 0x56, 0x54, 0x59, 0xa1, 0x14, 0xdc, 0xa4, 0x01, 0xaf, 0x61, 0x49, 0xe7, 0x54, 0xc3, + 0x92, 0x01, 0x98, 0x90, 0x54, 0x49, 0x25, 0x9f, 0x59, 0xfd, 0xcb, 0xd8, 0xbd, 0xd0, 0x79, 0xf6, + 0x7e, 0x1d, 0x61, 0x03, 0x3a, 0x45, 0x99, 0x95, 0x29, 0x19, 0x5d, 0x18, 0xa0, 0x33, 0x42, 0x4d, + 0x56, 0xd4, 0x2c, 0xf9, 0x4b, 0xb7, 0xf8, 0x3f, 0x18, 0x88, 0x17, 0xb1, 0xb4, 0xae, 0xa9, 0x0d, + 0xb4, 0xa2, 0x8a, 0x88, 0x5d, 0x84, 0x30, 0x46, 0x8a, 0x88, 0x1a, 0x09, 0x66, 0x86, 0x49, 0xc7, + 0x0a, 0x89, 0x1f, 0xbe, 0xbe, 0x3e, 0x61, 0x70, 0x59, 0x16, 0xc5, 0x06, 0xc2, 0x78, 0x5d, 0x6b, + 0xc8, 0x8a, 0x54, 0x32, 0xf0, 0xd8, 0x9b, 0x70, 0x4a, 0x97, 0xa3, 0xbc, 0xb9, 0xaf, 0xa1, 0x72, + 0x45, 0x15, 0x51, 0x62, 0x74, 0x86, 0x49, 0xc7, 0x0b, 0xe3, 0x47, 0x87, 0xa9, 0xf8, 0xbd, 0xe5, + 0xf5, 0x62, 0x61, 0x5f, 0x23, 0xbc, 0x4b, 0x71, 0x1d, 0xcf, 0x5c, 0xb1, 0x1b, 0x70, 0x5e, 0x56, + 0xb0, 0x26, 0x28, 0x9a, 0x2c, 0x68, 0xa8, 0x5c, 0x47, 0x8d, 0x9a, 0x8c, 0xb1, 0xac, 0x2a, 0x89, + 0xd0, 0x0c, 0x93, 0x1e, 0xcb, 0x25, 0x33, 0x4e, 0x43, 0x66, 0x96, 0x2b, 0x15, 0x84, 0xf1, 0x8a, + 0xaa, 0x6c, 0xc9, 0x52, 0xe9, 0x9c, 0x8d, 0x7a, 0xcd, 0x22, 0xce, 0x5f, 0x7a, 0x78, 0x7c, 0x30, + 0x6f, 0xc8, 0xf6, 0xe1, 0xf1, 0xc1, 0xfc, 0x19, 0x62, 0x24, 0xbb, 0x8e, 0x77, 0x83, 0xd1, 0xc0, + 0x78, 0xf0, 0x6e, 0x30, 0x1a, 0x1c, 0x0f, 0xf1, 0xf7, 0x60, 0xc2, 0x0e, 0x2b, 0x21, 0x5c, 0x57, + 0x15, 0x8c, 0xd8, 0xcb, 0x10, 0xd1, 0x75, 0x29, 0xcb, 0x22, 0x31, 0x44, 0xb0, 0x00, 0x47, 0x87, + 0xa9, 0xb0, 0x8e, 0xb2, 0x7a, 0xa7, 0x14, 0xd6, 0x41, 0xab, 0x22, 0xcb, 0x41, 0xb4, 0xb2, 0x8d, + 0x2a, 0x0f, 0x70, 0xb3, 0x46, 0x95, 0x2e, 0x59, 0x6b, 0xfe, 0x51, 0x00, 0xce, 0x17, 0xb1, 0xb4, + 0xda, 0x12, 0x72, 0x45, 0x55, 0xb4, 0x86, 0x50, 0xd1, 0x06, 0xb0, 0x71, 0x06, 0x42, 0x82, 0x58, + 0x93, 0x15, 0x72, 0x8a, 0x1f, 0x01, 0x45, 0xb3, 0x4b, 0x1f, 0xf0, 0x94, 0x7e, 0x02, 0x42, 0x55, + 0x61, 0x13, 0x55, 0x13, 0x41, 0x9d, 0x69, 0x89, 0x2e, 0xd8, 0x5b, 0x10, 0xa8, 0x61, 0x89, 0xf8, + 0x20, 0x5e, 0x98, 0xfd, 0xfd, 0x30, 0xc5, 0x96, 0x84, 0x5d, 0x53, 0xf4, 0x22, 0xc2, 0x58, 0x90, + 0xd0, 0x27, 0xc7, 0x07, 0xf3, 0x63, 0xb2, 0x52, 0x95, 0x15, 0x54, 0x7e, 0x0b, 0xab, 0x4a, 0x49, + 0x27, 0x61, 0x77, 0x21, 0xb4, 0xd5, 0x54, 0x44, 0x9c, 0x08, 0xcf, 0x04, 0xd2, 0x63, 0xb9, 0xa9, + 0x8c, 0x21, 0xa1, 0x1e, 0xf6, 0x19, 0x23, 0xec, 0x33, 0x2b, 0xaa, 0xac, 0x14, 0x5e, 0x79, 0x7c, + 0x98, 0x1a, 0xf9, 0xf2, 0xe7, 0x54, 0x5a, 0x92, 0xb5, 0xed, 0xe6, 0x66, 0xa6, 0xa2, 0xd6, 0x8c, + 0x48, 0x35, 0xfe, 0x5d, 0xc7, 0xe2, 0x03, 0x23, 0xaa, 0x75, 0x02, 0xac, 0x1f, 0x18, 0xaf, 0x22, + 0x49, 0xa8, 0xec, 0x97, 0xf5, 0xc4, 0xc1, 0x9f, 0x1f, 0x1f, 0xcc, 0x33, 0x25, 0x7a, 0x5e, 0xfe, + 0x9f, 0x0e, 0x97, 0x4f, 0x9b, 0x2e, 0x77, 0x31, 0x3e, 0xbf, 0x0d, 0x49, 0x77, 0x88, 0xe5, 0xfa, + 0x1c, 0x44, 0x04, 0x6a, 0xd4, 0xae, 0xfe, 0x31, 0x11, 0x59, 0x16, 0x82, 0xa2, 0xa0, 0x09, 0x46, + 0x14, 0x90, 0x6f, 0xfe, 0x9b, 0x00, 0x4c, 0xba, 0x1f, 0x95, 0xfb, 0x3b, 0x04, 0x4e, 0x36, 0x04, + 0x74, 0xfb, 0x63, 0xa1, 0xaa, 0x25, 0x22, 0xd4, 0xfe, 0xfa, 0x37, 0x3b, 0x09, 0x91, 0x2d, 0x79, + 0xaf, 0xac, 0xab, 0x12, 0x9d, 0x61, 0xd2, 0xd1, 0x52, 0x78, 0x4b, 0xde, 0x2b, 0x62, 0x29, 0xbf, + 0xe0, 0x88, 0x97, 0x0b, 0x3e, 0xf1, 0x92, 0xe3, 0x65, 0x48, 0x79, 0x80, 0x4e, 0x3c, 0x62, 0x9e, + 0x8e, 0x02, 0x5b, 0xc4, 0xd2, 0xff, 0xf7, 0x50, 0xa5, 0x39, 0x54, 0xbd, 0xb8, 0x01, 0xd1, 0x8a, + 0x41, 0xdd, 0x35, 0x5e, 0x2c, 0x4c, 0xd3, 0xef, 0x81, 0x21, 0xfc, 0x1e, 0x7a, 0xc1, 0xa9, 0x3f, + 0xe7, 0x70, 0xe5, 0xa4, 0xe9, 0x4a, 0x87, 0x0d, 0xf9, 0x45, 0xe0, 0x3a, 0x77, 0x2d, 0x07, 0x9a, + 0xce, 0x60, 0x6c, 0xce, 0x78, 0x8f, 0x3a, 0xa3, 0x28, 0x4b, 0x0d, 0xe1, 0x25, 0x38, 0xa3, 0xa7, + 0xfc, 0x35, 0x3c, 0x16, 0xec, 0xdb, 0x63, 0xde, 0x86, 0x73, 0xe8, 0x6b, 0x18, 0xce, 0xb1, 0xeb, + 0x6b, 0xb8, 0x1f, 0x19, 0x38, 0x55, 0xc4, 0xd2, 0x46, 0x5d, 0x14, 0x34, 0xb4, 0x4c, 0x8a, 0x51, + 0xff, 0x46, 0xfb, 0x37, 0xc4, 0x14, 0xb4, 0x5b, 0xee, 0xad, 0xe4, 0x45, 0x15, 0xb4, 0x4b, 0x0f, + 0xb2, 0xdb, 0x3a, 0xd0, 0xab, 0xad, 0xf3, 0x97, 0x1d, 0xc6, 0x38, 0x6b, 0x1a, 0xc3, 0xa6, 0x03, + 0x9f, 0x20, 0xf7, 0xb9, 0x6d, 0xc7, 0x34, 0x02, 0xff, 0x29, 0x03, 0xff, 0x28, 0x62, 0x69, 0xa5, + 0x8a, 0x84, 0xc6, 0xa0, 0xfa, 0x0e, 0x26, 0x38, 0xef, 0x10, 0x9c, 0x35, 0x05, 0x6f, 0xc9, 0xc2, + 0x4f, 0xc2, 0xb9, 0xb6, 0x0d, 0x4b, 0xec, 0x87, 0xa3, 0xc4, 0xb5, 0x54, 0xa3, 0xf6, 0xfa, 0xb6, + 0x25, 0x4b, 0x03, 0xe8, 0x60, 0x0b, 0xd9, 0x51, 0xcf, 0x90, 0xbd, 0x0f, 0x9c, 0xee, 0x58, 0x8f, + 0xd6, 0x2f, 0xd0, 0x53, 0xeb, 0x97, 0x50, 0xd0, 0xee, 0xaa, 0x6b, 0xf7, 0x97, 0x75, 0x18, 0x24, + 0xd5, 0xee, 0xc9, 0x0e, 0x2d, 0xf9, 0x2b, 0xc0, 0x7b, 0x43, 0x2d, 0x53, 0x7d, 0xc5, 0xc0, 0x69, + 0x0b, 0x6d, 0x4d, 0x68, 0x08, 0x35, 0xcc, 0xde, 0x84, 0x98, 0xd0, 0xd4, 0xb6, 0xd5, 0x86, 0xac, + 0xed, 0x77, 0x35, 0x51, 0x0b, 0x95, 0xfd, 0x2f, 0x84, 0xeb, 0x84, 0x03, 0x31, 0xd2, 0x58, 0x2e, + 0xd1, 0xa9, 0x2c, 0x3d, 0xa1, 0x10, 0xd3, 0x6b, 0x25, 0x2d, 0x77, 0x06, 0x09, 0x4d, 0xdb, 0x16, + 0x33, 0x5d, 0xc5, 0x89, 0x76, 0x15, 0x29, 0x2d, 0x3f, 0x45, 0x7a, 0x0f, 0xfb, 0x96, 0xa5, 0xcc, + 0x11, 0x55, 0x66, 0xbd, 0x29, 0xaa, 0x56, 0x55, 0x1b, 0x54, 0x99, 0x17, 0x7c, 0xd1, 0xf8, 0xea, + 0x6f, 0x57, 0x88, 0xbf, 0x4e, 0xf4, 0xb7, 0x6f, 0xf9, 0xd6, 0xac, 0xcf, 0x18, 0x18, 0x2b, 0x62, + 0x69, 0x4d, 0x56, 0xf4, 0x70, 0x1d, 0xdc, 0xb9, 0xb7, 0x75, 0x7b, 0x90, 0x14, 0xd0, 0xdd, 0x1b, + 0x48, 0x07, 0x0b, 0xc9, 0xa3, 0xc3, 0x54, 0x84, 0xe6, 0x00, 0x7e, 0x7e, 0x98, 0x3a, 0xbd, 0x2f, + 0xd4, 0xaa, 0x79, 0xde, 0x44, 0xe2, 0x4b, 0x11, 0x9a, 0x17, 0x98, 0x16, 0xa1, 0x76, 0xd5, 0xc6, + 0x4d, 0xd5, 0x4c, 0xb9, 0xf8, 0x73, 0x70, 0xd6, 0xb6, 0xb4, 0x5c, 0xfa, 0x05, 0xad, 0x40, 0x1b, + 0x4a, 0xfd, 0x25, 0x2a, 0x70, 0xb5, 0x53, 0x01, 0xab, 0x1e, 0xb5, 0x24, 0x33, 0xea, 0x51, 0x6b, + 0xc3, 0x52, 0xe2, 0xfd, 0x10, 0x69, 0xcd, 0xc9, 0x2c, 0xb6, 0xac, 0x88, 0x6e, 0x93, 0xd3, 0xa0, + 0x5a, 0x75, 0xce, 0xa8, 0x81, 0x21, 0x67, 0xd4, 0xe0, 0x10, 0x33, 0x2a, 0x7b, 0x11, 0xa0, 0xa9, + 0xeb, 0x4f, 0x45, 0x09, 0x91, 0xe6, 0x34, 0xd6, 0x34, 0x2d, 0xd2, 0x6a, 0xf5, 0xc3, 0xbd, 0xb5, + 0xfa, 0x56, 0x17, 0x1f, 0x71, 0xe9, 0xe2, 0xa3, 0x43, 0x74, 0x73, 0xb1, 0x17, 0xdc, 0xc5, 0x9f, + 0x87, 0x30, 0x56, 0x9b, 0x8d, 0x0a, 0x4a, 0x00, 0xd1, 0xc4, 0x58, 0xb1, 0x09, 0x88, 0x6c, 0x36, + 0xe5, 0xaa, 0x7e, 0x17, 0x8d, 0x11, 0x80, 0xb9, 0x64, 0xa7, 0x21, 0x46, 0x22, 0x71, 0x5b, 0xc0, + 0xdb, 0x89, 0xb8, 0x31, 0x82, 0xab, 0x22, 0x7a, 0x55, 0xc0, 0xdb, 0xf9, 0x9b, 0x9d, 0x01, 0x79, + 0xb9, 0xed, 0x35, 0xc0, 0x3d, 0xca, 0xf8, 0x3a, 0xcc, 0xfa, 0x63, 0x9c, 0x78, 0xe3, 0xff, 0x2d, + 0x43, 0x86, 0x8c, 0x65, 0x51, 0xd4, 0x03, 0x60, 0xa3, 0x5e, 0x55, 0x05, 0x91, 0x56, 0x6d, 0x83, + 0xc9, 0x10, 0x19, 0x9d, 0x83, 0x98, 0x60, 0x32, 0x21, 0x29, 0x1d, 0x2b, 0x4c, 0x3c, 0x3f, 0x4c, + 0x8d, 0xd3, 0x3c, 0xb6, 0x40, 0x7c, 0xa9, 0x85, 0x96, 0xff, 0x4f, 0xa7, 0xe5, 0xae, 0x98, 0x96, + 0xf3, 0x13, 0x92, 0xbf, 0x06, 0x73, 0x5d, 0x50, 0xac, 0x74, 0xff, 0x9e, 0x21, 0x57, 0x6f, 0x09, + 0xd5, 0xd4, 0x1d, 0xf4, 0xd7, 0x50, 0x3b, 0xdf, 0xa9, 0xf6, 0x9c, 0xa9, 0x76, 0x17, 0x39, 0xf9, + 0x05, 0x98, 0xef, 0x8e, 0x65, 0x29, 0xff, 0x1b, 0xed, 0xbd, 0xcc, 0x18, 0x73, 0x0e, 0x19, 0x27, + 0x57, 0xe7, 0x86, 0x7d, 0x8b, 0x0b, 0x0c, 0x53, 0xe7, 0x38, 0x5b, 0x77, 0x40, 0x5f, 0x18, 0x3a, + 0x7a, 0x80, 0xfe, 0x1f, 0x19, 0xf2, 0xb9, 0x4e, 0x2f, 0xa5, 0x9c, 0x69, 0xed, 0x9c, 0x62, 0xf6, + 0x49, 0xac, 0x79, 0x40, 0x4f, 0xec, 0xd1, 0xcf, 0xca, 0xed, 0x80, 0x2d, 0xb7, 0xbf, 0x63, 0x6c, + 0x83, 0x83, 0x79, 0xe4, 0x6b, 0xa4, 0x44, 0xf7, 0xdf, 0x62, 0x4f, 0xd3, 0xb1, 0x88, 0x96, 0xfb, + 0x51, 0x6a, 0x52, 0x05, 0xed, 0x52, 0x76, 0x83, 0xcd, 0x10, 0x9e, 0xaf, 0x67, 0x2e, 0x12, 0xf3, + 0x33, 0xe4, 0x8a, 0x76, 0x81, 0x98, 0x36, 0xcc, 0xfd, 0x74, 0x0a, 0x02, 0x45, 0x2c, 0xb1, 0xeb, + 0x10, 0x6b, 0xbd, 0x2a, 0xbb, 0xc4, 0x8f, 0xfd, 0xd5, 0x95, 0x9b, 0xf5, 0x87, 0x5b, 0x0e, 0x7a, + 0x1b, 0xce, 0xba, 0xb5, 0x05, 0x69, 0x57, 0x72, 0x17, 0x4c, 0x6e, 0xb1, 0x57, 0x4c, 0xeb, 0x48, + 0x0d, 0x26, 0x5c, 0x5f, 0xf0, 0xae, 0xf5, 0xca, 0x29, 0xc7, 0x2d, 0xf5, 0x8c, 0x6a, 0x9d, 0x8a, + 0xe0, 0xb4, 0xf3, 0x15, 0xe8, 0x8a, 0x2b, 0x17, 0x07, 0x16, 0xb7, 0xd0, 0x0b, 0x96, 0xfd, 0x18, + 0x67, 0xe9, 0x71, 0x3f, 0xc6, 0x81, 0xe5, 0x71, 0x8c, 0x57, 0x5e, 0xbd, 0x01, 0x63, 0xf6, 0xd7, + 0x80, 0x19, 0x57, 0x62, 0x1b, 0x06, 0x97, 0xee, 0x86, 0x61, 0xb1, 0x7e, 0x1d, 0xc0, 0x36, 0x77, + 0xa7, 0x5c, 0xe9, 0x5a, 0x08, 0xdc, 0x5c, 0x17, 0x04, 0x8b, 0xef, 0x3b, 0x30, 0xe9, 0x35, 0x18, + 0x2f, 0xf8, 0x08, 0xd7, 0x81, 0xcd, 0xdd, 0xe8, 0x07, 0xdb, 0x3a, 0xfe, 0x3e, 0xc4, 0xdb, 0x86, + 0xcd, 0x4b, 0x3e, 0x5c, 0x28, 0x0a, 0x77, 0xad, 0x2b, 0x8a, 0x9d, 0x7b, 0xdb, 0xf4, 0xe7, 0xce, + 0xdd, 0x8e, 0xe2, 0xc1, 0xdd, 0x75, 0xbe, 0x5a, 0x83, 0xa8, 0x35, 0x47, 0x5d, 0x74, 0x25, 0x33, + 0xc1, 0xdc, 0x55, 0x5f, 0xb0, 0xdd, 0xc9, 0xb6, 0xd1, 0xc6, 0xdd, 0xc9, 0x2d, 0x04, 0x0f, 0x27, + 0x77, 0x4e, 0x1c, 0xec, 0x07, 0x0c, 0x4c, 0xfb, 0x8d, 0x1b, 0x8b, 0xde, 0x65, 0xc9, 0x9d, 0x82, + 0xbb, 0xd5, 0x2f, 0x85, 0x25, 0xcb, 0x23, 0x06, 0x52, 0xdd, 0x7a, 0x21, 0xf7, 0x58, 0xea, 0x42, + 0xc5, 0xfd, 0x6f, 0x10, 0x2a, 0x4b, 0xae, 0x8f, 0x18, 0xb8, 0xe0, 0xdb, 0x97, 0xba, 0x57, 0x37, + 0x3f, 0x12, 0xee, 0x76, 0xdf, 0x24, 0xf6, 0xbc, 0xf4, 0x6a, 0x9a, 0x16, 0x7c, 0x6d, 0xef, 0xac, + 0x60, 0x37, 0xfa, 0xc1, 0xb6, 0x5f, 0x40, 0x6e, 0x17, 0xb9, 0x5f, 0xbd, 0x6a, 0xc3, 0xf4, 0xb8, + 0x80, 0x7c, 0x2e, 0x54, 0x2e, 0xf4, 0xae, 0x3e, 0x22, 0x15, 0xee, 0x3c, 0xfe, 0x35, 0x39, 0xf2, + 0xf8, 0x28, 0xc9, 0x3c, 0x39, 0x4a, 0x32, 0xbf, 0x1c, 0x25, 0x99, 0x8f, 0x9f, 0x25, 0x47, 0x9e, + 0x3c, 0x4b, 0x8e, 0x3c, 0x7d, 0x96, 0x1c, 0x79, 0x73, 0xd6, 0x36, 0x80, 0xad, 0xa8, 0xb8, 0x76, + 0xcf, 0xfc, 0x79, 0x58, 0xcc, 0xee, 0xd1, 0x9f, 0x89, 0xc9, 0x10, 0xb6, 0x19, 0x26, 0x3f, 0xfb, + 0xfe, 0xeb, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x9e, 0x52, 0x25, 0xc0, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/wasm/types/tx_test.go b/x/wasm/types/tx_test.go index 52605edba1..1045b95028 100644 --- a/x/wasm/types/tx_test.go +++ b/x/wasm/types/tx_test.go @@ -8,8 +8,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) const ( @@ -173,7 +174,7 @@ func TestInstantiateContractValidation(t *testing.T) { CodeID: firstCodeID, Label: "foo", Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(200)}}, }, valid: true, }, @@ -184,7 +185,7 @@ func TestInstantiateContractValidation(t *testing.T) { Label: "foo", Msg: []byte(`{"some": "data"}`), // we cannot use sdk.NewCoin() constructors as they panic on creating invalid data (before we can test) - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(-200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(-200)}}, }, valid: false, }, @@ -283,7 +284,7 @@ func TestInstantiateContract2Validation(t *testing.T) { CodeID: firstCodeID, Label: strings.Repeat("a", MaxLabelSize), Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(200)}}, Salt: bytes.Repeat([]byte{0}, MaxSaltSize), FixMsg: true, }, @@ -296,7 +297,7 @@ func TestInstantiateContract2Validation(t *testing.T) { Label: "foo", Msg: []byte(`{"some": "data"}`), // we cannot use sdk.NewCoin() constructors as they panic on creating invalid data (before we can test) - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(-200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(-200)}}, Salt: []byte{0}, }, valid: false, @@ -377,7 +378,7 @@ func TestExecuteContractValidation(t *testing.T) { Sender: goodAddress, Contract: goodAddress, Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(200)}}, }, valid: true, }, @@ -416,7 +417,7 @@ func TestExecuteContractValidation(t *testing.T) { Sender: goodAddress, Contract: goodAddress, Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(-1)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(-1)}}, }, valid: false, }, @@ -425,7 +426,7 @@ func TestExecuteContractValidation(t *testing.T) { Sender: goodAddress, Contract: goodAddress, Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(1)}, sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(1)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(1)}, sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(1)}}, }, valid: false, }, @@ -659,45 +660,6 @@ func TestMsgMigrateContract(t *testing.T) { } } -func TestMsgJsonSignBytes(t *testing.T) { - const myInnerMsg = `{"foo":"bar"}` - specs := map[string]struct { - src legacytx.LegacyMsg - exp string - }{ - "MsgInstantiateContract": { - src: &MsgInstantiateContract{Msg: RawContractMessage(myInnerMsg)}, - exp: ` -{ - "type":"wasm/MsgInstantiateContract", - "value": {"msg": {"foo":"bar"}, "funds":[]} -}`, - }, - "MsgExecuteContract": { - src: &MsgExecuteContract{Msg: RawContractMessage(myInnerMsg)}, - exp: ` -{ - "type":"wasm/MsgExecuteContract", - "value": {"msg": {"foo":"bar"}, "funds":[]} -}`, - }, - "MsgMigrateContract": { - src: &MsgMigrateContract{Msg: RawContractMessage(myInnerMsg)}, - exp: ` -{ - "type":"wasm/MsgMigrateContract", - "value": {"msg": {"foo":"bar"}} -}`, - }, - } - for name, spec := range specs { - t.Run(name, func(t *testing.T) { - bz := spec.src.GetSignBytes() - assert.JSONEq(t, spec.exp, string(bz), "raw: %s", string(bz)) - }) - } -} - func TestMsgUpdateInstantiateConfig(t *testing.T) { // proper address size goodAddress := sdk.AccAddress(make([]byte, 20)).String() @@ -1191,7 +1153,7 @@ func TestMsgStoreAndInstantiateContractValidation(t *testing.T) { Authority: goodAddress, Label: "foo", Msg: []byte(`{"some": "data"}`), - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(200)}}, WASMByteCode: []byte("foo"), InstantiatePermission: &AllowEverybody, UnpinCode: true, @@ -1242,7 +1204,7 @@ func TestMsgStoreAndInstantiateContractValidation(t *testing.T) { Label: "foo", Msg: []byte(`{"some": "data"}`), // we cannot use sdk.NewCoin() constructors as they panic on creating invalid data (before we can test) - Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(-200)}}, + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdkmath.NewInt(-200)}}, WASMByteCode: []byte("foo"), }, valid: false, diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go index fdf390cf86..4b2a83e0d9 100644 --- a/x/wasm/types/types.go +++ b/x/wasm/types/types.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cosmos/gogoproto/proto" errorsmod "cosmossdk.io/errors" @@ -281,7 +281,7 @@ func NewEnv(ctx sdk.Context, contractAddr sdk.AccAddress) wasmvmtypes.Env { env := wasmvmtypes.Env{ Block: wasmvmtypes.BlockInfo{ Height: uint64(ctx.BlockHeight()), - Time: uint64(nano), + Time: wasmvmtypes.Uint64(nano), ChainID: ctx.ChainID(), }, Contract: wasmvmtypes.ContractInfo{ diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go index b953a82c6f..0f797a6827 100644 --- a/x/wasm/types/types.pb.go +++ b/x/wasm/types/types.pb.go @@ -6,21 +6,24 @@ package types import ( bytes "bytes" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -107,9 +110,11 @@ func (*AccessTypeParam) ProtoMessage() {} func (*AccessTypeParam) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{0} } + func (m *AccessTypeParam) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AccessTypeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessTypeParam.Marshal(b, m, deterministic) @@ -122,12 +127,15 @@ func (m *AccessTypeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *AccessTypeParam) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessTypeParam.Merge(m, src) } + func (m *AccessTypeParam) XXX_Size() int { return m.Size() } + func (m *AccessTypeParam) XXX_DiscardUnknown() { xxx_messageInfo_AccessTypeParam.DiscardUnknown(m) } @@ -137,7 +145,7 @@ var xxx_messageInfo_AccessTypeParam proto.InternalMessageInfo // AccessConfig access control type. type AccessConfig struct { Permission AccessType `protobuf:"varint,1,opt,name=permission,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"permission,omitempty" yaml:"permission"` - Addresses []string `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty" yaml:"addresses"` + Addresses []string `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty"` } func (m *AccessConfig) Reset() { *m = AccessConfig{} } @@ -146,9 +154,11 @@ func (*AccessConfig) ProtoMessage() {} func (*AccessConfig) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{1} } + func (m *AccessConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AccessConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessConfig.Marshal(b, m, deterministic) @@ -161,12 +171,15 @@ func (m *AccessConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *AccessConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessConfig.Merge(m, src) } + func (m *AccessConfig) XXX_Size() int { return m.Size() } + func (m *AccessConfig) XXX_DiscardUnknown() { xxx_messageInfo_AccessConfig.DiscardUnknown(m) } @@ -184,9 +197,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{2} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -199,12 +214,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -227,9 +245,11 @@ func (*CodeInfo) ProtoMessage() {} func (*CodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{3} } + func (m *CodeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfo.Marshal(b, m, deterministic) @@ -242,12 +262,15 @@ func (m *CodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *CodeInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfo.Merge(m, src) } + func (m *CodeInfo) XXX_Size() int { return m.Size() } + func (m *CodeInfo) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfo.DiscardUnknown(m) } @@ -278,9 +301,11 @@ func (*ContractInfo) ProtoMessage() {} func (*ContractInfo) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{4} } + func (m *ContractInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractInfo.Marshal(b, m, deterministic) @@ -293,12 +318,15 @@ func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *ContractInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractInfo.Merge(m, src) } + func (m *ContractInfo) XXX_Size() int { return m.Size() } + func (m *ContractInfo) XXX_DiscardUnknown() { xxx_messageInfo_ContractInfo.DiscardUnknown(m) } @@ -321,9 +349,11 @@ func (*ContractCodeHistoryEntry) ProtoMessage() {} func (*ContractCodeHistoryEntry) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{5} } + func (m *ContractCodeHistoryEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ContractCodeHistoryEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractCodeHistoryEntry.Marshal(b, m, deterministic) @@ -336,12 +366,15 @@ func (m *ContractCodeHistoryEntry) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *ContractCodeHistoryEntry) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractCodeHistoryEntry.Merge(m, src) } + func (m *ContractCodeHistoryEntry) XXX_Size() int { return m.Size() } + func (m *ContractCodeHistoryEntry) XXX_DiscardUnknown() { xxx_messageInfo_ContractCodeHistoryEntry.DiscardUnknown(m) } @@ -364,9 +397,11 @@ func (*AbsoluteTxPosition) ProtoMessage() {} func (*AbsoluteTxPosition) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{6} } + func (m *AbsoluteTxPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AbsoluteTxPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AbsoluteTxPosition.Marshal(b, m, deterministic) @@ -379,12 +414,15 @@ func (m *AbsoluteTxPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *AbsoluteTxPosition) XXX_Merge(src proto.Message) { xxx_messageInfo_AbsoluteTxPosition.Merge(m, src) } + func (m *AbsoluteTxPosition) XXX_Size() int { return m.Size() } + func (m *AbsoluteTxPosition) XXX_DiscardUnknown() { xxx_messageInfo_AbsoluteTxPosition.DiscardUnknown(m) } @@ -405,9 +443,11 @@ func (*Model) ProtoMessage() {} func (*Model) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{7} } + func (m *Model) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Model.Marshal(b, m, deterministic) @@ -420,12 +460,15 @@ func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Model) XXX_Merge(src proto.Message) { xxx_messageInfo_Model.Merge(m, src) } + func (m *Model) XXX_Size() int { return m.Size() } + func (m *Model) XXX_DiscardUnknown() { xxx_messageInfo_Model.DiscardUnknown(m) } @@ -448,80 +491,82 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/types.proto", fileDescriptor_e6155d98fa173e02) } var fileDescriptor_e6155d98fa173e02 = []byte{ - // 1167 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xda, 0x4e, 0x62, 0x4f, 0x03, 0x6c, 0x87, 0x94, 0x3a, 0x26, 0xb2, 0xcd, 0x52, 0x4a, - 0x9a, 0xb6, 0x76, 0x1b, 0x10, 0x87, 0x1e, 0x2a, 0x79, 0xed, 0x6d, 0xb3, 0x95, 0x62, 0x5b, 0x63, - 0x97, 0x12, 0xa4, 0xb2, 0xda, 0x1f, 0x63, 0x67, 0x55, 0x7b, 0xc7, 0xda, 0x19, 0xa7, 0xde, 0xff, - 0x00, 0x59, 0x42, 0xe2, 0xc0, 0x81, 0x8b, 0x25, 0xa4, 0x22, 0xe8, 0x91, 0x03, 0x7f, 0x44, 0xc5, - 0x01, 0xf5, 0xc8, 0xc9, 0x82, 0xf4, 0x00, 0xe7, 0x1c, 0x38, 0x94, 0x0b, 0xda, 0x99, 0xb8, 0xbb, - 0xa2, 0x4d, 0x63, 0x2e, 0xab, 0x99, 0xf7, 0xde, 0xf7, 0xcd, 0x37, 0xdf, 0xcc, 0x1b, 0x2d, 0xd8, - 0xb0, 0x09, 0x1d, 0x3c, 0x34, 0xe9, 0xa0, 0xc2, 0x3f, 0x07, 0xd7, 0x2b, 0x2c, 0x18, 0x62, 0x5a, - 0x1e, 0xfa, 0x84, 0x11, 0x28, 0xcf, 0xb3, 0x65, 0xfe, 0x39, 0xb8, 0x9e, 0x5f, 0x0f, 0x23, 0x84, - 0x1a, 0x3c, 0x5f, 0x11, 0x13, 0x51, 0x9c, 0x5f, 0xeb, 0x91, 0x1e, 0x11, 0xf1, 0x70, 0x74, 0x1c, - 0x5d, 0xef, 0x11, 0xd2, 0xeb, 0xe3, 0x0a, 0x9f, 0x59, 0xa3, 0x6e, 0xc5, 0xf4, 0x82, 0xe3, 0xd4, - 0x59, 0x73, 0xe0, 0x7a, 0xa4, 0xc2, 0xbf, 0x22, 0xa4, 0xdc, 0x07, 0x6f, 0x55, 0x6d, 0x1b, 0x53, - 0xda, 0x09, 0x86, 0xb8, 0x65, 0xfa, 0xe6, 0x00, 0xd6, 0xc1, 0xd2, 0x81, 0xd9, 0x1f, 0xe1, 0x9c, - 0x54, 0x92, 0x36, 0xdf, 0xdc, 0xde, 0x28, 0xff, 0x57, 0x53, 0x39, 0x42, 0xa8, 0xf2, 0xd1, 0xac, - 0xb8, 0x1a, 0x98, 0x83, 0xfe, 0x0d, 0x85, 0x83, 0x14, 0x24, 0xc0, 0x37, 0xd2, 0xdf, 0x7e, 0x57, - 0x94, 0x94, 0x47, 0x12, 0x58, 0x15, 0xd5, 0x35, 0xe2, 0x75, 0xdd, 0x1e, 0x6c, 0x03, 0x30, 0xc4, - 0xfe, 0xc0, 0xa5, 0xd4, 0x25, 0xde, 0x42, 0x2b, 0x9c, 0x3b, 0x9a, 0x15, 0xcf, 0x8a, 0x15, 0x22, - 0xa4, 0x82, 0x62, 0x34, 0x70, 0x1b, 0x64, 0x4d, 0xc7, 0xf1, 0x31, 0xa5, 0x98, 0xe6, 0x52, 0xa5, - 0xd4, 0x66, 0x56, 0x5d, 0x3b, 0x9a, 0x15, 0x65, 0x81, 0x7a, 0x91, 0x52, 0x50, 0x54, 0x26, 0xf4, - 0xdd, 0x49, 0x67, 0x92, 0x72, 0x4a, 0xf9, 0x26, 0x09, 0x96, 0xf9, 0xde, 0x29, 0x64, 0x00, 0xda, - 0xc4, 0xc1, 0xc6, 0x68, 0xd8, 0x27, 0xa6, 0x63, 0x98, 0x5c, 0x07, 0xd7, 0x79, 0x66, 0xbb, 0x70, - 0x92, 0x4e, 0xb1, 0x37, 0xf5, 0xe2, 0x93, 0x59, 0x31, 0x71, 0x34, 0x2b, 0xae, 0x8b, 0x75, 0x5f, - 0xe6, 0x51, 0x1e, 0xff, 0xf9, 0xd3, 0x96, 0x84, 0xe4, 0x30, 0x73, 0x97, 0x27, 0x04, 0x1e, 0x7e, - 0x25, 0x81, 0x82, 0xeb, 0x51, 0x66, 0x7a, 0xcc, 0x35, 0x19, 0x36, 0x1c, 0xdc, 0x35, 0x47, 0x7d, - 0x66, 0xc4, 0xac, 0x4a, 0x2e, 0x60, 0xd5, 0xa5, 0xa3, 0x59, 0xf1, 0x03, 0xb1, 0xf8, 0xeb, 0xd9, - 0x14, 0xb4, 0x11, 0x2b, 0xa8, 0x8b, 0x7c, 0xeb, 0x45, 0x9a, 0x9b, 0x93, 0x50, 0x7e, 0x94, 0x40, - 0xa6, 0x46, 0x1c, 0xac, 0x7b, 0x5d, 0x02, 0xdf, 0x05, 0x59, 0xbe, 0xa1, 0x7d, 0x93, 0xee, 0x73, - 0x3f, 0x56, 0x51, 0x26, 0x0c, 0xec, 0x98, 0x74, 0x1f, 0xe6, 0xc0, 0x8a, 0xed, 0x63, 0x93, 0x11, - 0x9f, 0xeb, 0xcc, 0xa2, 0xf9, 0x14, 0x7e, 0x06, 0x60, 0x5c, 0x8a, 0xcd, 0x9d, 0xca, 0x2d, 0x2d, - 0xe4, 0x67, 0x36, 0xf4, 0x53, 0x58, 0x76, 0x36, 0x46, 0x22, 0xb2, 0x77, 0xd2, 0x99, 0x94, 0x9c, - 0xbe, 0x93, 0xce, 0xa4, 0xe5, 0x25, 0xe5, 0xd7, 0x24, 0x58, 0xad, 0x11, 0x8f, 0xf9, 0xa6, 0xcd, - 0xb8, 0xda, 0xf7, 0xc1, 0x0a, 0x57, 0xeb, 0x3a, 0x5c, 0x6b, 0x5a, 0x05, 0x87, 0xb3, 0xe2, 0x32, - 0xdf, 0x4c, 0x1d, 0x2d, 0x87, 0x29, 0xdd, 0x79, 0x8d, 0xea, 0x35, 0xb0, 0x64, 0x3a, 0x03, 0xd7, - 0xcb, 0xa5, 0x78, 0x5c, 0x4c, 0xc2, 0x68, 0xdf, 0xb4, 0x70, 0x3f, 0x97, 0x16, 0x51, 0x3e, 0x81, - 0x37, 0x8f, 0x59, 0xb0, 0x73, 0xbc, 0xad, 0x0b, 0xaf, 0xd8, 0x96, 0x45, 0x49, 0x7f, 0xc4, 0x70, - 0x67, 0xdc, 0x22, 0xd4, 0x65, 0x2e, 0xf1, 0xd0, 0x1c, 0x04, 0xaf, 0x82, 0x33, 0xae, 0x65, 0x1b, - 0x43, 0xe2, 0xb3, 0x50, 0xee, 0x72, 0xc8, 0xad, 0xbe, 0x71, 0x38, 0x2b, 0x66, 0x75, 0xb5, 0xd6, - 0x22, 0x3e, 0xd3, 0xeb, 0x28, 0xeb, 0x5a, 0x36, 0x1f, 0x3a, 0xf0, 0x0b, 0x90, 0xc5, 0x63, 0x86, - 0x3d, 0x7e, 0x29, 0x56, 0xf8, 0x82, 0x6b, 0x65, 0xd1, 0xf2, 0xe5, 0x79, 0xcb, 0x97, 0xab, 0x5e, - 0xa0, 0x6e, 0xfd, 0xf2, 0xf3, 0xd5, 0x8b, 0x2f, 0x29, 0x89, 0xbb, 0xa4, 0xcd, 0x79, 0x50, 0x44, - 0x79, 0x23, 0xfd, 0x57, 0xd8, 0xb7, 0xff, 0x48, 0x20, 0x37, 0x2f, 0x0d, 0x5d, 0xdb, 0x71, 0x29, - 0x23, 0x7e, 0xa0, 0x79, 0xcc, 0x0f, 0x60, 0x0b, 0x64, 0xc9, 0x10, 0xfb, 0x26, 0x8b, 0x5a, 0x78, - 0xbb, 0x7c, 0xe2, 0x4a, 0x31, 0x78, 0x73, 0x8e, 0x0a, 0x6f, 0x2b, 0x8a, 0x48, 0xe2, 0xc7, 0x95, - 0x3c, 0xf1, 0xb8, 0x6e, 0x82, 0x95, 0xd1, 0xd0, 0xe1, 0x46, 0xa7, 0xfe, 0x8f, 0xd1, 0xc7, 0x20, - 0xb8, 0x09, 0x52, 0x03, 0xda, 0xe3, 0x87, 0xb7, 0xaa, 0xbe, 0xf3, 0x7c, 0x56, 0x84, 0xc8, 0x7c, - 0x38, 0x57, 0xb9, 0x8b, 0x29, 0x35, 0x7b, 0x18, 0x85, 0x25, 0x0a, 0x02, 0xf0, 0x65, 0x22, 0xf8, - 0x1e, 0x58, 0xb5, 0xfa, 0xc4, 0x7e, 0x60, 0xec, 0x63, 0xb7, 0xb7, 0xcf, 0xc4, 0xc5, 0x42, 0x67, - 0x78, 0x6c, 0x87, 0x87, 0xe0, 0x3a, 0xc8, 0xb0, 0xb1, 0xe1, 0x7a, 0x0e, 0x1e, 0x8b, 0x8d, 0xa0, - 0x15, 0x36, 0xd6, 0xc3, 0xa9, 0x82, 0xc1, 0xd2, 0x2e, 0x71, 0x70, 0x1f, 0xde, 0x02, 0xa9, 0x07, - 0x38, 0x10, 0x2d, 0xa4, 0x7e, 0xfc, 0x7c, 0x56, 0xbc, 0xd6, 0x73, 0xd9, 0xfe, 0xc8, 0x2a, 0xdb, - 0x64, 0x50, 0xb1, 0xc9, 0x00, 0x33, 0xab, 0xcb, 0xa2, 0x41, 0xdf, 0xb5, 0x68, 0xc5, 0x0a, 0x18, - 0xa6, 0xe5, 0x1d, 0x3c, 0x56, 0xc3, 0x01, 0x0a, 0x09, 0xc2, 0xdb, 0x28, 0x9e, 0xe9, 0x24, 0x6f, - 0x46, 0x31, 0xd9, 0xfa, 0x5b, 0x02, 0x20, 0x7a, 0x11, 0xe0, 0x27, 0xe0, 0x7c, 0xb5, 0x56, 0xd3, - 0xda, 0x6d, 0xa3, 0xb3, 0xd7, 0xd2, 0x8c, 0xbb, 0x8d, 0x76, 0x4b, 0xab, 0xe9, 0xb7, 0x74, 0xad, - 0x2e, 0x27, 0xf2, 0xeb, 0x93, 0x69, 0xe9, 0x5c, 0x54, 0x7c, 0xd7, 0xa3, 0x43, 0x6c, 0xbb, 0x5d, - 0x17, 0x3b, 0xf0, 0x0a, 0x80, 0x71, 0x5c, 0xa3, 0xa9, 0x36, 0xeb, 0x7b, 0xb2, 0x94, 0x5f, 0x9b, - 0x4c, 0x4b, 0x72, 0x04, 0x69, 0x10, 0x8b, 0x38, 0x01, 0xdc, 0x06, 0xe7, 0xe2, 0xd5, 0xda, 0xa7, - 0x1a, 0xda, 0xe3, 0x80, 0x54, 0xfe, 0xfc, 0x64, 0x5a, 0x7a, 0x3b, 0x02, 0x68, 0x07, 0xd8, 0x0f, - 0x38, 0xe6, 0x26, 0xd8, 0x88, 0x63, 0xaa, 0x8d, 0x3d, 0xa3, 0x79, 0xcb, 0xa8, 0xd6, 0xeb, 0x48, - 0x6b, 0xb7, 0xb5, 0xb6, 0x9c, 0xce, 0x6f, 0x4c, 0xa6, 0xa5, 0x5c, 0x04, 0xad, 0x7a, 0x41, 0xb3, - 0x5b, 0x9d, 0xbf, 0xdf, 0xf9, 0xcc, 0x97, 0x8f, 0x0a, 0x89, 0xc7, 0xdf, 0x17, 0x12, 0x4a, 0xf8, - 0x86, 0x27, 0xb7, 0x7e, 0x48, 0x81, 0xd2, 0x69, 0x57, 0x0e, 0x62, 0x70, 0xad, 0xd6, 0x6c, 0x74, - 0x50, 0xb5, 0xd6, 0x31, 0x6a, 0xcd, 0xba, 0x66, 0xec, 0xe8, 0xed, 0x4e, 0x13, 0xed, 0x19, 0xcd, - 0x96, 0x86, 0xaa, 0x1d, 0xbd, 0xd9, 0x78, 0x95, 0x4f, 0x95, 0xc9, 0xb4, 0x74, 0xf9, 0x34, 0xee, - 0xb8, 0x7b, 0xf7, 0xc0, 0xa5, 0x85, 0x96, 0xd1, 0x1b, 0x7a, 0x47, 0x96, 0xf2, 0x9b, 0x93, 0x69, - 0xe9, 0xc2, 0x69, 0xfc, 0xba, 0xe7, 0x32, 0x78, 0x1f, 0x5c, 0x59, 0x88, 0x78, 0x57, 0xbf, 0x8d, - 0xaa, 0x1d, 0x4d, 0x4e, 0xe6, 0x2f, 0x4f, 0xa6, 0xa5, 0x0f, 0x4f, 0xe3, 0xde, 0x75, 0x7b, 0xbe, - 0xc9, 0xf0, 0xc2, 0xf4, 0xb7, 0xb5, 0x86, 0xd6, 0xd6, 0xdb, 0x72, 0x6a, 0x31, 0xfa, 0xdb, 0xd8, - 0xc3, 0xd4, 0xa5, 0xf9, 0x74, 0x78, 0x64, 0xea, 0xce, 0x93, 0x3f, 0x0a, 0x89, 0xc7, 0x87, 0x05, - 0xe9, 0xc9, 0x61, 0x41, 0x7a, 0x7a, 0x58, 0x90, 0x7e, 0x3f, 0x2c, 0x48, 0x5f, 0x3f, 0x2b, 0x24, - 0x9e, 0x3e, 0x2b, 0x24, 0x7e, 0x7b, 0x56, 0x48, 0x7c, 0x7e, 0x31, 0xd6, 0x10, 0x35, 0x42, 0x07, - 0xf7, 0xe6, 0x7f, 0x4b, 0x4e, 0x65, 0x2c, 0xfe, 0x9a, 0xf8, 0x2f, 0x93, 0xb5, 0xcc, 0xdf, 0xbb, - 0x8f, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x0e, 0x96, 0x9d, 0x53, 0x09, 0x00, 0x00, + // 1198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xf7, 0xda, 0x4e, 0x62, 0x4f, 0xf2, 0xfd, 0xb2, 0x1d, 0x52, 0xd5, 0x31, 0x91, 0x6d, 0x96, + 0x12, 0xda, 0xb4, 0xb5, 0xdb, 0x80, 0x2a, 0xd4, 0x43, 0x25, 0xff, 0xd8, 0x36, 0x5b, 0x29, 0xb6, + 0x35, 0x76, 0x29, 0x41, 0x2a, 0xab, 0xf5, 0xee, 0xd8, 0x19, 0x6a, 0xef, 0x58, 0x3b, 0xe3, 0xd4, + 0xbe, 0x72, 0x42, 0x46, 0x48, 0x1c, 0x38, 0x20, 0x24, 0x4b, 0x48, 0x20, 0xe8, 0xb1, 0x87, 0xfe, + 0x03, 0xdc, 0x2a, 0x4e, 0x15, 0x27, 0x4e, 0x16, 0xa4, 0x87, 0x72, 0xce, 0x81, 0x43, 0x4f, 0x68, + 0x67, 0x62, 0x76, 0x45, 0x9b, 0xc6, 0x70, 0x59, 0xcd, 0xbc, 0xf7, 0x3e, 0x9f, 0xf7, 0xde, 0x67, + 0x66, 0xdf, 0x2e, 0x58, 0xb7, 0x29, 0xeb, 0xdd, 0xb7, 0x58, 0xaf, 0x20, 0x1e, 0xfb, 0x57, 0x0a, + 0x7c, 0xd4, 0xc7, 0x2c, 0xdf, 0xf7, 0x28, 0xa7, 0x50, 0x9d, 0x79, 0xf3, 0xe2, 0xb1, 0x7f, 0x25, + 0xbd, 0xe6, 0x5b, 0x28, 0x33, 0x85, 0xbf, 0x20, 0x37, 0x32, 0x38, 0xbd, 0xda, 0xa1, 0x1d, 0x2a, + 0xed, 0xfe, 0xea, 0xc8, 0xba, 0xd6, 0xa1, 0xb4, 0xd3, 0xc5, 0x05, 0xb1, 0x6b, 0x0d, 0xda, 0x05, + 0xcb, 0x1d, 0x1d, 0xb9, 0x4e, 0x59, 0x3d, 0xe2, 0xd2, 0x82, 0x78, 0x4a, 0x93, 0x76, 0x17, 0xbc, + 0x56, 0xb4, 0x6d, 0xcc, 0x58, 0x73, 0xd4, 0xc7, 0x75, 0xcb, 0xb3, 0x7a, 0xb0, 0x02, 0x16, 0xf6, + 0xad, 0xee, 0x00, 0xa7, 0x94, 0x9c, 0x72, 0xee, 0xff, 0x5b, 0xeb, 0xf9, 0x7f, 0xd6, 0x94, 0x0f, + 0x10, 0x25, 0xf5, 0x70, 0x9a, 0x5d, 0x19, 0x59, 0xbd, 0xee, 0x35, 0x4d, 0x80, 0x34, 0x24, 0xc1, + 0xd7, 0xe2, 0x5f, 0x7f, 0x9b, 0x55, 0xb4, 0x1f, 0x15, 0xb0, 0x22, 0xa3, 0xcb, 0xd4, 0x6d, 0x93, + 0x0e, 0x6c, 0x00, 0xd0, 0xc7, 0x5e, 0x8f, 0x30, 0x46, 0xa8, 0x3b, 0x57, 0x86, 0xd3, 0x87, 0xd3, + 0xec, 0x29, 0x99, 0x21, 0x40, 0x6a, 0x28, 0x44, 0x03, 0xaf, 0x82, 0xa4, 0xe5, 0x38, 0x1e, 0x66, + 0x0c, 0xb3, 0x54, 0x2c, 0x17, 0x3b, 0x97, 0x2c, 0xa5, 0x7e, 0x79, 0x74, 0x69, 0xf5, 0x48, 0xad, + 0xa2, 0xf4, 0x35, 0xb8, 0x47, 0xdc, 0x0e, 0x0a, 0x42, 0x65, 0x8d, 0xb7, 0xe2, 0x89, 0xa8, 0x1a, + 0xd3, 0xbe, 0x8a, 0x82, 0x45, 0xd1, 0x3f, 0x83, 0x1c, 0x40, 0x9b, 0x3a, 0xd8, 0x1c, 0xf4, 0xbb, + 0xd4, 0x72, 0x4c, 0x4b, 0xd4, 0x22, 0x6a, 0x5d, 0xde, 0xca, 0x1c, 0x57, 0xab, 0xec, 0xaf, 0xb4, + 0xf1, 0x78, 0x9a, 0x8d, 0x1c, 0x4e, 0xb3, 0x6b, 0xb2, 0xe2, 0x17, 0x79, 0xb4, 0x07, 0xcf, 0x1e, + 0x6e, 0x2a, 0x48, 0xf5, 0x3d, 0xb7, 0x85, 0x43, 0xe2, 0xe1, 0x17, 0x0a, 0xc8, 0x10, 0x97, 0x71, + 0xcb, 0xe5, 0xc4, 0xe2, 0xd8, 0x74, 0x70, 0xdb, 0x1a, 0x74, 0xb9, 0x19, 0x92, 0x2b, 0x3a, 0x87, + 0x5c, 0xe7, 0x0f, 0xa7, 0xd9, 0xb7, 0x65, 0xf2, 0x57, 0xb3, 0x69, 0x68, 0x3d, 0x14, 0x50, 0x91, + 0xfe, 0xfa, 0xdf, 0x6e, 0x21, 0x4e, 0x44, 0xfb, 0x49, 0x01, 0x89, 0x32, 0x75, 0xb0, 0xe1, 0xb6, + 0x29, 0x7c, 0x03, 0x24, 0x45, 0x43, 0x7b, 0x16, 0xdb, 0x13, 0x7a, 0xac, 0xa0, 0x84, 0x6f, 0xd8, + 0xb6, 0xd8, 0x1e, 0xdc, 0x02, 0x4b, 0xb6, 0x87, 0x2d, 0x4e, 0x3d, 0x51, 0xe7, 0xab, 0x8e, 0x60, + 0x16, 0x08, 0x3f, 0x04, 0x30, 0x5c, 0xa4, 0x2d, 0x34, 0x4c, 0x2d, 0xcc, 0xa5, 0x74, 0xd2, 0x57, + 0x5a, 0x8a, 0x79, 0x2a, 0x44, 0x22, 0xbd, 0xb7, 0xe2, 0x89, 0x98, 0x1a, 0xbf, 0x15, 0x4f, 0xc4, + 0xd5, 0x05, 0xed, 0xd3, 0x18, 0x58, 0x29, 0x53, 0x97, 0x7b, 0x96, 0xcd, 0x45, 0x1f, 0x6f, 0x81, + 0x25, 0xd1, 0x07, 0x71, 0x44, 0x17, 0xf1, 0x12, 0x38, 0x98, 0x66, 0x17, 0x45, 0x9b, 0x15, 0xb4, + 0xe8, 0xbb, 0x0c, 0xe7, 0x3f, 0xf5, 0x93, 0x07, 0x0b, 0x96, 0xd3, 0x23, 0x6e, 0x2a, 0x76, 0x02, + 0x42, 0x86, 0xc1, 0x55, 0xb0, 0xd0, 0xb5, 0x5a, 0xb8, 0x9b, 0x8a, 0xfb, 0xf1, 0x48, 0x6e, 0xe0, + 0xf5, 0xa3, 0xcc, 0xd8, 0x39, 0x92, 0xe2, 0xec, 0x4b, 0xa4, 0x68, 0x31, 0xda, 0x1d, 0x70, 0xdc, + 0x1c, 0xd6, 0x29, 0x23, 0x9c, 0x50, 0x17, 0xcd, 0x40, 0xf0, 0x12, 0x58, 0x26, 0x2d, 0xdb, 0xec, + 0x53, 0x8f, 0xfb, 0x2d, 0x2e, 0x8a, 0x5a, 0xfe, 0x77, 0x30, 0xcd, 0x26, 0x8d, 0x52, 0xb9, 0x4e, + 0x3d, 0x6e, 0x54, 0x50, 0x92, 0xb4, 0x6c, 0xb1, 0x74, 0xe0, 0xc7, 0x20, 0x89, 0x87, 0x1c, 0xbb, + 0xe2, 0x8a, 0x2d, 0x89, 0x84, 0xab, 0x79, 0x39, 0x44, 0xf2, 0xb3, 0x21, 0x92, 0x2f, 0xba, 0xa3, + 0xd2, 0xe6, 0xcf, 0x8f, 0x2e, 0x6d, 0xbc, 0x50, 0x49, 0x58, 0x59, 0x7d, 0xc6, 0x83, 0x02, 0xca, + 0x6b, 0xf1, 0x3f, 0xfc, 0x49, 0xf0, 0x79, 0x14, 0xa4, 0x66, 0xa1, 0xbe, 0xd2, 0xdb, 0x84, 0x71, + 0xea, 0x8d, 0x74, 0x97, 0x7b, 0x23, 0x58, 0x07, 0x49, 0xda, 0xc7, 0x9e, 0xc5, 0x83, 0xa1, 0xb0, + 0x95, 0x3f, 0x36, 0x53, 0x08, 0x5e, 0x9b, 0xa1, 0xfc, 0xbb, 0x8f, 0x02, 0x92, 0xf0, 0x11, 0x47, + 0x8f, 0x3d, 0xe2, 0xeb, 0x60, 0x69, 0xd0, 0x77, 0x84, 0xd0, 0xb1, 0x7f, 0x23, 0xf4, 0x11, 0x08, + 0xbe, 0x0f, 0x62, 0x3d, 0xd6, 0x11, 0x87, 0xb7, 0x52, 0xda, 0x78, 0x3e, 0xcd, 0x42, 0x64, 0xdd, + 0x9f, 0x55, 0xb9, 0x83, 0x19, 0xb3, 0x3a, 0xf8, 0x9b, 0x67, 0x0f, 0x37, 0x97, 0x89, 0xdb, 0x25, + 0x2e, 0x36, 0x3f, 0x61, 0xd4, 0x45, 0x3e, 0x44, 0x43, 0x00, 0xbe, 0x48, 0x0c, 0xdf, 0x04, 0x2b, + 0xad, 0x2e, 0xb5, 0xef, 0x99, 0x7b, 0x98, 0x74, 0xf6, 0xb8, 0xbc, 0x9c, 0x68, 0x59, 0xd8, 0xb6, + 0x85, 0x09, 0xae, 0x81, 0x04, 0x1f, 0x9a, 0xc4, 0x75, 0xf0, 0x50, 0x36, 0x86, 0x96, 0xf8, 0xd0, + 0xf0, 0xb7, 0x1a, 0x06, 0x0b, 0x3b, 0xd4, 0xc1, 0x5d, 0x78, 0x03, 0xc4, 0xee, 0xe1, 0x91, 0x7c, + 0x41, 0x4b, 0xef, 0x3d, 0x9f, 0x66, 0x2f, 0x77, 0x08, 0xdf, 0x1b, 0xb4, 0xf2, 0x36, 0xed, 0x15, + 0x6c, 0xda, 0xc3, 0xbc, 0xd5, 0xe6, 0xc1, 0xa2, 0x4b, 0x5a, 0xac, 0xd0, 0x1a, 0x71, 0xcc, 0xf2, + 0xdb, 0x78, 0x58, 0xf2, 0x17, 0xc8, 0x27, 0xf0, 0x6f, 0xa7, 0xfc, 0x10, 0x44, 0xc5, 0xab, 0x2e, + 0x37, 0x9b, 0x7f, 0x2a, 0x00, 0x04, 0xf3, 0x06, 0x5e, 0x05, 0x67, 0x8a, 0xe5, 0xb2, 0xde, 0x68, + 0x98, 0xcd, 0xdd, 0xba, 0x6e, 0xde, 0xae, 0x36, 0xea, 0x7a, 0xd9, 0xb8, 0x61, 0xe8, 0x15, 0x35, + 0x92, 0x5e, 0x1b, 0x4f, 0x72, 0xa7, 0x83, 0xe0, 0xdb, 0x2e, 0xeb, 0x63, 0x9b, 0xb4, 0x09, 0x76, + 0xe0, 0x45, 0x00, 0xc3, 0xb8, 0x6a, 0xad, 0x54, 0xab, 0xec, 0xaa, 0x4a, 0x7a, 0x75, 0x3c, 0xc9, + 0xa9, 0x01, 0xa4, 0x4a, 0x5b, 0xd4, 0x19, 0xc1, 0x2d, 0x70, 0x3a, 0x1c, 0xad, 0x7f, 0xa0, 0xa3, + 0x5d, 0x01, 0x88, 0xa5, 0xcf, 0x8c, 0x27, 0xb9, 0xd7, 0x03, 0x80, 0xbe, 0x8f, 0xbd, 0x91, 0xc0, + 0x5c, 0x07, 0xeb, 0x61, 0x4c, 0xb1, 0xba, 0x6b, 0xd6, 0x6e, 0x98, 0xc5, 0x4a, 0x05, 0xe9, 0x8d, + 0x86, 0xde, 0x50, 0xe3, 0xe9, 0xf5, 0xf1, 0x24, 0x97, 0x0a, 0xa0, 0x45, 0x77, 0x54, 0x6b, 0x17, + 0x67, 0x5f, 0x87, 0x74, 0xe2, 0xb3, 0xef, 0x32, 0x91, 0x07, 0xdf, 0x67, 0x22, 0x9a, 0xff, 0x85, + 0x88, 0x6e, 0xfe, 0x10, 0x03, 0xb9, 0x93, 0xae, 0x20, 0xc4, 0xe0, 0x72, 0xb9, 0x56, 0x6d, 0xa2, + 0x62, 0xb9, 0x69, 0x96, 0x6b, 0x15, 0xdd, 0xdc, 0x36, 0x1a, 0xcd, 0x1a, 0xda, 0x35, 0x6b, 0x75, + 0x1d, 0x15, 0x9b, 0x46, 0xad, 0xfa, 0x32, 0x9d, 0x0a, 0xe3, 0x49, 0xee, 0xc2, 0x49, 0xdc, 0x61, + 0xf5, 0xee, 0x80, 0xf3, 0x73, 0xa5, 0x31, 0xaa, 0x46, 0x53, 0x55, 0xd2, 0xe7, 0xc6, 0x93, 0xdc, + 0xd9, 0x93, 0xf8, 0x0d, 0x97, 0x70, 0x78, 0x17, 0x5c, 0x9c, 0x8b, 0x78, 0xc7, 0xb8, 0x89, 0x8a, + 0x4d, 0x5d, 0x8d, 0xa6, 0x2f, 0x8c, 0x27, 0xb9, 0x77, 0x4e, 0xe2, 0xde, 0x21, 0x1d, 0xcf, 0xe2, + 0x78, 0x6e, 0xfa, 0x9b, 0x7a, 0x55, 0x6f, 0x18, 0x0d, 0x35, 0x36, 0x1f, 0xfd, 0x4d, 0xec, 0x62, + 0x46, 0x58, 0x3a, 0xee, 0x1f, 0x59, 0x69, 0xfb, 0xf1, 0xef, 0x99, 0xc8, 0x83, 0x83, 0x8c, 0xf2, + 0xf8, 0x20, 0xa3, 0x3c, 0x39, 0xc8, 0x28, 0xbf, 0x1d, 0x64, 0x94, 0x2f, 0x9f, 0x66, 0x22, 0x4f, + 0x9e, 0x66, 0x22, 0xbf, 0x3e, 0xcd, 0x44, 0x3e, 0xda, 0x08, 0xbd, 0x10, 0x65, 0xca, 0x7a, 0x77, + 0x66, 0xff, 0x63, 0x4e, 0x61, 0x28, 0xff, 0xcb, 0xc4, 0x4f, 0x59, 0x6b, 0x51, 0xcc, 0xbf, 0x77, + 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xba, 0x63, 0x50, 0xbd, 0xb5, 0x09, 0x00, 0x00, } func (this *AccessTypeParam) Equal(that interface{}) bool { @@ -548,6 +593,7 @@ func (this *AccessTypeParam) Equal(that interface{}) bool { } return true } + func (this *AccessConfig) Equal(that interface{}) bool { if that == nil { return this == nil @@ -580,6 +626,7 @@ func (this *AccessConfig) Equal(that interface{}) bool { } return true } + func (this *Params) Equal(that interface{}) bool { if that == nil { return this == nil @@ -607,6 +654,7 @@ func (this *Params) Equal(that interface{}) bool { } return true } + func (this *CodeInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -637,6 +685,7 @@ func (this *CodeInfo) Equal(that interface{}) bool { } return true } + func (this *ContractInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -679,6 +728,7 @@ func (this *ContractInfo) Equal(that interface{}) bool { } return true } + func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { if that == nil { return this == nil @@ -712,6 +762,7 @@ func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { } return true } + func (this *AbsoluteTxPosition) Equal(that interface{}) bool { if that == nil { return this == nil @@ -739,6 +790,7 @@ func (this *AbsoluteTxPosition) Equal(that interface{}) bool { } return true } + func (this *Model) Equal(that interface{}) bool { if that == nil { return this == nil @@ -766,6 +818,7 @@ func (this *Model) Equal(that interface{}) bool { } return true } + func (m *AccessTypeParam) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1129,6 +1182,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *AccessTypeParam) Size() (n int) { if m == nil { return 0 @@ -1286,9 +1340,11 @@ func (m *Model) Size() (n int) { func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1358,6 +1414,7 @@ func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { } return nil } + func (m *AccessConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1459,6 +1516,7 @@ func (m *AccessConfig) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1561,6 +1619,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func (m *CodeInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1710,6 +1769,7 @@ func (m *CodeInfo) Unmarshal(dAtA []byte) error { } return nil } + func (m *ContractInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1979,6 +2039,7 @@ func (m *ContractInfo) Unmarshal(dAtA []byte) error { } return nil } + func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2137,6 +2198,7 @@ func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { } return nil } + func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2225,6 +2287,7 @@ func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { } return nil } + func (m *Model) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2343,6 +2406,7 @@ func (m *Model) Unmarshal(dAtA []byte) error { } return nil } + func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/types_test.go b/x/wasm/types/types_test.go index 0734937eef..d00cf5ca3a 100644 --- a/x/wasm/types/types_test.go +++ b/x/wasm/types/types_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cometbft/cometbft/libs/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/types/validation.go b/x/wasm/types/validation.go index cbdeb77d57..bd67e3bc26 100644 --- a/x/wasm/types/validation.go +++ b/x/wasm/types/validation.go @@ -6,7 +6,7 @@ import ( "strings" "unicode" - "github.com/docker/distribution/reference" + "github.com/distribution/reference" errorsmod "cosmossdk.io/errors" ) diff --git a/x/wasm/types/wasmer_engine.go b/x/wasm/types/wasmer_engine.go index d3b465de77..f3829e9146 100644 --- a/x/wasm/types/wasmer_engine.go +++ b/x/wasm/types/wasmer_engine.go @@ -1,10 +1,10 @@ package types import ( - wasmvm "github.com/CosmWasm/wasmvm" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvm "github.com/CosmWasm/wasmvm/v2" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" ) // DefaultMaxQueryStackSize maximum size of the stack of contract instances doing queries @@ -12,30 +12,20 @@ const DefaultMaxQueryStackSize uint32 = 10 // WasmEngine defines the WASM contract runtime engine. type WasmEngine interface { - // Create will compile the wasm code, and store the resulting pre-compile - // as well as the original code. Both can be referenced later via CodeID + // StoreCode will compile the Wasm code, and store the resulting compiled module + // as well as the original code. Both can be referenced later via Checksum. // This must be done one time for given code, after which it can be - // instatitated many times, and each instance called many times. + // instantiated many times, and each instance called many times. // - // For example, the code for all ERC-20 contracts should be the same. - // This function stores the code for that contract only once, but it can - // be instantiated with custom inputs in the future. - // - // Deprecated: use StoreCode instead. - Create(code wasmvm.WasmCode) (wasmvm.Checksum, error) - - // Create will compile the wasm code, and store the resulting pre-compile - // as well as the original code. Both can be referenced later via checksum - // This must be done one time for given code, after which it can be - // instatitated many times, and each instance called many times. - // It does the same as StoreCodeUnchecked plus the static checks. - StoreCode(code wasmvm.WasmCode) (wasmvm.Checksum, error) + // Returns both the checksum, as well as the gas cost of compilation (in CosmWasm Gas) or an error. + StoreCode(code wasmvm.WasmCode, gasLimit uint64) (wasmvm.Checksum, uint64, error) - // Create will compile the wasm code, and store the resulting pre-compile + // StoreCodeUnchecked will compile the wasm code, and store the resulting pre-compile // as well as the original code. Both can be referenced later via checksum // This must be done one time for given code, after which it can be - // instatitated many times, and each instance called many times. + // instantiated many times, and each instance called many times. // It does the same as StoreCode but without the static checks. + // Use this for adding code that was checked before, particularly in the case of state sync. StoreCodeUnchecked(code wasmvm.WasmCode) (wasmvm.Checksum, error) // AnalyzeCode will statically analyze the code. @@ -61,7 +51,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) // Execute calls a given contract. Since the only difference between contracts with the same CodeID is the // data in their local storage, and their address in the outside world, we need no ContractID here. @@ -80,7 +70,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) // Query allows a client to execute a contract-specific query. If the result is not empty, it should be // valid json-encoded data to return to the client. @@ -95,7 +85,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) ([]byte, uint64, error) + ) (*wasmvmtypes.QueryResult, uint64, error) // Migrate will migrate an existing contract to a new code binary. // This takes storage of the data from the original contract and the CodeID of the new contract that should @@ -113,7 +103,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) // Sudo runs an existing contract in read/write mode (like Execute), but is never exposed to external callers // (either transactions or government proposals), but can only be called by other native Go modules directly. @@ -130,7 +120,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) // Reply is called on the original dispatching contract after running a submessage Reply( @@ -143,7 +133,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.Response, uint64, error) + ) (*wasmvmtypes.ContractResult, uint64, error) // GetCode will load the original wasm code for the given code id. // This will only succeed if that code id was previously returned from @@ -169,7 +159,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) + ) (*wasmvmtypes.IBCChannelOpenResult, uint64, error) // IBCChannelConnect is available on IBC-enabled contracts and is a hook to call into // during the handshake phase @@ -183,7 +173,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) // IBCChannelClose is available on IBC-enabled contracts and is a hook to call into // at the end of the channel lifetime @@ -197,7 +187,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) // IBCPacketReceive is available on IBC-enabled contracts and is called when an incoming // packet is received on a channel belonging to this contract @@ -226,7 +216,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) // IBCPacketTimeout is available on IBC-enabled contracts and is called when an // outgoing packet (previously sent by this contract) will probably never be executed. @@ -241,7 +231,7 @@ type WasmEngine interface { gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction, - ) (*wasmvmtypes.IBCBasicResponse, uint64, error) + ) (*wasmvmtypes.IBCBasicResult, uint64, error) // Pin pins a code to an in-memory cache, such that is // always loaded quickly when executed. @@ -262,11 +252,11 @@ var _ wasmvm.KVStore = &StoreAdapter{} // StoreAdapter adapter to bridge SDK store impl to wasmvm type StoreAdapter struct { - parent sdk.KVStore + parent storetypes.KVStore } // NewStoreAdapter constructor -func NewStoreAdapter(s sdk.KVStore) *StoreAdapter { +func NewStoreAdapter(s storetypes.KVStore) *StoreAdapter { if s == nil { panic("store must not be nil") }