diff --git a/.circleci/config.yml b/.circleci/config.yml index b658e762e..9b226efb9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,8 +3,7 @@ version: 2.1 executors: golang: docker: - - image: circleci/golang:1.17 - working_directory: /go/src/github.com/cosmwasm/wasmd + - image: cimg/go:1.18 commands: make: @@ -163,14 +162,27 @@ jobs: name: Build Docker artifact command: docker build --pull -t "cosmwasm/wasmd:${CIRCLE_SHA1}" . - run: - name: Push application Docker image to docker hub + name: Ensure libwasmvm version is correct command: | - if [ "${CIRCLE_BRANCH}" = "master" ]; then - docker tag "cosmwasm/wasmd:${CIRCLE_SHA1}" cosmwasm/wasmd:latest - docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS" - docker push cosmwasm/wasmd:latest - docker logout + 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) + echo "wasmvm version in go.mod: $IN_GOMOD" + if [[ "$IN_DOCKER" != "$IN_GOMOD" ]]; then + echo "Mismatch of wasmvm versions detected" + exit 1 fi + - when: + condition: + equal: [ main, << pipeline.git.branch >> ] + steps: + - run: + name: Push application Docker image to docker hub + command: | + docker tag "cosmwasm/wasmd:${CIRCLE_SHA1}" cosmwasm/wasmd:latest + docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS" + docker push cosmwasm/wasmd:latest + docker logout docker-tagged: executor: golang @@ -195,14 +207,9 @@ workflows: version: 2 test-suite: jobs: - # this is now a slow process... let's only run on master - docker-image: requires: - setup-dependencies - filters: - branches: - only: - - master - docker-tagged: filters: tags: diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1c9557cc8..376c01233 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,10 @@ version: 2 -updates: +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 - package-ecosystem: gomod directory: "/" schedule: diff --git a/.github/workflows/codeql-analizer.yml b/.github/workflows/codeql-analizer.yml index 0232dc356..dd4a9c542 100644 --- a/.github/workflows/codeql-analizer.yml +++ b/.github/workflows/codeql-analizer.yml @@ -5,7 +5,7 @@ on: paths: - "**.go" push: - branches: [ master ] + branches: [ main ] paths: - "**.go" @@ -19,17 +19,17 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v3.0.2 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: 'go' queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/proto-buf-publisher.yml b/.github/workflows/proto-buf-publisher.yml index 7e000bc5b..454e49dda 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@v2 - - uses: bufbuild/buf-setup-action@v0.7.0 + - uses: actions/checkout@v3.0.2 + - uses: bufbuild/buf-setup-action@v1.7.0 # lint checks - uses: bufbuild/buf-lint-action@v1 diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..e5306c8dc --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,9 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) +# and commit this file to your remote git repository to share the goodness with others. + +tasks: + - init: go get && go build ./... && go test ./... && make + command: go run + + diff --git a/.golangci.yml b/.golangci.yml index 17d5384ea..d13088658 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,8 +11,7 @@ linters: - errcheck - goconst - gocritic - - gofmt - - goimports + - gofumpt - revive - gosec - gosimple @@ -23,7 +22,6 @@ linters: - prealloc - exportloopref - staticcheck - - structcheck - stylecheck - typecheck - unconvert diff --git a/CHANGELOG.md b/CHANGELOG.md index a71884661..176b032ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,58 @@ ## [Unreleased](https://github.com/CosmWasm/wasmd/tree/HEAD) -[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.27.0...HEAD) +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.29.0...HEAD) + +## [v0.29.0-rc1](https://github.com/CosmWasm/wasmd/tree/v0.29.0-rc1) (2022-09-22) + +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.28.0...v0.29.0-rc1) + +- Allow AccessConfig to use a list of addresses instead of just a single address [\#945](https://github.com/CosmWasm/wasmd/issues/945) +- Make contract addresses predictable \("deterministic"\) [\#942](https://github.com/CosmWasm/wasmd/issues/942) +- Add query for the total supply of a coin [\#903](https://github.com/CosmWasm/wasmd/pull/903) ([larry0x](https://github.com/larry0x)) +- Upgrade go to v1.18 [\#866]https://github.com/CosmWasm/wasmd/pull/866/) ([faddat](https://github.com/faddat)) +- Upgrade to ibc-go v3.3.0 REQUIRES [MIGRATION](https://github.com/cosmos/ibc-go/blob/v3.2.3/docs/migrations/support-denoms-with-slashes.md) [\#1016](https://github.com/CosmWasm/wasmd/pull/1016) +- Upgrade to cosmos-sdk v0.45.8 [\#964](https://github.com/CosmWasm/wasmd/pull/964/) ([faddat](https://github.com/faddat)) +- Upgrade wasmvm to v1.1.1 [\#1012](https://github.com/CosmWasm/wasmd/pull/1012), see [wasmvm v1.1.1](https://github.com/CosmWasm/wasmvm/releases/tag/v1.1.1) +- Add documentation how to add x/wasm to a new Cosmos SDK chain [\#876](https://github.com/CosmWasm/wasmd/issues/876) +- Upgrade keyring / go-keychain dependencies (removes deprecate warning) [\#957](https://github.com/CosmWasm/wasmd/issues/957) +- Make contract pinning an optional field in StoreCode proposals [\#972](https://github.com/CosmWasm/wasmd/issues/972) +- Add gRPC query for WASM params [\#889](https://github.com/CosmWasm/wasmd/issues/889) +- Expose Keepers in app.go? [\#881](https://github.com/CosmWasm/wasmd/issues/881) +- Remove unused `flagProposalType` flag in gov proposals [\#849](https://github.com/CosmWasm/wasmd/issues/849) +- Restrict code access config modifications [\#901](https://github.com/CosmWasm/wasmd/pull/901) ([alpe](https://github.com/alpe)) +- Prevent migration to a restricted code [\#900](https://github.com/CosmWasm/wasmd/pull/900) ([alpe](https://github.com/alpe)) +- Charge gas to unzip wasm code [\#898](https://github.com/CosmWasm/wasmd/pull/898) ([alpe](https://github.com/alpe)) + +### Notable changes: +- BaseAccount and pruned vesting account types can be re-used for contracts addresses +- A new [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/pull/1014/files#diff-bf58b9da4b674719f07dd5421c532c1ead13a15f8896b59c1f724215d2064b73R75) was introduced which is an additional value for `message` type events +- Store event contains new attribute with code checksum now +- New `wasmd tx wasm instantiate2` CLI command for predictable addresses on instantiation + +### Migration notes: +- See ibc-go [migration notes](https://github.com/cosmos/ibc-go/blob/v3.3.0/docs/migrations/support-denoms-with-slashes.md) + + +## [v0.28.0](https://github.com/CosmWasm/wasmd/tree/v0.28.0) (2022-07-29) + +[Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.27.0...v0.28.0) + +**API Breaking** + +No + +**Fixed Bugs** + +- Fix: Make events in reply completely determinisitic by stripping out anything coming from Cosmos SDK (not CosmWasm codebase) [\#917](https://github.com/CosmWasm/wasmd/pull/917) ([assafmo](https://github.com/assafmo)) + +Migration notes: + +* Contracts can no longer parse events from any calls except if they call another contract (or instantiate it, migrate it, etc). +The main issue here is likely "Custom" queries from a blockchain, which want to send info (eg. how many tokens were swapped). +Since those custom bindings are maintained by the chain, they can use the data field to pass any deterministic information +back to the contract. We recommend using JSON encoding there with some documented format the contracts can parse out easily. +* For possible non-determinism issues, we also sort all attributes in events. Better safe than sorry. ## [v0.27.0](https://github.com/CosmWasm/wasmd/tree/v0.27.0) (2022-05-19) diff --git a/Dockerfile b/Dockerfile index 3c0ff5517..42494493c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # docker build . -t cosmwasm/wasmd:latest # docker run --rm -it cosmwasm/wasmd:latest /bin/sh -FROM golang:1.17-alpine3.15 AS go-builder +FROM golang:1.18-alpine3.15 AS go-builder ARG arch=x86_64 # this comes from standard alpine nightly file @@ -16,10 +16,10 @@ WORKDIR /code COPY . /code/ # See https://github.com/CosmWasm/wasmvm/releases -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc -RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479 +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a +RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 9ecb037336bd56076573dc18c26631a9d2099a7f2b40dc04b6cae31ffb4c8f9a +RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 6e4de7ba9bad4ae9679c7f9ecf7e283dd0160e71567c6a7be6ae47c81ebe7f32 # 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 diff --git a/INTEGRATION.md b/INTEGRATION.md index 2d7f50891..b336ab908 100644 --- a/INTEGRATION.md +++ b/INTEGRATION.md @@ -3,7 +3,10 @@ # Integration If you want to use Wasm in your own app, here is how you can get this working -quickly and easily. First, check to make sure you fit the pre-requisites, +quickly and easily. +First start with This [article](https://medium.com/cosmwasm/cosmwasm-for-ctos-iv-native-integrations-713140bf75fc) +in the "CosmWasm for CTOs" series that gives you a high level view. +Then check to make sure you fit the pre-requisites, then integrate the `x/wasm` module as described below, and finally, you can add custom messages and queries to your custom Go/SDK modules, exposing them to any chain-specific contract. @@ -14,26 +17,18 @@ The pre-requisites of integrating `x/wasm` into your custom app is to be using a compatible version of the Cosmos SDK, and to accept some limits to the hardware it runs on. -| wasmd | Cosmos SDK | -|:------:|:-----------:| -| v0.24 | v0.45.0 | -| v0.23 | v0.45.0 | -| v0.22 | v0.45.0 | -| v0.21 | v0.42.x | -| v0.20 | v0.42.x | -| v0.19 | v0.42.x | -| v0.18 | v0.42.x | -| v0.17 | v0.42.x | -| v0.16 | v0.42.x | -| v0.15 | v0.41.x | -| v0.14 | v0.40.x | -| v0.13 | v0.40.0-rc3 | -| v0.12 | v0.40.0-rc3 | -| v0.11 | v0.39.1 | -| v0.10 | v0.39.1 | -| v0.9 | v0.38.3 | -| v0.8 | v0.38.3 | -| v0.7 | v0.38.3 | +| wasmd | Cosmos SDK | +|:-----:|:----------:| +| v0.29 | v0.45.8 | +| v0.28 | v0.45.5 | +| v0.27 | v0.45.4 | +| v0.26 | v0.45.1 | +| v0.25 | v0.45.1 | +| v0.24 | v0.45.0 | +| v0.23 | v0.45.0 | +| v0.22 | v0.45.0 | +| v0.21 | v0.42.x | + We currently only support Intel/AMD64 CPUs and OSX or Linux. For Linux, the standard build commands work for `glibc` systems (Ubuntu, Debian, CentOS, etc). If you wish to compile @@ -202,5 +197,5 @@ the SDK is implemented properly. Once you have tested this and are happy with the results, you can wire it up in `app.go`. Just edit [the default `NewKeeper` constructor](https://github.com/CosmWasm/wasmd/blob/v0.8.0-rc1/app/app.go#L257-L258) -to have the proper `supportedFeatures` and pass in the `CustomEncoder` and `CustomQuerier` as the last two arguments to `NewKeeper`. +to have the proper `availableCapabilities` and pass in the `CustomEncoder` and `CustomQuerier` as the last two arguments to `NewKeeper`. Now you can compile your chain and upload your custom contracts on it. \ No newline at end of file diff --git a/Makefile b/Makefile index 4a007fd78..aea212d4f 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,7 @@ go.sum: go.mod draw-deps: @# requires brew install graphviz or apt-get install graphviz - go get github.com/RobotsAndPencils/goviz + go install github.com/RobotsAndPencils/goviz@latest @goviz -i ./cmd/wasmd -d 2 | dot -Tpng -o dependency-graph.png clean: @@ -165,7 +165,7 @@ format: format-tools ############################################################################### ### Protobuf ### ############################################################################### -PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen@sha256:372dce7be2f465123e26459973ca798fc489ff2c75aeecd814c0ca8ced24faca +PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.2 PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae proto-all: proto-format proto-lint proto-gen format diff --git a/README.md b/README.md index 02ced0d3a..e5c24f1d8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This code was forked from the `cosmos/gaia` repository as a basis and then we ad 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.17+](https://golang.org/dl/) +**Note**: Requires [Go 1.18+](https://golang.org/dl/) For critical security issues & disclosure, see [SECURITY.md](SECURITY.md). ## Compatibility with CosmWasm contracts @@ -25,7 +25,9 @@ version is communicated by the contract via a Wasm export. This is the current compatibility list: | wasmd | wasmvm | cosmwasm-vm | cosmwasm-std | -| ----- | ------------ | ----------- | ------------ | +|-------|--------------|-------------|--------------| +| 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 | @@ -52,7 +54,7 @@ It will also run contracts compiled with 1.x assuming they don't opt into any ne 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 rejeted upon upload (with some error +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. @@ -95,9 +97,9 @@ The used cosmos-sdk version is in transition migrating from amino encoding to pr 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 decodng. For better UX, we often use `json.RawMessage` to contain these bytes, which enforces that it is +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 in issue if this is important for +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 diff --git a/app/ante.go b/app/ante.go index 937f87fb9..8e2052cc5 100644 --- a/app/ante.go +++ b/app/ante.go @@ -1,11 +1,12 @@ package app import ( + 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" - ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" - "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante" + "github.com/cosmos/ibc-go/v5/modules/core/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -18,7 +19,7 @@ type HandlerOptions struct { IBCKeeper *keeper.Keeper WasmConfig *wasmTypes.WasmConfig - TXCounterStoreKey sdk.StoreKey + TXCounterStoreKey storetypes.StoreKey } func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { @@ -47,20 +48,19 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { 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), - ante.NewRejectExtensionOptionsDecorator(), - ante.NewMempoolFeeDecorator(), + ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewSetPubKeyDecorator(options.AccountKeeper), ante.NewValidateSigCountDecorator(options.AccountKeeper), ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), - ibcante.NewAnteDecorator(options.IBCKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), } return sdk.ChainAnteDecorators(anteDecorators...), nil diff --git a/app/app.go b/app/app.go index 300ef7b15..5439a0d5d 100644 --- a/app/app.go +++ b/app/app.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" @@ -22,7 +21,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" @@ -56,6 +54,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "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" @@ -74,27 +74,32 @@ import ( 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" - ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" - transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ica "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v5/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types" + transfer "github.com/cosmos/ibc-go/v5/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v5/modules/core" + ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" + ibcmock "github.com/cosmos/ibc-go/v5/testing/mock" // Note: please do your research before using this in production app, this is a demo and not an officially // supported IBC team implementation. It has no known issues, but do your own research before using it. + storetypes "github.com/cosmos/cosmos-sdk/store/types" intertx "github.com/cosmos/interchain-accounts/x/inter-tx" intertxkeeper "github.com/cosmos/interchain-accounts/x/inter-tx/keeper" intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" @@ -117,7 +122,10 @@ import ( _ "github.com/cosmos/cosmos-sdk/client/docs/statik" ) -const appName = "WasmApp" +const ( + appName = "WasmApp" + MockFeePort string = ibcmock.ModuleName + ibcfeetypes.ModuleName +) // We pull these out so we can set them with LDFLAGS in the Makefile var ( @@ -183,17 +191,15 @@ var ( staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, - gov.NewAppModuleBasic( - append( - wasmclient.ProposalHandlers, - paramsclient.ProposalHandler, - distrclient.ProposalHandler, - upgradeclient.ProposalHandler, - upgradeclient.CancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - )..., - ), + gov.NewAppModuleBasic(append( + wasmclient.ProposalHandlers, + paramsclient.ProposalHandler, + distrclient.ProposalHandler, + upgradeclient.LegacyProposalHandler, + upgradeclient.LegacyCancelProposalHandler, + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, + )), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, @@ -207,6 +213,7 @@ var ( wasm.AppModuleBasic{}, ica.AppModuleBasic{}, intertx.AppModuleBasic{}, + ibcfee.AppModuleBasic{}, ) // module account permissions @@ -218,6 +225,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, icatypes.ModuleName: nil, wasm.ModuleName: {authtypes.Burner}, } @@ -238,38 +246,40 @@ type WasmApp struct { invCheckPeriod uint // keys to access the substores - keys map[string]*sdk.KVStoreKey - tkeys map[string]*sdk.TransientStoreKey - memKeys map[string]*sdk.MemoryStoreKey + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey // keepers - accountKeeper authkeeper.AccountKeeper - bankKeeper bankkeeper.Keeper - capabilityKeeper *capabilitykeeper.Keeper - stakingKeeper stakingkeeper.Keeper - slashingKeeper slashingkeeper.Keeper - mintKeeper mintkeeper.Keeper - distrKeeper distrkeeper.Keeper - govKeeper govkeeper.Keeper - crisisKeeper crisiskeeper.Keeper - upgradeKeeper upgradekeeper.Keeper - paramsKeeper paramskeeper.Keeper - evidenceKeeper evidencekeeper.Keeper - ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - icaControllerKeeper icacontrollerkeeper.Keeper - icaHostKeeper icahostkeeper.Keeper - interTxKeeper intertxkeeper.Keeper - transferKeeper ibctransferkeeper.Keeper - feeGrantKeeper feegrantkeeper.Keeper - authzKeeper authzkeeper.Keeper - wasmKeeper wasm.Keeper - - scopedIBCKeeper capabilitykeeper.ScopedKeeper - scopedICAHostKeeper capabilitykeeper.ScopedKeeper - scopedICAControllerKeeper capabilitykeeper.ScopedKeeper - scopedInterTxKeeper capabilitykeeper.ScopedKeeper - scopedTransferKeeper capabilitykeeper.ScopedKeeper - scopedWasmKeeper capabilitykeeper.ScopedKeeper + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper crisiskeeper.Keeper + UpgradeKeeper upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + IBCFeeKeeper ibcfeekeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + InterTxKeeper intertxkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + AuthzKeeper authzkeeper.Keeper + WasmKeeper wasm.Keeper + + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedInterTxKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper + ScopedWasmKeeper capabilitykeeper.ScopedKeeper // the module manager mm *module.Manager @@ -324,7 +334,7 @@ func NewWasmApp( memKeys: memKeys, } - app.paramsKeeper = initParamsKeeper( + app.ParamsKeeper = initParamsKeeper( appCodec, legacyAmino, keys[paramstypes.StoreKey], @@ -332,172 +342,182 @@ func NewWasmApp( ) // set the BaseApp's parameter store - bApp.SetParamStore(app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) + bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())) // add capability keeper and ScopeToModule for ibc module - app.capabilityKeeper = capabilitykeeper.NewKeeper( + app.CapabilityKeeper = capabilitykeeper.NewKeeper( appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey], ) - scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibchost.ModuleName) - scopedICAHostKeeper := app.capabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - scopedICAControllerKeeper := app.capabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedInterTxKeeper := app.capabilityKeeper.ScopeToModule(intertxtypes.ModuleName) - scopedTransferKeeper := app.capabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedWasmKeeper := app.capabilityKeeper.ScopeToModule(wasm.ModuleName) - app.capabilityKeeper.Seal() + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(intertxtypes.ModuleName) + scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName) + app.CapabilityKeeper.Seal() // add keepers - app.accountKeeper = authkeeper.NewAccountKeeper( + app.AccountKeeper = authkeeper.NewAccountKeeper( appCodec, keys[authtypes.StoreKey], - app.getSubspace(authtypes.ModuleName), + app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, + sdk.GetConfig().GetBech32AccountAddrPrefix(), ) - app.bankKeeper = bankkeeper.NewBaseKeeper( + app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], - app.accountKeeper, - app.getSubspace(banktypes.ModuleName), + app.AccountKeeper, + app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), ) - app.authzKeeper = authzkeeper.NewKeeper( + app.AuthzKeeper = authzkeeper.NewKeeper( keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), + app.AccountKeeper, ) - app.feeGrantKeeper = feegrantkeeper.NewKeeper( + app.FeeGrantKeeper = feegrantkeeper.NewKeeper( appCodec, keys[feegrant.StoreKey], - app.accountKeeper, + app.AccountKeeper, ) stakingKeeper := stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], - app.accountKeeper, - app.bankKeeper, - app.getSubspace(stakingtypes.ModuleName), + app.AccountKeeper, + app.BankKeeper, + app.GetSubspace(stakingtypes.ModuleName), ) - app.mintKeeper = mintkeeper.NewKeeper( + app.MintKeeper = mintkeeper.NewKeeper( appCodec, keys[minttypes.StoreKey], - app.getSubspace(minttypes.ModuleName), + app.GetSubspace(minttypes.ModuleName), &stakingKeeper, - app.accountKeeper, - app.bankKeeper, + app.AccountKeeper, + app.BankKeeper, authtypes.FeeCollectorName, ) - app.distrKeeper = distrkeeper.NewKeeper( + app.DistrKeeper = distrkeeper.NewKeeper( appCodec, keys[distrtypes.StoreKey], - app.getSubspace(distrtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, + app.GetSubspace(distrtypes.ModuleName), + app.AccountKeeper, + app.BankKeeper, &stakingKeeper, authtypes.FeeCollectorName, - app.ModuleAccountAddrs(), ) - app.slashingKeeper = slashingkeeper.NewKeeper( + app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, - app.getSubspace(slashingtypes.ModuleName), + app.GetSubspace(slashingtypes.ModuleName), ) - app.crisisKeeper = crisiskeeper.NewKeeper( - app.getSubspace(crisistypes.ModuleName), + app.CrisisKeeper = crisiskeeper.NewKeeper( + app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, - app.bankKeeper, + app.BankKeeper, authtypes.FeeCollectorName, ) - app.upgradeKeeper = upgradekeeper.NewKeeper( + app.UpgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.stakingKeeper = *stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks()), + app.StakingKeeper = *stakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.ibcKeeper = ibckeeper.NewKeeper( + app.IBCKeeper = ibckeeper.NewKeeper( appCodec, keys[ibchost.StoreKey], - app.getSubspace(ibchost.ModuleName), - app.stakingKeeper, - app.upgradeKeeper, + app.GetSubspace(ibchost.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, scopedIBCKeeper, ) - // register the proposal types - govRouter := govtypes.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). - AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)) + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/spec/01_concepts.md#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) // Create Transfer Keepers - app.transferKeeper = ibctransferkeeper.NewKeeper( + app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, keys[ibctransfertypes.StoreKey], - app.getSubspace(ibctransfertypes.ModuleName), - app.ibcKeeper.ChannelKeeper, - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, - app.accountKeeper, - app.bankKeeper, + app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + app.AccountKeeper, + app.BankKeeper, scopedTransferKeeper, ) - transferModule := transfer.NewAppModule(app.transferKeeper) - transferIBCModule := transfer.NewIBCModule(app.transferKeeper) + transferModule := transfer.NewAppModule(app.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) + + // IBC Fee Module keeper + app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + appCodec, keys[ibcfeetypes.StoreKey], app.GetSubspace(ibcfeetypes.ModuleName), + app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + ) - app.icaHostKeeper = icahostkeeper.NewKeeper( - appCodec, - keys[icahosttypes.StoreKey], - app.getSubspace(icahosttypes.SubModuleName), - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, - app.accountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), + // ICA Host keeper + app.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), ) - app.icaControllerKeeper = icacontrollerkeeper.NewKeeper( + + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, keys[icacontrollertypes.StoreKey], - app.getSubspace(icacontrollertypes.SubModuleName), - app.ibcKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, + app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, scopedICAControllerKeeper, app.MsgServiceRouter(), ) - icaModule := ica.NewAppModule(&app.icaControllerKeeper, &app.icaHostKeeper) - icaHostIBCModule := icahost.NewIBCModule(app.icaHostKeeper) + + icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) + icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) // For wasmd we use the demo controller from https://github.com/cosmos/interchain-accounts but see notes below - app.interTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.icaControllerKeeper, scopedInterTxKeeper) + app.InterTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.ICAControllerKeeper, scopedInterTxKeeper) // Note: please do your research before using this in production app, this is a demo and not an officially // supported IBC team implementation. Do your own research before using it. - interTxModule := intertx.NewAppModule(appCodec, app.interTxKeeper) - interTxIBCModule := intertx.NewIBCModule(app.interTxKeeper) - // You will likely want to swap out the second argument with your own reviewed and maintained ica auth module - icaControllerIBCModule := icacontroller.NewIBCModule(app.icaControllerKeeper, interTxIBCModule) - + interTxModule := intertx.NewAppModule(appCodec, app.InterTxKeeper) + interTxIBCModule := intertx.NewIBCModule(app.InterTxKeeper) + // You will likely want to swap out the interTxIBCModule with your own reviewed and maintained ica auth module + icaControllerIBCModule := icacontroller.NewIBCMiddleware(interTxIBCModule, app.ICAControllerKeeper) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], - &app.stakingKeeper, - app.slashingKeeper, + &app.StakingKeeper, + app.SlashingKeeper, ) - app.evidenceKeeper = *evidenceKeeper + app.EvidenceKeeper = *evidenceKeeper wasmDir := filepath.Join(homePath, "wasm") wasmConfig, err := wasm.ReadWasmConfig(appOpts) @@ -507,24 +527,24 @@ func NewWasmApp( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - supportedFeatures := "iterator,staking,stargate" - app.wasmKeeper = wasm.NewKeeper( + availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1" + app.WasmKeeper = wasm.NewKeeper( appCodec, keys[wasm.StoreKey], - app.getSubspace(wasm.ModuleName), - app.accountKeeper, - app.bankKeeper, - app.stakingKeeper, - app.distrKeeper, - app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, + app.GetSubspace(wasm.ModuleName), + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.DistrKeeper, + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, scopedWasmKeeper, - app.transferKeeper, + app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), wasmDir, wasmConfig, - supportedFeatures, + availableCapabilities, wasmOpts..., ) @@ -533,24 +553,37 @@ func NewWasmApp( // The gov proposal types can be individually enabled if len(enabledProposals) != 0 { - govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, enabledProposals)) + govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) } ibcRouter. - AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)). + AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper)). AddRoute(ibctransfertypes.ModuleName, transferIBCModule). AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). AddRoute(intertxtypes.ModuleName, icaControllerIBCModule) - app.ibcKeeper.SetRouter(ibcRouter) - - app.govKeeper = govkeeper.NewKeeper( + app.IBCKeeper.SetRouter(ibcRouter) + + govConfig := govtypes.DefaultConfig() + /* + Example of setting gov params: + govConfig.MaxMetadataLen = 10000 + */ + govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], - app.getSubspace(govtypes.ModuleName), - app.accountKeeper, - app.bankKeeper, + app.GetSubspace(govtypes.ModuleName), + app.AccountKeeper, + app.BankKeeper, &stakingKeeper, govRouter, + app.MsgServiceRouter(), + govConfig, + ) + + app.GovKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks( + // register the governance hooks + ), ) /**** Module Options ****/ @@ -562,31 +595,31 @@ func NewWasmApp( // must be passed by reference here. app.mm = module.NewManager( genutil.NewAppModule( - app.accountKeeper, - app.stakingKeeper, + app.AccountKeeper, + app.StakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - auth.NewAppModule(appCodec, app.accountKeeper, nil), - vesting.NewAppModule(app.accountKeeper, app.bankKeeper), - bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), - capability.NewAppModule(appCodec, *app.capabilityKeeper), - gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), - mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - upgrade.NewAppModule(app.upgradeKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - evidence.NewAppModule(app.evidenceKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), - ibc.NewAppModule(app.ibcKeeper), - params.NewAppModule(app.paramsKeeper), + auth.NewAppModule(appCodec, app.AccountKeeper, nil), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + capability.NewAppModule(appCodec, *app.CapabilityKeeper), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + upgrade.NewAppModule(app.UpgradeKeeper), + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.IBCKeeper), + params.NewAppModule(app.ParamsKeeper), transferModule, icaModule, interTxModule, - crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them + crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them ) // During begin block slashing happens after distr.BeginBlocker so that @@ -679,7 +712,7 @@ func NewWasmApp( // Uncomment if you want to set a custom migration order here. // app.mm.SetOrderMigrations(custom order) - app.mm.RegisterInvariants(&app.crisisKeeper) + app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) @@ -690,20 +723,20 @@ func NewWasmApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions app.sm = module.NewSimulationManager( - auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts), - bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), - capability.NewAppModule(appCodec, *app.capabilityKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), - mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), - staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), - params.NewAppModule(app.paramsKeeper), - evidence.NewAppModule(app.evidenceKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper, app.accountKeeper, app.bankKeeper), - ibc.NewAppModule(app.ibcKeeper), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + capability.NewAppModule(appCodec, *app.CapabilityKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + params.NewAppModule(app.ParamsKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + ibc.NewAppModule(app.IBCKeeper), transferModule, ) @@ -716,13 +749,13 @@ func NewWasmApp( anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ - AccountKeeper: app.accountKeeper, - BankKeeper: app.bankKeeper, - FeegrantKeeper: app.feeGrantKeeper, + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + FeegrantKeeper: app.FeeGrantKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCKeeper: app.ibcKeeper, + IBCKeeper: app.IBCKeeper, WasmConfig: &wasmConfig, TXCounterStoreKey: keys[wasm.StoreKey], }, @@ -739,21 +772,22 @@ func NewWasmApp( // must be before Loading version // requires the snapshot store to be created and registered as a BaseAppOption // see cmd/wasmd/root.go: 206 - 214 approx + if manager := app.SnapshotManager(); manager != nil { err := manager.RegisterExtensions( - wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.wasmKeeper), + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper), ) if err != nil { panic(fmt.Errorf("failed to register snapshot extension: %s", err)) } } - app.scopedIBCKeeper = scopedIBCKeeper - app.scopedTransferKeeper = scopedTransferKeeper - app.scopedWasmKeeper = scopedWasmKeeper - app.scopedICAHostKeeper = scopedICAHostKeeper - app.scopedICAControllerKeeper = scopedICAControllerKeeper - app.scopedInterTxKeeper = scopedInterTxKeeper + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedWasmKeeper = scopedWasmKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + app.ScopedInterTxKeeper = scopedInterTxKeeper if loadLatest { if err := app.LoadLatestVersion(); err != nil { @@ -762,7 +796,7 @@ func NewWasmApp( 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 { + if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) } } @@ -790,7 +824,7 @@ func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci panic(err) } - app.upgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } @@ -818,11 +852,11 @@ func (app *WasmApp) LegacyAmino() *codec.LegacyAmino { //nolint:staticcheck return app.legacyAmino } -// getSubspace returns a param subspace for a given module name. +// GetSubspace returns a param subspace for a given module name. // // NOTE: This is solely to be used for testing purposes. -func (app *WasmApp) getSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.paramsKeeper.GetSubspace(moduleName) +func (app *WasmApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace } @@ -835,16 +869,11 @@ func (app *WasmApp) SimulationManager() *module.SimulationManager { // API server. func (app *WasmApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) - // Register legacy tx routes. - authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) // 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 legacy and grpc-gateway routes for all modules. - ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily @@ -860,7 +889,12 @@ func (app *WasmApp) RegisterTxService(clientCtx client.Context) { // RegisterTendermintService implements the Application.RegisterTendermintService method. func (app *WasmApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) + tmservice.RegisterTendermintService( + clientCtx, + app.BaseApp.GRPCQueryRouter(), + app.interfaceRegistry, + app.Query, + ) } func (app *WasmApp) AppCodec() codec.Codec { @@ -888,7 +922,7 @@ func GetMaccPerms() map[string][]string { } // initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) paramsKeeper.Subspace(authtypes.ModuleName) @@ -897,7 +931,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) diff --git a/app/app_test.go b/app/app_test.go index a3bd66ab6..46f072526 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -4,10 +4,20 @@ import ( "encoding/json" "os" "testing" - + "time" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + 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" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/v5/testing/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" + tmtypes "github.com/tendermint/tendermint/types" db "github.com/tendermint/tm-db" abci "github.com/tendermint/tendermint/abci/types" @@ -20,8 +30,27 @@ var emptyWasmOpts []wasm.Option = nil func TestWasmdExport(t *testing.T) { db := db.NewMemDB() gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, emptyWasmOpts) + // generate validator private/public key + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) - genesisState := NewDefaultGenesisState() + // create validator set with single validator + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + amount, ok := sdk.NewIntFromString("10000000000000000000") + require.True(t, ok) + + balance := banktypes.Balance{ + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amount)), + } + + genesisState := SetupGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, nil, gapp, balance) stateBytes, err := json.MarshalIndent(genesisState, "", " ") require.NoError(t, err) @@ -47,7 +76,7 @@ func TestBlockedAddrs(t *testing.T) { for acc := range maccPerms { t.Run(acc, func(t *testing.T) { - require.True(t, gapp.bankKeeper.BlockedAddr(gapp.accountKeeper.GetModuleAddress(acc)), + require.True(t, gapp.BankKeeper.BlockedAddr(gapp.AccountKeeper.GetModuleAddress(acc)), "ensure that blocked addresses are properly set in bank keeper", ) }) @@ -108,3 +137,61 @@ func setGenesis(gapp *WasmApp) error { gapp.Commit() return nil } + +func SetupGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, opts []wasm.Option, app *WasmApp, balances ...banktypes.Balance) GenesisState { + + genesisState := NewDefaultGenesisState() + // set genesis accounts + authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) + genesisState[authtypes.ModuleName] = app.appCodec.MustMarshalJSON(authGenesis) + + validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) + delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) + + bondAmt := sdk.NewInt(1000000) + + for _, val := range valSet.Validators { + pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + require.NoError(t, err) + pkAny, err := codectypes.NewAnyWithValue(pk) + require.NoError(t, err) + validator := stakingtypes.Validator{ + OperatorAddress: sdk.ValAddress(val.Address).String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: bondAmt, + DelegatorShares: sdk.OneDec(), + Description: stakingtypes.Description{}, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + MinSelfDelegation: sdk.ZeroInt(), + } + validators = append(validators, validator) + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) + + } + + // set validators and delegations + stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) + genesisState[stakingtypes.ModuleName] = app.appCodec.MustMarshalJSON(stakingGenesis) + + totalSupply := sdk.NewCoins() + for _, b := range balances { + // add genesis acc tokens and delegated tokens to total supply + totalSupply = totalSupply.Add(b.Coins.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt))...) + } + + // add bonded amount to bonded pool module account + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, + }) + + // update total supply + bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + genesisState[banktypes.ModuleName] = app.appCodec.MustMarshalJSON(bankGenesis) + + return genesisState +} diff --git a/app/export.go b/app/export.go index 474059280..1d591e668 100644 --- a/app/export.go +++ b/app/export.go @@ -35,7 +35,7 @@ func (app *WasmApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, app.stakingKeeper) + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, @@ -46,7 +46,8 @@ func (app *WasmApp) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height +// +// in favour of export at a block height func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -66,18 +67,18 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ } /* Just to be safe, assert the invariants on current state. */ - app.crisisKeeper.AssertInvariants(ctx) + app.CrisisKeeper.AssertInvariants(ctx) /* 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()) //nolint:errcheck + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint:errcheck return false }) // withdraw all delegator rewards - dels := app.stakingKeeper.GetAllDelegations(ctx) + dels := app.StakingKeeper.GetAllDelegations(ctx) for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -88,28 +89,31 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - _, _ = app.distrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint:errcheck + _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint:errcheck } // clear validator slash events - app.distrKeeper.DeleteAllValidatorSlashEvents(ctx) + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) // clear validator historical rewards - app.distrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) // set context height to zero height := ctx.BlockHeight() ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.distrKeeper.GetFeePool(ctx) + scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + feePool := app.DistrKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.distrKeeper.SetFeePool(ctx, feePool) + app.DistrKeeper.SetFeePool(ctx, feePool) - app.distrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + if err != nil { + panic(err) + } return false }) @@ -123,8 +127,14 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - app.distrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) - app.distrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + err = app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) + if err != nil { + panic(err) + } + err = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + if err != nil { + panic(err) + } } // reset context height @@ -133,20 +143,20 @@ 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) { + 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) + app.StakingKeeper.SetRedelegation(ctx, red) return false }) // iterate through unbonding delegations, reset creation height - app.stakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + 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) + app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) return false }) @@ -158,7 +168,7 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[1:]) - validator, found := app.stakingKeeper.GetValidator(ctx, addr) + validator, found := app.StakingKeeper.GetValidator(ctx, addr) if !found { panic("expected validator, not found") } @@ -168,13 +178,13 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ validator.Jailed = true } - app.stakingKeeper.SetValidator(ctx, validator) + app.StakingKeeper.SetValidator(ctx, validator) counter++ } iter.Close() - _, err := app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } @@ -182,11 +192,11 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ /* Handle slashing state. */ // reset start height on signing infos - app.slashingKeeper.IterateValidatorSigningInfos( + app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.slashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) return false }, ) diff --git a/app/sim_test.go b/app/sim_test.go index d64488de4..925bc03ec 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/types/module" @@ -31,8 +32,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -48,8 +49,8 @@ func init() { } type StoreKeysPrefixes struct { - A sdk.StoreKey - B sdk.StoreKey + A storetypes.StoreKey + B storetypes.StoreKey Prefixes [][]byte } @@ -213,7 +214,7 @@ func TestAppImportExport(t *testing.T) { normalizeContractInfo := func(ctx sdk.Context, app *WasmApp) { var index uint64 - app.wasmKeeper.IterateContractInfo(ctx, func(address sdk.AccAddress, info wasmtypes.ContractInfo) bool { + app.WasmKeeper.IterateContractInfo(ctx, func(address sdk.AccAddress, info wasmtypes.ContractInfo) bool { created := &wasmtypes.AbsoluteTxPosition{ BlockHeight: uint64(0), TxIndex: index, diff --git a/app/test_access.go b/app/test_access.go index 6dadec1e0..1faedfac4 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -12,12 +12,13 @@ import ( 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" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" "github.com/CosmWasm/wasmd/x/wasm" ) +// Deprecated: use public app attributes directly type TestSupport struct { t testing.TB app *WasmApp @@ -28,11 +29,11 @@ func NewTestSupport(t testing.TB, app *WasmApp) *TestSupport { } func (s TestSupport) IBCKeeper() *ibckeeper.Keeper { - return s.app.ibcKeeper + return s.app.IBCKeeper } func (s TestSupport) WasmKeeper() wasm.Keeper { - return s.app.wasmKeeper + return s.app.WasmKeeper } func (s TestSupport) AppCodec() codec.Codec { @@ -40,27 +41,27 @@ func (s TestSupport) AppCodec() codec.Codec { } func (s TestSupport) ScopedWasmIBCKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedWasmKeeper + return s.app.ScopedWasmKeeper } func (s TestSupport) ScopeIBCKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedIBCKeeper + return s.app.ScopedIBCKeeper } func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper { - return s.app.scopedTransferKeeper + return s.app.ScopedTransferKeeper } func (s TestSupport) StakingKeeper() stakingkeeper.Keeper { - return s.app.stakingKeeper + return s.app.StakingKeeper } func (s TestSupport) BankKeeper() bankkeeper.Keeper { - return s.app.bankKeeper + return s.app.BankKeeper } func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper { - return s.app.transferKeeper + return s.app.TransferKeeper } func (s TestSupport) GetBaseApp() *baseapp.BaseApp { diff --git a/app/test_helpers.go b/app/test_helpers.go index 11e72135b..b83fa49be 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -5,11 +5,13 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math/rand" "path/filepath" "strconv" "testing" "time" + "cosmossdk.io/math" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -18,6 +20,7 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/simapp/helpers" "github.com/cosmos/cosmos-sdk/snapshots" + snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -57,11 +60,13 @@ var DefaultConsensusParams = &abci.ConsensusParams{ func setup(t testing.TB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*WasmApp, GenesisState) { nodeHome := t.TempDir() snapshotDir := filepath.Join(nodeHome, "data", "snapshots") - snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) + snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) //nolint:staticcheck require.NoError(t, err) snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) require.NoError(t, err) - baseAppOpts := []func(*bam.BaseApp){bam.SetSnapshotStore(snapshotStore), bam.SetSnapshotKeepRecent(2)} + baseAppOpts := []func(*bam.BaseApp){ + bam.SetSnapshot(snapshotStore, snapshottypes.NewSnapshotOptions(50000, 2)), + } db := dbm.NewMemDB() app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, nodeHome, invCheckPeriod, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, opts, baseAppOpts...) if withGenesis { @@ -70,6 +75,29 @@ func setup(t testing.TB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Opt return app, GenesisState{} } +// Setup initializes a new WasmApp with DefaultNodeHome for integration tests +func Setup(isCheckTx bool, opts ...wasm.Option) *WasmApp { + db := dbm.NewMemDB() + app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, opts) + + if !isCheckTx { + genesisState := NewDefaultGenesisState() + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + if err != nil { + panic(err) + } + + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: DefaultConsensusParams, + AppStateBytes: stateBytes, + }, + ) + } + return app +} + // SetupWithGenesisValSet initializes a new WasmApp with a validator set and genesis accounts // that also act as delegators. For simplicity, each validator is bonded with a delegation // of one consensus engine unit (10^6) in the default token of the WasmApp from first genesis @@ -182,7 +210,7 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress { buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string buffer.WriteString(numString) // adding on final two digits to make addresses unique - res, err := sdk.AccAddressFromHex(buffer.String()) + res, err := sdk.AccAddressFromHexUnsafe(buffer.String()) if err != nil { panic(err) } @@ -200,8 +228,8 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress { } // AddTestAddrsFromPubKeys adds the addresses into the WasmApp providing only the public keys. -func AddTestAddrsFromPubKeys(app *WasmApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int) { - initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) +func AddTestAddrsFromPubKeys(app *WasmApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt math.Int) { + initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) for _, pk := range pubKeys { initAccountWithCoins(app, ctx, sdk.AccAddress(pk.Address()), initCoins) @@ -210,20 +238,20 @@ func AddTestAddrsFromPubKeys(app *WasmApp, ctx sdk.Context, pubKeys []cryptotype // AddTestAddrs constructs and returns accNum amount of accounts with an // initial balance of accAmt in random order -func AddTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress { +func AddTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress { return addTestAddrs(app, ctx, accNum, accAmt, createRandomAccounts) } // AddTestAddrs 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 sdk.Int) []sdk.AccAddress { +func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress { return addTestAddrs(app, ctx, accNum, accAmt, createIncrementalAccounts) } -func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int, strategy GenerateAccountStrategy) []sdk.AccAddress { +func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int, strategy GenerateAccountStrategy) []sdk.AccAddress { testAddrs := strategy(accNum) - initCoins := sdk.NewCoins(sdk.NewCoin(app.stakingKeeper.BondDenom(ctx), accAmt)) + initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt)) // fill all the addresses with some coins, set the loose pool tokens simultaneously for _, addr := range testAddrs { @@ -234,12 +262,12 @@ func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int, str } func initAccountWithCoins(app *WasmApp, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) { - err := app.bankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) if err != nil { panic(err) } - err = app.bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) if err != nil { panic(err) } @@ -257,7 +285,7 @@ func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress { } func TestAddr(addr string, bech string) (sdk.AccAddress, error) { - res, err := sdk.AccAddressFromHex(addr) + res, err := sdk.AccAddressFromHexUnsafe(addr) if err != nil { return nil, err } @@ -280,10 +308,10 @@ func TestAddr(addr string, bech string) (sdk.AccAddress, error) { // CheckBalance checks the balance of an account. func CheckBalance(t *testing.T, app *WasmApp, addr sdk.AccAddress, balances sdk.Coins) { ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{}) - require.True(t, balances.IsEqual(app.bankKeeper.GetAllBalances(ctxCheck, addr))) + require.True(t, balances.IsEqual(app.BankKeeper.GetAllBalances(ctxCheck, addr))) } -const DefaultGas = 1200000 +const DefaultGas = 1_500_000 // SignCheckDeliver checks a generated signed transaction and simulates a // block commitment with the given transaction. A test assertion is made using @@ -293,11 +321,12 @@ func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, - 2*DefaultGas, + helpers.DefaultGenTxGas, chainID, accNums, accSeqs, @@ -320,7 +349,7 @@ func SignCheckDeliver( // Simulate a sending a transaction and committing a block app.BeginBlock(abci.RequestBeginBlock{Header: header}) - gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) + gInfo, res, err := app.SimDeliver(txCfg.TxEncoder(), tx) if expPass { require.NoError(t, err) @@ -342,7 +371,8 @@ func SignAndDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, @@ -356,7 +386,7 @@ func SignAndDeliver( // Simulate a sending a transaction and committing a block app.BeginBlock(abci.RequestBeginBlock{Header: header}) - gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx) + gInfo, res, err := app.SimDeliver(txCfg.TxEncoder(), tx) if expPass { require.NoError(t, err) @@ -379,7 +409,8 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i txs := make([]sdk.Tx, numToGenerate) var err error for i := 0; i < numToGenerate; i++ { - txs[i], err = helpers.GenTx( + txs[i], err = helpers.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txGen, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, diff --git a/benchmarks/app_test.go b/benchmarks/app_test.go index 1fbfb4866..6a1c98dda 100644 --- a/benchmarks/app_test.go +++ b/benchmarks/app_test.go @@ -2,7 +2,8 @@ package benchmarks import ( "encoding/json" - "io/ioutil" + "math/rand" + "os" "testing" "time" @@ -11,12 +12,13 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/simapp/helpers" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/cosmos/cosmos-sdk/testutil/mock" 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" @@ -24,6 +26,12 @@ import ( "github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/x/wasm" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" ) func setup(db dbm.DB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*app.WasmApp, app.GenesisState) { @@ -37,18 +45,61 @@ func setup(db dbm.DB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option // SetupWithGenesisAccounts initializes a new WasmApp with the provided genesis // accounts and possible balances. -func SetupWithGenesisAccounts(b testing.TB, db dbm.DB, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.WasmApp { +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 := app.NewTestSupport(b, wasmApp).AppCodec() + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(b, err) + genesisState[authtypes.ModuleName] = appCodec.MustMarshalJSON(authGenesis) + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + + validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) + delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) + + bondAmt := sdk.DefaultPowerReduction + + for _, val := range valSet.Validators { + pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pkAny, _ := codectypes.NewAnyWithValue(pk) + validator := stakingtypes.Validator{ + OperatorAddress: sdk.ValAddress(val.Address).String(), + ConsensusPubkey: pkAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: bondAmt, + DelegatorShares: sdk.OneDec(), + Description: stakingtypes.Description{}, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + MinSelfDelegation: sdk.ZeroInt(), + } + validators = append(validators, validator) + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) + + } + // set validators and delegations + stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) + genesisState[stakingtypes.ModuleName] = appCodec.MustMarshalJSON(stakingGenesis) + totalSupply := sdk.NewCoins() + + // add bonded amount to bonded pool module account + balances = append(balances, banktypes.Balance{ + Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), + Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)}, + }) + // update total supply for _, b := range balances { + // add genesis acc tokens and delegated tokens to total supply totalSupply = totalSupply.Add(b.Coins...) } - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) genesisState[banktypes.ModuleName] = appCodec.MustMarshalJSON(bankGenesis) @@ -111,7 +162,7 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { Coins: sdk.NewCoins(sdk.NewInt64Coin(denom, 100000000000)), } } - wasmApp := SetupWithGenesisAccounts(b, db, genAccs, bals...) + wasmApp := SetupWithGenesisAccountsAndValSet(b, db, genAccs, bals...) // add wasm contract height := int64(2) @@ -119,15 +170,16 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { wasmApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height, Time: time.Now()}}) // upload the code - cw20Code, err := ioutil.ReadFile("./testdata/cw20_base.wasm") + cw20Code, err := os.ReadFile("./testdata/cw20_base.wasm") require.NoError(b, err) storeMsg := wasmtypes.MsgStoreCode{ Sender: addr.String(), WASMByteCode: cw20Code, } - storeTx, err := helpers.GenTx(txGen, []sdk.Msg{&storeMsg}, nil, 55123123, "", []uint64{0}, []uint64{0}, minter) + storeTx, err := helpers.GenSignedMockTx(rand.New(rand.NewSource(time.Now().UnixNano())), + txGen, []sdk.Msg{&storeMsg}, nil, 55123123, "", []uint64{0}, []uint64{0}, minter) require.NoError(b, err) - _, res, err := wasmApp.Deliver(txGen.TxEncoder(), storeTx) + _, res, err := wasmApp.SimDeliver(txGen.TxEncoder(), storeTx) require.NoError(b, err) codeID := uint64(1) @@ -159,9 +211,16 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo { Msg: initBz, } gasWanted := 500000 + 10000*uint64(numAccounts) - initTx, err := helpers.GenTx(txGen, []sdk.Msg{&initMsg}, nil, gasWanted, "", []uint64{0}, []uint64{1}, minter) + initTx, err := helpers.GenSignedMockTx(rand.New(rand.NewSource(time.Now().UnixNano())), + txGen, + []sdk.Msg{&initMsg}, + nil, gasWanted, + "", + []uint64{0}, + []uint64{1}, + minter) require.NoError(b, err) - _, res, err = wasmApp.Deliver(txGen.TxEncoder(), initTx) + _, res, err = wasmApp.SimDeliver(txGen.TxEncoder(), initTx) require.NoError(b, err) // TODO: parse contract address better @@ -191,7 +250,8 @@ func GenSequenceOfTxs(b testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk. for i := 0; i < numToGenerate; i++ { msgs, err := msgGen(info) require.NoError(b, err) - txs[i], err = helpers.GenTx( + txs[i], err = helpers.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), info.TxConfig, msgs, fees, diff --git a/benchmarks/bench_test.go b/benchmarks/bench_test.go index 9001f1abf..0cd181f5d 100644 --- a/benchmarks/bench_test.go +++ b/benchmarks/bench_test.go @@ -108,11 +108,11 @@ func BenchmarkTxSending(b *testing.B) { for j := 0; j < blockSize; j++ { idx := i*blockSize + j - _, _, err := appInfo.App.Check(txEncoder, txs[idx]) + _, _, err := appInfo.App.SimCheck(txEncoder, txs[idx]) if err != nil { panic("something is broken in checking transaction") } - _, _, err = appInfo.App.Deliver(txEncoder, txs[idx]) + _, _, err = appInfo.App.SimDeliver(txEncoder, txs[idx]) require.NoError(b, err) } diff --git a/cmd/wasmd/genaccounts.go b/cmd/wasmd/genaccounts.go index 9acf2cea7..448e5fdbb 100644 --- a/cmd/wasmd/genaccounts.go +++ b/cmd/wasmd/genaccounts.go @@ -54,7 +54,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } if keyringBackend != "" && clientCtx.Keyring == nil { var err error - kr, err = keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf) + kr, err = keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, clientCtx.Codec) if err != nil { return err } @@ -66,7 +66,10 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa if err != nil { return fmt.Errorf("failed to get address from Keyring: %w", err) } - addr = info.GetAddress() + addr, err = info.GetAddress() + if err != nil { + return fmt.Errorf("failed to get address from Keyring: %w", err) + } } coins, err := sdk.ParseCoinsNormalized(args[1]) diff --git a/cmd/wasmd/main.go b/cmd/wasmd/main.go index 7bd3d0122..3a7719e6c 100644 --- a/cmd/wasmd/main.go +++ b/cmd/wasmd/main.go @@ -12,7 +12,7 @@ import ( func main() { rootCmd, _ := NewRootCmd() - if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go index 99889afb4..5a6e6accf 100644 --- a/cmd/wasmd/root.go +++ b/cmd/wasmd/root.go @@ -16,6 +16,7 @@ import ( "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" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" @@ -27,6 +28,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/spf13/cobra" + tmcfg "github.com/tendermint/tendermint/config" tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" @@ -83,7 +85,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } - return server.InterceptConfigsPreRunHandler(cmd, "", nil) + return server.InterceptConfigsPreRunHandler(cmd, "", nil, tmcfg.DefaultConfig()) }, } @@ -203,7 +205,7 @@ func (ac appCreator) newApp( } snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) + snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) //nolint:staticcheck if err != nil { panic(err) } @@ -216,6 +218,11 @@ func (ac appCreator) newApp( wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) } + snapshotOptions := snapshottypes.NewSnapshotOptions( + cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), + cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), + ) + return app.NewWasmApp(logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), @@ -231,9 +238,7 @@ func (ac appCreator) newApp( baseapp.SetInterBlockCache(cache), baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), - baseapp.SetSnapshotStore(snapshotStore), - baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))), - baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))), + baseapp.SetSnapshot(snapshotStore, snapshotOptions), ) } diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index ac05cc677..1f2c3a546 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -61,7 +61,7 @@ tools-stamp: statik runsim golangci-lint statik: $(STATIK) $(STATIK): @echo "Installing statik..." - @(cd /tmp && go get github.com/rakyll/statik@v0.1.6) + @(cd /tmp && go install github.com/rakyll/statik@v0.1.6) # Install the runsim binary with a temporary workaround of entering an outside # directory as the "go get" command ignores the -mod option and will polute the @@ -71,12 +71,12 @@ $(STATIK): runsim: $(RUNSIM) $(RUNSIM): @echo "Installing runsim..." - @(cd /tmp && go get github.com/cosmos/tools/cmd/runsim@v1.0.0) + @(cd /tmp && go install github.com/cosmos/tools/cmd/runsim@v1.0.0) golangci-lint: $(GOLANGCI_LINT) $(GOLANGCI_LINT): @echo "Installing golangci-lint..." - @(cd /tmp && go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.28.0) + @(cd /tmp && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47) tools-clean: rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) diff --git a/contrib/local/02-contracts.sh b/contrib/local/02-contracts.sh index ecbadf31e..c445d948b 100755 --- a/contrib/local/02-contracts.sh +++ b/contrib/local/02-contracts.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -o errexit -o nounset -o pipefail +set -o errexit -o nounset -o pipefail -x DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" @@ -9,7 +9,10 @@ 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 block -o json) CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[1].attributes[-1].value') +CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[1].attributes[-2].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" @@ -27,6 +30,17 @@ wasmd tx wasm instantiate "$CODE_ID" "$INIT" --admin="$(wasmd keys show validato CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.contracts[-1]') echo "* Contract address: $CONTRACT" + +echo "## Create new contract instance with predictable address" +wasmd tx wasm instantiate2 "$CODE_ID" "$INIT" $(echo -n "testing" | xxd -ps) \ + --admin="$(wasmd keys show validator -a)" \ + --from validator --amount="100ustake" --label "local0.1.0" \ + --fix-msg \ + --gas 1000000 -y --chain-id=testing -b block -o json | jq + +predictedAdress=$(wasmd q wasm build-address "$CODE_HASH" $(wasmd keys show validator -a) $(echo -n "testing" | xxd -ps) "$INIT") +wasmd q wasm contract "$predictedAdress" -o json | jq + echo "### Query all" RESP=$(wasmd query wasm contract-state all "$CONTRACT" -o json) echo "$RESP" | jq diff --git a/contrib/prototools-docker/Dockerfile b/contrib/prototools-docker/Dockerfile index 7d5af0d1f..3ed6974c2 100644 --- a/contrib/prototools-docker/Dockerfile +++ b/contrib/prototools-docker/Dockerfile @@ -39,7 +39,7 @@ RUN GO111MODULE=on go get \ RUN upx --lzma /usr/local/bin/* -FROM golang:1.17.3-alpine +FROM golang:1.18-alpine ENV LD_LIBRARY_PATH=/lib64:/lib WORKDIR /work diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index f6c0182b6..add638f07 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -23,6 +23,8 @@ - [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) @@ -71,6 +73,8 @@ - [QueryContractInfoResponse](#cosmwasm.wasm.v1.QueryContractInfoResponse) - [QueryContractsByCodeRequest](#cosmwasm.wasm.v1.QueryContractsByCodeRequest) - [QueryContractsByCodeResponse](#cosmwasm.wasm.v1.QueryContractsByCodeResponse) + - [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) + - [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) - [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) - [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) - [QueryRawContractStateRequest](#cosmwasm.wasm.v1.QueryRawContractStateRequest) @@ -117,7 +121,8 @@ AccessConfig access control type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `permission` | [AccessType](#cosmwasm.wasm.v1.AccessType) | | | -| `address` | [string](#string) | | | +| `address` | [string](#string) | | Address Deprecated: replaced by addresses | +| `addresses` | [string](#string) | repeated | | @@ -238,8 +243,9 @@ AccessType permission types | ---- | ------ | ----------- | | ACCESS_TYPE_UNSPECIFIED | 0 | AccessTypeUnspecified placeholder for empty value | | ACCESS_TYPE_NOBODY | 1 | AccessTypeNobody forbidden | -| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to an address | +| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to a single address Deprecated: use AccessTypeAnyOfAddresses instead | | ACCESS_TYPE_EVERYBODY | 3 | AccessTypeEverybody unrestricted | +| ACCESS_TYPE_ANY_OF_ADDRESSES | 4 | AccessTypeAnyOfAddresses allow any of the addresses | @@ -323,7 +329,7 @@ MsgExecuteContractResponse returns execution result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `data` | [bytes](#bytes) | | Data contains base64-encoded bytes to returned from the contract | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | @@ -351,6 +357,45 @@ code id. + + +### MsgInstantiateContract2 +MsgInstantiateContract2 create a new smart contract instance for the given +code id with a predicable address. + + +| 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 | + + + + + + + + +### 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 | + + + + + + ### MsgInstantiateContractResponse @@ -360,7 +405,7 @@ MsgInstantiateContractResponse 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 base64-encoded bytes to returned from the contract | +| `data` | [bytes](#bytes) | | Data contains bytes to returned from the contract | @@ -426,6 +471,7 @@ MsgStoreCodeResponse returns store result data. | 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 | @@ -473,7 +519,8 @@ 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) | Instantiate creates a new smart contract instance for the given code id. | | +| `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 | | @@ -555,7 +602,7 @@ order. The intention is to have more human readable data that is auditable. | ----- | ---- | ----- | ----------- | | `store_code` | [MsgStoreCode](#cosmwasm.wasm.v1.MsgStoreCode) | | | | `instantiate_contract` | [MsgInstantiateContract](#cosmwasm.wasm.v1.MsgInstantiateContract) | | | -| `execute_contract` | [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) | | | +| `execute_contract` | [MsgExecuteContract](#cosmwasm.wasm.v1.MsgExecuteContract) | | MsgInstantiateContract2 intentionally not supported see https://github.com/CosmWasm/wasmd/issues/987 | @@ -774,6 +821,7 @@ StoreCodeProposal gov proposal content type to submit WASM code to the system | `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 | @@ -1083,6 +1131,31 @@ Query/ContractsByCode RPC method + + +### QueryParamsRequest +QueryParamsRequest is the request type for the Query/Params RPC method. + + + + + + + + +### QueryParamsResponse +QueryParamsResponse is the response type for the Query/Params RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the parameters of the module. | + + + + + + ### QueryPinnedCodesRequest @@ -1204,6 +1277,7 @@ Query provides defines the gRPC querier service | `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| diff --git a/docs/proto/proto.md b/docs/proto/proto.md deleted file mode 100644 index 6637b9a28..000000000 --- a/docs/proto/proto.md +++ /dev/null @@ -1,1121 +0,0 @@ -# Protocol Documentation - - -## Table of Contents - -- [x/wasm/types/genesis.proto](#x/wasm/types/genesis.proto) - - [Code](#cosmwasm.wasm.v1beta1.Code) - - [Contract](#cosmwasm.wasm.v1beta1.Contract) - - [GenesisState](#cosmwasm.wasm.v1beta1.GenesisState) - - [GenesisState.GenMsgs](#cosmwasm.wasm.v1beta1.GenesisState.GenMsgs) - - [Sequence](#cosmwasm.wasm.v1beta1.Sequence) - -- [x/wasm/types/ibc.proto](#x/wasm/types/ibc.proto) - - [MsgIBCCloseChannel](#cosmwasm.wasm.v1beta1.MsgIBCCloseChannel) - - [MsgIBCSend](#cosmwasm.wasm.v1beta1.MsgIBCSend) - -- [x/wasm/types/proposal.proto](#x/wasm/types/proposal.proto) - - [ClearAdminProposal](#cosmwasm.wasm.v1beta1.ClearAdminProposal) - - [InstantiateContractProposal](#cosmwasm.wasm.v1beta1.InstantiateContractProposal) - - [MigrateContractProposal](#cosmwasm.wasm.v1beta1.MigrateContractProposal) - - [PinCodesProposal](#cosmwasm.wasm.v1beta1.PinCodesProposal) - - [StoreCodeProposal](#cosmwasm.wasm.v1beta1.StoreCodeProposal) - - [UnpinCodesProposal](#cosmwasm.wasm.v1beta1.UnpinCodesProposal) - - [UpdateAdminProposal](#cosmwasm.wasm.v1beta1.UpdateAdminProposal) - -- [x/wasm/types/query.proto](#x/wasm/types/query.proto) - - [CodeInfoResponse](#cosmwasm.wasm.v1beta1.CodeInfoResponse) - - [ContractInfoWithAddress](#cosmwasm.wasm.v1beta1.ContractInfoWithAddress) - - [QueryAllContractStateRequest](#cosmwasm.wasm.v1beta1.QueryAllContractStateRequest) - - [QueryAllContractStateResponse](#cosmwasm.wasm.v1beta1.QueryAllContractStateResponse) - - [QueryCodeRequest](#cosmwasm.wasm.v1beta1.QueryCodeRequest) - - [QueryCodeResponse](#cosmwasm.wasm.v1beta1.QueryCodeResponse) - - [QueryCodesRequest](#cosmwasm.wasm.v1beta1.QueryCodesRequest) - - [QueryCodesResponse](#cosmwasm.wasm.v1beta1.QueryCodesResponse) - - [QueryContractHistoryRequest](#cosmwasm.wasm.v1beta1.QueryContractHistoryRequest) - - [QueryContractHistoryResponse](#cosmwasm.wasm.v1beta1.QueryContractHistoryResponse) - - [QueryContractInfoRequest](#cosmwasm.wasm.v1beta1.QueryContractInfoRequest) - - [QueryContractInfoResponse](#cosmwasm.wasm.v1beta1.QueryContractInfoResponse) - - [QueryContractsByCodeRequest](#cosmwasm.wasm.v1beta1.QueryContractsByCodeRequest) - - [QueryContractsByCodeResponse](#cosmwasm.wasm.v1beta1.QueryContractsByCodeResponse) - - [QueryRawContractStateRequest](#cosmwasm.wasm.v1beta1.QueryRawContractStateRequest) - - [QueryRawContractStateResponse](#cosmwasm.wasm.v1beta1.QueryRawContractStateResponse) - - [QuerySmartContractStateRequest](#cosmwasm.wasm.v1beta1.QuerySmartContractStateRequest) - - [QuerySmartContractStateResponse](#cosmwasm.wasm.v1beta1.QuerySmartContractStateResponse) - - - [Query](#cosmwasm.wasm.v1beta1.Query) - -- [x/wasm/types/tx.proto](#x/wasm/types/tx.proto) - - [MsgClearAdmin](#cosmwasm.wasm.v1beta1.MsgClearAdmin) - - [MsgClearAdminResponse](#cosmwasm.wasm.v1beta1.MsgClearAdminResponse) - - [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) - - [MsgExecuteContractResponse](#cosmwasm.wasm.v1beta1.MsgExecuteContractResponse) - - [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) - - [MsgInstantiateContractResponse](#cosmwasm.wasm.v1beta1.MsgInstantiateContractResponse) - - [MsgMigrateContract](#cosmwasm.wasm.v1beta1.MsgMigrateContract) - - [MsgMigrateContractResponse](#cosmwasm.wasm.v1beta1.MsgMigrateContractResponse) - - [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) - - [MsgStoreCodeResponse](#cosmwasm.wasm.v1beta1.MsgStoreCodeResponse) - - [MsgUpdateAdmin](#cosmwasm.wasm.v1beta1.MsgUpdateAdmin) - - [MsgUpdateAdminResponse](#cosmwasm.wasm.v1beta1.MsgUpdateAdminResponse) - - - [Msg](#cosmwasm.wasm.v1beta1.Msg) - -- [x/wasm/types/types.proto](#x/wasm/types/types.proto) - - [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) - - [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) - - [AccessTypeParam](#cosmwasm.wasm.v1beta1.AccessTypeParam) - - [CodeInfo](#cosmwasm.wasm.v1beta1.CodeInfo) - - [ContractCodeHistoryEntry](#cosmwasm.wasm.v1beta1.ContractCodeHistoryEntry) - - [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) - - [Model](#cosmwasm.wasm.v1beta1.Model) - - [Params](#cosmwasm.wasm.v1beta1.Params) - - - [AccessType](#cosmwasm.wasm.v1beta1.AccessType) - - [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) - -- [Scalar Value Types](#scalar-value-types) - - - - -

Top

- -## x/wasm/types/genesis.proto - - - - - -### Code -Code struct encompasses CodeInfo and CodeBytes - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | | -| code_info | [CodeInfo](#cosmwasm.wasm.v1beta1.CodeInfo) | | | -| code_bytes | [bytes](#bytes) | | | -| pinned | [bool](#bool) | | Pinned to wasmvm cache | - - - - - - - - -### Contract -Contract struct encompasses ContractAddress, ContractInfo, and ContractState - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| contract_address | [string](#string) | | | -| contract_info | [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) | | | -| contract_state | [Model](#cosmwasm.wasm.v1beta1.Model) | repeated | | - - - - - - - - -### GenesisState -GenesisState - genesis state of x/wasm - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| params | [Params](#cosmwasm.wasm.v1beta1.Params) | | | -| codes | [Code](#cosmwasm.wasm.v1beta1.Code) | repeated | | -| contracts | [Contract](#cosmwasm.wasm.v1beta1.Contract) | repeated | | -| sequences | [Sequence](#cosmwasm.wasm.v1beta1.Sequence) | repeated | | -| gen_msgs | [GenesisState.GenMsgs](#cosmwasm.wasm.v1beta1.GenesisState.GenMsgs) | repeated | | - - - - - - - - -### 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 | -| ----- | ---- | ----- | ----------- | -| store_code | [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) | | | -| instantiate_contract | [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) | | | -| execute_contract | [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) | | | - - - - - - - - -### Sequence -Sequence key and value of an id generation counter - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id_key | [bytes](#bytes) | | | -| value | [uint64](#uint64) | | | - - - - - - - - - - - - - - - - -

Top

- -## x/wasm/types/ibc.proto - - - - - -### MsgIBCCloseChannel -MsgIBCCloseChannel port and channel need to be owned by the contract - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| channel | [string](#string) | | | - - - - - - - - -### MsgIBCSend -MsgIBCSend - - -| 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 | - - - - - - - - - - - - - - - - -

Top

- -## x/wasm/types/proposal.proto - - - - - -### ClearAdminProposal -ClearAdminProposal gov proposal content type to clear the admin of a contract. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| 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 | - - - - - - - - -### InstantiateContractProposal -InstantiateContractProposal gov proposal content type to instantiate a contract. - - -| 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. | -| init_msg | [bytes](#bytes) | | InitMsg 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 | - - - - - - - - -### MigrateContractProposal -MigrateContractProposal gov proposal content type to migrate a contract. - - -| 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 | -| code_id | [uint64](#uint64) | | CodeID references the new WASM code | -| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | - - - - - - - - -### PinCodesProposal -PinCodesProposal gov proposal content type to pin a set of code ids in the wasmvm cache. - - -| 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 | - - - - - - - - -### StoreCodeProposal -StoreCodeProposal gov proposal content type to 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 | -| 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 | -| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | -| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | - - - - - - - - -### UnpinCodesProposal -UnpinCodesProposal gov proposal content type to unpin a set of code ids in the wasmvm cache. - - -| 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 | - - - - - - - - -### UpdateAdminProposal -UpdateAdminProposal gov proposal content type to set an admin for a contract. - - -| 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 | - - - - - - - - - - - - - - - - -

Top

- -## x/wasm/types/query.proto - - - - - -### CodeInfoResponse -CodeInfoResponse contains code meta data from CodeInfo - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | id for legacy support | -| creator | [string](#string) | | | -| data_hash | [bytes](#bytes) | | | -| source | [string](#string) | | | -| builder | [string](#string) | | | - - - - - - - - -### ContractInfoWithAddress -ContractInfoWithAddress adds the address (key) to the ContractInfo representation - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| address | [string](#string) | | | -| contract_info | [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) | | | - - - - - - - - -### QueryAllContractStateRequest -QueryAllContractStateRequest is the request type for the Query/AllContractState RPC method - - -| 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. | - - - - - - - - -### QueryAllContractStateResponse -QueryAllContractStateResponse is the response type for the Query/AllContractState RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| models | [Model](#cosmwasm.wasm.v1beta1.Model) | repeated | | -| pagination | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - - - - - - - - -### QueryCodeRequest -QueryCodeRequest is the request type for the Query/Code RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | grpc-gateway_out does not support Go style CodID | - - - - - - - - -### QueryCodeResponse -QueryCodeResponse is the response type for the Query/Code RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_info | [CodeInfoResponse](#cosmwasm.wasm.v1beta1.CodeInfoResponse) | | | -| data | [bytes](#bytes) | | | - - - - - - - - -### QueryCodesRequest -QueryCodesRequest is the request type for the Query/Codes RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| pagination | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - - - - - - - - -### QueryCodesResponse -QueryCodesResponse is the response type for the Query/Codes RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_infos | [CodeInfoResponse](#cosmwasm.wasm.v1beta1.CodeInfoResponse) | repeated | | -| pagination | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - - - - - - - - -### 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. | - - - - - - - - -### QueryContractHistoryResponse -QueryContractHistoryResponse is the response type for the Query/ContractHistory RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| entries | [ContractCodeHistoryEntry](#cosmwasm.wasm.v1beta1.ContractCodeHistoryEntry) | repeated | | -| pagination | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - - - - - - - - -### QueryContractInfoRequest -QueryContractInfoRequest is the request type for the Query/ContractInfo RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| address | [string](#string) | | address is the address of the contract to query | - - - - - - - - -### QueryContractInfoResponse -QueryContractInfoResponse is the response type for the Query/ContractInfo RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| address | [string](#string) | | address is the address of the contract | -| contract_info | [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) | | | - - - - - - - - -### QueryContractsByCodeRequest -QueryContractsByCodeRequest is the request type for the Query/ContractsByCode RPC method - - -| 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. | - - - - - - - - -### QueryContractsByCodeResponse -QueryContractsByCodeResponse is the response type for the Query/ContractsByCode RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| contract_infos | [ContractInfoWithAddress](#cosmwasm.wasm.v1beta1.ContractInfoWithAddress) | repeated | | -| pagination | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - - - - - - - - -### QueryRawContractStateRequest -QueryRawContractStateRequest is the request type for the Query/RawContractState RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| address | [string](#string) | | address is the address of the contract | -| query_data | [bytes](#bytes) | | | - - - - - - - - -### 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 | - - - - - - - - -### QuerySmartContractStateRequest -QuerySmartContractStateRequest is the request type for the Query/SmartContractState RPC method - - -| 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 | - - - - - - - - -### QuerySmartContractStateResponse -QuerySmartContractStateResponse is the response type for the Query/SmartContractState RPC method - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| data | [bytes](#bytes) | | Data contains the json data returned from the smart contract | - - - - - - - - - - - - - - -### Query -Query provides defines the gRPC querier service - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| ContractInfo | [QueryContractInfoRequest](#cosmwasm.wasm.v1beta1.QueryContractInfoRequest) | [QueryContractInfoResponse](#cosmwasm.wasm.v1beta1.QueryContractInfoResponse) | ContractInfo gets the contract meta data | -| ContractHistory | [QueryContractHistoryRequest](#cosmwasm.wasm.v1beta1.QueryContractHistoryRequest) | [QueryContractHistoryResponse](#cosmwasm.wasm.v1beta1.QueryContractHistoryResponse) | ContractHistory gets the contract code history | -| ContractsByCode | [QueryContractsByCodeRequest](#cosmwasm.wasm.v1beta1.QueryContractsByCodeRequest) | [QueryContractsByCodeResponse](#cosmwasm.wasm.v1beta1.QueryContractsByCodeResponse) | ContractsByCode lists all smart contracts for a code id | -| AllContractState | [QueryAllContractStateRequest](#cosmwasm.wasm.v1beta1.QueryAllContractStateRequest) | [QueryAllContractStateResponse](#cosmwasm.wasm.v1beta1.QueryAllContractStateResponse) | AllContractState gets all raw store data for a single contract | -| RawContractState | [QueryRawContractStateRequest](#cosmwasm.wasm.v1beta1.QueryRawContractStateRequest) | [QueryRawContractStateResponse](#cosmwasm.wasm.v1beta1.QueryRawContractStateResponse) | RawContractState gets single key from the raw store data of a contract | -| SmartContractState | [QuerySmartContractStateRequest](#cosmwasm.wasm.v1beta1.QuerySmartContractStateRequest) | [QuerySmartContractStateResponse](#cosmwasm.wasm.v1beta1.QuerySmartContractStateResponse) | SmartContractState get smart query result from the contract | -| Code | [QueryCodeRequest](#cosmwasm.wasm.v1beta1.QueryCodeRequest) | [QueryCodeResponse](#cosmwasm.wasm.v1beta1.QueryCodeResponse) | Code gets the binary code and metadata for a singe wasm code | -| Codes | [QueryCodesRequest](#cosmwasm.wasm.v1beta1.QueryCodesRequest) | [QueryCodesResponse](#cosmwasm.wasm.v1beta1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | - - - - - - -

Top

- -## x/wasm/types/tx.proto - - - - - -### MsgClearAdmin -MsgClearAdmin removes any admin stored for 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 | - - - - - - - - -### 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 | - - - - - - - - -### MsgExecuteContractResponse -MsgExecuteContractResponse returns execution result data. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| data | [bytes](#bytes) | | Data contains base64-encoded bytes to returned from the contract | - - - - - - - - -### MsgInstantiateContract -MsgInstantiateContract create a new smart contract instance for the given code id. - - -| 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. | -| init_msg | [bytes](#bytes) | | InitMsg 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 | - - - - - - - - -### MsgInstantiateContractResponse -MsgInstantiateContractResponse 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 base64-encoded bytes to returned from the contract | - - - - - - - - -### MsgMigrateContract -MsgMigrateContract runs a code upgrade/ downgrade for 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 | -| code_id | [uint64](#uint64) | | CodeID references the new WASM code | -| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | - - - - - - - - -### MsgMigrateContractResponse -MsgMigrateContractResponse returns contract migration result data. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| data | [bytes](#bytes) | | Data contains same raw bytes returned as data from the wasm contract. (May be empty) | - - - - - - - - -### MsgStoreCode -MsgStoreCode submit Wasm code to the system - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | -| wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | -| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | -| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | - - - - - - - - -### MsgStoreCodeResponse -MsgStoreCodeResponse returns store result data. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | - - - - - - - - -### MsgUpdateAdmin -MsgUpdateAdmin sets a new admin for a smart contract - - -| 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 | - - - - - - - - -### MsgUpdateAdminResponse -MsgUpdateAdminResponse returns empty data - - - - - - - - - - - - - - -### Msg -Msg defines the wasm Msg service. - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| StoreCode | [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) | [MsgStoreCodeResponse](#cosmwasm.wasm.v1beta1.MsgStoreCodeResponse) | StoreCode to submit Wasm code to the system | -| InstantiateContract | [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) | [MsgInstantiateContractResponse](#cosmwasm.wasm.v1beta1.MsgInstantiateContractResponse) | Instantiate creates a new smart contract instance for the given code id. | -| ExecuteContract | [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) | [MsgExecuteContractResponse](#cosmwasm.wasm.v1beta1.MsgExecuteContractResponse) | Execute submits the given message data to a smart contract | -| MigrateContract | [MsgMigrateContract](#cosmwasm.wasm.v1beta1.MsgMigrateContract) | [MsgMigrateContractResponse](#cosmwasm.wasm.v1beta1.MsgMigrateContractResponse) | Migrate runs a code upgrade/ downgrade for a smart contract | -| UpdateAdmin | [MsgUpdateAdmin](#cosmwasm.wasm.v1beta1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1beta1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | -| ClearAdmin | [MsgClearAdmin](#cosmwasm.wasm.v1beta1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1beta1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | - - - - - - -

Top

- -## x/wasm/types/types.proto - - - - - -### AbsoluteTxPosition -AbsoluteTxPosition is a unique transaction position that allows for global ordering of transactions. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| block_height | [uint64](#uint64) | | BlockHeight is the block the contract was created at | -| tx_index | [uint64](#uint64) | | TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed) | - - - - - - - - -### AccessConfig -AccessConfig access control type. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | -| address | [string](#string) | | | - - - - - - - - -### AccessTypeParam -AccessTypeParam - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| value | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | - - - - - - - - -### CodeInfo -CodeInfo is data for the uploaded contract WASM code - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_hash | [bytes](#bytes) | | CodeHash is the unique identifier created by wasmvm | -| creator | [string](#string) | | Creator address who initially stored the code | -| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | -| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_config | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiateConfig access control to apply on contract creation, optional | - - - - - - - - -### ContractCodeHistoryEntry -ContractCodeHistoryEntry metadata to a contract. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| operation | [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) | | | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| updated | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Updated Tx position when the operation was executed. | -| msg | [bytes](#bytes) | | | - - - - - - - - -### ContractInfo -ContractInfo stores a WASM contract instance - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored Wasm code | -| creator | [string](#string) | | Creator address who initially instantiated the contract | -| admin | [string](#string) | | Admin is an optional address that can execute migrations | -| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | -| created | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting | -| ibc_port_id | [string](#string) | | | - - - - - - - - -### Model -Model is a struct that holds a KV pair - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| key | [bytes](#bytes) | | hex-encode key to read it better (this is often ascii) | -| value | [bytes](#bytes) | | base64-encode raw value | - - - - - - - - -### Params -Params defines the set of wasm parameters. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| code_upload_access | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | | -| instantiate_default_permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | -| max_wasm_code_size | [uint64](#uint64) | | | - - - - - - - - - - -### AccessType -AccessType permission types - -| Name | Number | Description | -| ---- | ------ | ----------- | -| ACCESS_TYPE_UNSPECIFIED | 0 | AccessTypeUnspecified placeholder for empty value | -| ACCESS_TYPE_NOBODY | 1 | AccessTypeNobody forbidden | -| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to an address | -| ACCESS_TYPE_EVERYBODY | 3 | AccessTypeEverybody unrestricted | - - - - - -### ContractCodeHistoryOperationType -ContractCodeHistoryOperationType actions that caused a code change - -| Name | Number | Description | -| ---- | ------ | ----------- | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED | 0 | ContractCodeHistoryOperationTypeUnspecified placeholder for empty value | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT | 1 | ContractCodeHistoryOperationTypeInit on chain contract instantiation | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE | 2 | ContractCodeHistoryOperationTypeMigrate code migration | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS | 3 | ContractCodeHistoryOperationTypeGenesis based on genesis data | - - - - - - - - - - -## Scalar Value Types - -| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | -| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | -| double | | double | double | float | float64 | double | float | Float | -| float | | float | float | float | float32 | float | float | Float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | -| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | - diff --git a/go.mod b/go.mod index 413ea998d..14204b414 100644 --- a/go.mod +++ b/go.mod @@ -1,136 +1,164 @@ module github.com/CosmWasm/wasmd -go 1.17 +go 1.18 require ( - github.com/CosmWasm/wasmvm v1.0.0 - github.com/cosmos/cosmos-sdk v0.45.4 - github.com/cosmos/iavl v0.17.3 - github.com/cosmos/ibc-go/v3 v3.0.0 - github.com/cosmos/interchain-accounts v0.1.0 - github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b + cosmossdk.io/errors v1.0.0-beta.7 + cosmossdk.io/math v1.0.0-beta.3 + github.com/CosmWasm/wasmvm v1.1.1 + github.com/cosmos/cosmos-sdk v0.46.1 + github.com/cosmos/iavl v0.19.1 + github.com/cosmos/ibc-go/v5 v5.0.0 + github.com/cosmos/interchain-accounts v0.3.2 + github.com/dvsekhvalnov/jose2go v1.5.0 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/google/gofuzz v1.2.0 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.12.2 + github.com/prometheus/client_golang v1.13.0 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.1 github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/cast v1.5.0 - github.com/spf13/cobra v1.4.0 + github.com/spf13/cobra v1.5.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.11.0 - github.com/stretchr/testify v1.7.2 - github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca - github.com/tendermint/tendermint v0.34.19 + github.com/spf13/viper v1.13.0 + github.com/stretchr/testify v1.8.0 + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/tendermint/tendermint v0.34.21 github.com/tendermint/tm-db v0.6.7 - google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac - google.golang.org/grpc v1.45.0 + google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b + google.golang.org/grpc v1.49.0 gopkg.in/yaml.v2 v2.4.0 ) require ( - filippo.io/edwards25519 v1.0.0-beta.2 // indirect - github.com/99designs/keyring v1.1.6 // indirect + cloud.google.com/go v0.100.2 // indirect + cloud.google.com/go/compute v1.6.1 // indirect + cloud.google.com/go/iam v0.3.0 // indirect + cloud.google.com/go/storage v1.14.0 // indirect + filippo.io/edwards25519 v1.0.0-rc.1 // 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/DataDog/zstd v1.4.5 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect - github.com/armon/go-metrics v0.3.10 // indirect + github.com/armon/go-metrics v0.4.0 // indirect + github.com/aws/aws-sdk-go v1.40.45 // 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.0 // indirect - github.com/btcsuite/btcd v0.22.0-beta // indirect + github.com/btcsuite/btcd v0.22.1 // indirect + github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect + github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/confio/ics23/go v0.7.0 // indirect github.com/cosmos/btcutil v1.0.4 // indirect + github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect - github.com/danieljoos/wincred v1.0.2 // indirect + github.com/creachadair/taskgroup v0.3.2 // indirect + github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect - github.com/dgraph-io/badger/v2 v2.2007.2 // indirect - github.com/dgraph-io/ristretto v0.0.3 // indirect + github.com/dgraph-io/badger/v2 v2.2007.4 // indirect + github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-kit/kit v0.12.0 // indirect - github.com/go-kit/log v0.2.0 // indirect + github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/snappy v0.0.3 // indirect - github.com/google/btree v1.0.0 // indirect + github.com/golang/glog v1.0.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/googleapis/gax-go/v2 v2.4.0 // 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/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.6.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/golang-lru v0.5.4 // 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/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect - github.com/improbable-eng/grpc-web v0.14.1 // indirect + github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect - github.com/klauspost/compress v1.13.6 // indirect - github.com/lib/pq v1.10.4 // indirect - github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/klauspost/compress v1.15.9 // indirect + github.com/lib/pq v1.10.6 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect github.com/minio/highwayhash v1.0.2 // indirect - github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect - github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.32.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect + github.com/rogpeppe/go-internal v1.8.1 // indirect github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.26.0 // indirect + github.com/rs/zerolog v1.27.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.4.1 // indirect github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/zondax/hid v0.9.0 // indirect + github.com/ulikunitz/xz v0.5.8 // indirect + github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + go.opencensus.io v0.23.0 // indirect + golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect + golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect + golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 // indirect + golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/ini.v1 v1.66.4 // indirect + golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect + google.golang.org/api v0.81.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( - // Use the cosmos-flavored keyring library - github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 - github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1 // latest grpc doesn't work with with our modified proto compiler, so we need to enforce // the following version across all dependencies. github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - google.golang.org/grpc => google.golang.org/grpc v1.33.2 ) diff --git a/go.sum b/go.sum index d75e51f2a..63262c95d 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,14 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= +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.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= 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.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= 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= @@ -28,8 +29,8 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= 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= @@ -37,13 +38,17 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf 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/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1 h1:2sMmt8prCn7DPaG4Pmh0N3Inmc8cT8ae5k1M6VJ9Wqc= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= 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/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= +cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= +cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= 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= @@ -53,65 +58,50 @@ 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 h1:6RRlFMv1omScs6iq2hfE3IvgE+l6RfJPampq8UZc5TU= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= +cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= +cosmossdk.io/math v1.0.0-beta.3 h1:TbZxSopz2LqjJ7aXYfn7nJSb8vNaBklW6BLpcei1qwM= +cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT9XdE4= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= -filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= +filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= +git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +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/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= +github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= 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.0.0 h1:NRmnHe3xXsKn2uEcB1F5Ha323JVAhON+BI6L177dlKc= -github.com/CosmWasm/wasmvm v1.0.0/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/CosmWasm/wasmvm v1.1.1 h1:0xtdrmmsP9fibe+x42WcMkp5aQ738BICgcH3FNVLzm4= +github.com/CosmWasm/wasmvm v1.1.1/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= -github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/DataDog/zstd v1.5.0/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.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= -github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= 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= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= 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/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= -github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= -github.com/adlio/schema v1.3.0 h1:eSVYLxYWbm/6ReZBCkLw4Fz7uqC+ZNoPvA39bOwi52A= -github.com/adlio/schema v1.3.0/go.mod h1:51QzxkpeFs6lRY11kPye26IaFPOV+HqEj01t5aXXKfs= +github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -121,44 +111,53 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= 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.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= +github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/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.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.40.45 h1:QN1nsY27ssD/JmW4s83qmSb+uL6DG4GmCDzjmJB4xUI= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= -github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= 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= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= +github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= -github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= -github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= +github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= +github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= @@ -173,167 +172,173 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= 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.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +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/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= 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/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= 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-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 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-20211130200136-a8f946100490/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/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= -github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= -github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= +github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= +github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= github.com/confio/ics23/go v0.7.0 h1:00d2kukk7sPoHWL4zZBZwzxnpA2pec1NPdwbSokJ5w8= github.com/confio/ics23/go v0.7.0/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= -github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= -github.com/containerd/continuity v0.2.1 h1:/EeEo2EtN3umhbbgCveyjifoMYg0pS+nMMEemaYw634= -github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= +github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= +github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+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= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= -github.com/cosmos/cosmos-sdk v0.45.1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ= -github.com/cosmos/cosmos-sdk v0.45.4 h1:eStDAhJdMY8n5arbBRe+OwpNeBSunxSBHp1g55ulfdA= -github.com/cosmos/cosmos-sdk v0.45.4/go.mod h1:WOqtDxN3eCCmnYLVla10xG7lEXkFjpTaqm2a2WasgCc= +github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= +github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= +github.com/cosmos/cosmos-sdk v0.46.1 h1:7vUZXMyrmEb4xtBYpz1TobtrcnpgiZTi+tVjc0XWB4o= +github.com/cosmos/cosmos-sdk v0.46.1/go.mod h1:2+o8Qw8qnE02V+lQVZDJFQ8tri/hsiA5GmWaPERqVa0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= 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/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= -github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= -github.com/cosmos/ibc-go/v3 v3.0.0 h1:XUNplHVS51Q2gMnTFsFsH9QJ7flsovMamnltKbEgPQ4= -github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= -github.com/cosmos/interchain-accounts v0.1.0 h1:QmuwNsf1Hxl3P5GSGt7Z+JeuHPiZw4Z34R/038P5T6s= -github.com/cosmos/interchain-accounts v0.1.0/go.mod h1:Fv6LXDs+0ng4mIDVWwEJMXbAIMxY4kiq+A7Bw1Fb9AY= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= +github.com/cosmos/iavl v0.19.1 h1:3gaq9b6SjiB0KBTygRnAvEGml2pQlu1TH8uma5g63Ys= +github.com/cosmos/iavl v0.19.1/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/ibc-go/v5 v5.0.0 h1:MkObdarpoICPHXoRg/Ne9NRix4j7eQlJZq74/uzH3Zc= +github.com/cosmos/ibc-go/v5 v5.0.0/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= +github.com/cosmos/interchain-accounts v0.3.2 h1:7S5rSndahpjkzUvG00kKZrTZsEuVHuVC9a7p0qDVcF8= +github.com/cosmos/interchain-accounts v0.3.2/go.mod h1:vNWr9YxBrI5c74jBwk9ooiUCIDvdOJeF8MQEA/z0IEk= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= 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.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= +github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= 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/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= +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/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= 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.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= -github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= +github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= +github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= 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/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= 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.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= +github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= -github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= +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/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 v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +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.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= +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.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +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 v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= -github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= 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/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= 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.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= 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.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= -github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +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/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= 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= @@ -343,49 +348,56 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO 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.0 h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw= github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +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= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +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 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= 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/pool v0.2.0/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 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM= +github.com/goccy/go-json v0.9.7/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= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/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/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/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= @@ -415,13 +427,15 @@ github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 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= @@ -434,16 +448,19 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ 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.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/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.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= 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/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= github.com/google/martian/v3 v3.2.1/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= @@ -466,15 +483,17 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/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.2.0/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/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= 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/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= 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= @@ -483,22 +502,17 @@ github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/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/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= -github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= 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-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= 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= @@ -509,81 +523,81 @@ 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.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= 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-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-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-getter v1.6.1 h1:NASsgP4q6tL94WH6nJxKWj8As2H/2kop/bB1d8JMyRY= +github.com/hashicorp/go-getter v1.6.1/go.mod h1:IZCrswsZPeWv9IkVnLElzRU/gz/QPi6pZHn4tv6vbwA= 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-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-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= 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-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= 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-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 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.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +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/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/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= -github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= -github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= +github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/iancoleman/strcase v0.2.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.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= -github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= +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 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= +github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= +github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= +github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= +github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= +github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= +github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= 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= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= @@ -600,28 +614,31 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= +github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= 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.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -630,71 +647,69 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= -github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= +github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +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/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= -github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= +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.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= 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.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= 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/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 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= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -703,7 +718,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -714,118 +729,86 @@ github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= -github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= 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/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/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= 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.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= -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.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= 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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= -github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= 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.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= -github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runc v1.0.3 h1:1hbqejyQWCJBvtKAfdO0b1FmaEf2z/bxnjqbARass5k= -github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= +github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= 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= +github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= 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/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= 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/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= -github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= 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= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= +github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= 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 v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= +github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= 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/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +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.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= 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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= 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= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= 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.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= 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= @@ -835,30 +818,26 @@ github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2 github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= 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.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= 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.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 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.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= @@ -869,44 +848,40 @@ github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzy github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo= -github.com/rs/zerolog v1.26.0 h1:ORM4ibhEZeTeQlCojCK2kPz1ogAY4bGs4tD+SaAdGaE= -github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo= +github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= +github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= 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/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= -github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= -github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 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.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= 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= @@ -917,23 +892,15 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO 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.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= 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.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= -github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= 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= @@ -942,26 +909,17 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn 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.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= -github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= -github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= -github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= +github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= 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/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/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.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 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= @@ -969,53 +927,54 @@ 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 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +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/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= 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/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= -github.com/tendermint/tendermint v0.34.19 h1:y0P1qI5wSa9IRuhKnTDA6IUcOrLi1hXJuALR+R7HFEk= -github.com/tendermint/tendermint v0.34.19/go.mod h1:R5+wgIwSxMdKQcmOaeudL0Cjkr3HDkhpcdum6VeU3R4= -github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tendermint/tendermint v0.34.21 h1:UiGGnBFHVrZhoQVQ7EfwSOLuCtarqCSsRf8VrklqB7s= +github.com/tendermint/tendermint v0.34.21/go.mod h1:XDvfg6U7grcFTDx7VkzxnhazQ/bspGJAn4DZ6DcLLjQ= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= -github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= -github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg= +github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= +github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +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.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +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/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= +github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= -github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1023,25 +982,13 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 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.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 h1:O9XLFXGkVswDFmH9LaYpqu+r/AAFWqr0DL6V00KEVFg= +github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= -go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= -go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= 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= @@ -1050,23 +997,18 @@ 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.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= 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/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= 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.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 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.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 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= @@ -1076,34 +1018,27 @@ golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8U 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-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= 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-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/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-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +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.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/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-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= 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= @@ -1112,9 +1047,12 @@ 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-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= 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= @@ -1128,22 +1066,19 @@ golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/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/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= 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.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1155,14 +1090,12 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn 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-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 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-20190923162816-aa69164e4478/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= @@ -1180,33 +1113,31 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R 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-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 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-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-20210220033124-5f55cee0dc0d/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-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/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= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E= +golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= 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= @@ -1218,15 +1149,14 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 h1:OSnWWcOd/CtWQC2cYSBgbTSJv3ciqd8r54ySIW2y3RE= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= 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= @@ -1239,7 +1169,9 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ 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.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1256,30 +1188,24 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w 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-20190606203320-7fc4e5ec1444/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-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/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-20191210023423-ac6580df4449/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-20200107162124-548cf772de50/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-20200124204421-9fbb57f87de9/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= @@ -1296,29 +1222,26 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w 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-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/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-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/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-20210303074136-134d130e1a04/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-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/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-20210426230700-d19ff857e887/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-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1329,14 +1252,12 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/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-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210903071746-97244b99971b/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-20210917161153-d61c044b1678/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-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/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-20211205182925-97ca703d548d/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= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1344,13 +1265,17 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 h1:fqTvyMIIj+HRzMmnzr9NtpHP6uVpvB5fkHcgPDC4nu8= +golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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= @@ -1365,10 +1290,12 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb 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.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/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= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/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= @@ -1382,12 +1309,10 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw 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-20190907020128-2ca718005c18/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-20191112195655-aa38f8e97acc/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= @@ -1396,7 +1321,7 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn 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-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200108203644-89082a384178/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= @@ -1411,10 +1336,8 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc 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-20200522201501-cb1345f3a375/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-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 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= @@ -1423,7 +1346,6 @@ golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4f 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-20201224043029-2b0845dc783e/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= @@ -1433,15 +1355,17 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 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.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= 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= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= @@ -1466,7 +1390,6 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= @@ -1475,20 +1398,24 @@ google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6 google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.81.0 h1:o8WF5AvfidafWbFjsRyupxyEQJNUWxLZJCK5NXrxZZ8= +google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= +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 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= 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= @@ -1497,6 +1424,7 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn 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-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 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= @@ -1504,6 +1432,7 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx 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-20200108215221-bd8f9a0ef82f/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= @@ -1526,7 +1455,6 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D 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-20201119123407-9b1e624d6bc4/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= @@ -1553,17 +1481,11 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= @@ -1571,10 +1493,54 @@ google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac h1:qSNTkEN+L2mvWcLgJOR+8bdHX9rN/IdU3A1Ghpfb1Rg= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b h1:SfSkJugek6xm7lWywqth4r2iTrYLpD8lOj1nMIIhMNM= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +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.19.1/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.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= 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,28 +1552,26 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= -gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1630,6 +1594,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C 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/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +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= @@ -1637,12 +1602,17 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh 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= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= 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.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g= +pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/proto/cosmwasm/wasm/v1/genesis.proto b/proto/cosmwasm/wasm/v1/genesis.proto index f02f33075..87373e18d 100644 --- a/proto/cosmwasm/wasm/v1/genesis.proto +++ b/proto/cosmwasm/wasm/v1/genesis.proto @@ -33,6 +33,8 @@ message GenesisState { MsgStoreCode store_code = 1; MsgInstantiateContract instantiate_contract = 2; MsgExecuteContract execute_contract = 3; + // MsgInstantiateContract2 intentionally not supported + // see https://github.com/CosmWasm/wasmd/issues/987 } } } diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto index 68eae73a1..25bf2700b 100644 --- a/proto/cosmwasm/wasm/v1/proposal.proto +++ b/proto/cosmwasm/wasm/v1/proposal.proto @@ -24,6 +24,8 @@ message StoreCodeProposal { reserved 5, 6; // InstantiatePermission to apply on contract creation, optional AccessConfig instantiate_permission = 7; + // UnpinCode code on upload, optional + bool unpin_code = 8; } // InstantiateContractProposal gov proposal content type to instantiate a diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index b7f7a0627..41d959d80 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -58,6 +58,11 @@ service Query { rpc PinnedCodes(QueryPinnedCodesRequest) returns (QueryPinnedCodesResponse) { option (google.api.http).get = "/cosmwasm/wasm/v1/codes/pinned"; } + + // Params gets the module params + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/codes/params"; + } } // QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -222,3 +227,12 @@ message QueryPinnedCodesResponse { // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index 8295907eb..04acc8ef7 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -12,9 +12,14 @@ option (gogoproto.goproto_getters_all) = false; service Msg { // StoreCode to submit Wasm code to the system rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); - // Instantiate creates a new smart contract instance for the given code id. + // InstantiateContract creates a new smart contract instance for the given + // code id. rpc InstantiateContract(MsgInstantiateContract) returns (MsgInstantiateContractResponse); + // InstantiateContract2 creates a new smart contract instance for the given + // code id with a predictable address + rpc InstantiateContract2(MsgInstantiateContract2) + returns (MsgInstantiateContract2Response); // Execute submits the given message data to a smart contract rpc ExecuteContract(MsgExecuteContract) returns (MsgExecuteContractResponse); // Migrate runs a code upgrade/ downgrade for a smart contract @@ -41,6 +46,8 @@ message MsgStoreCode { message MsgStoreCodeResponse { // CodeID is the reference to the stored WASM code uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; + // Checksum is the sha256 hash of the stored code + bytes checksum = 2; } // MsgInstantiateContract create a new smart contract instance for the given @@ -62,11 +69,45 @@ message MsgInstantiateContract { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } + +// MsgInstantiateContract2 create a new smart contract instance for the given +// code id with a predicable address. +message MsgInstantiateContract2 { + // Sender is the that actor that signed the messages + string sender = 1; + // Admin is an optional address that can execute migrations + string admin = 2; + // 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" ]; + // Funds coins that are transferred to the contract on instantiation + repeated cosmos.base.v1beta1.Coin funds = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. + bytes salt = 7; + // FixMsg include the msg value into the hash for the predictable address. + // Default is false + bool fix_msg = 8; +} + // MsgInstantiateContractResponse return instantiation result data message MsgInstantiateContractResponse { // Address is the bech32 address of the new contract instance. string address = 1; - // Data contains base64-encoded bytes to returned from the contract + // Data contains bytes to returned from the contract + bytes data = 2; +} + +// MsgInstantiateContract2Response return instantiation result data +message MsgInstantiateContract2Response { + // Address is the bech32 address of the new contract instance. + string address = 1; + // Data contains bytes to returned from the contract bytes data = 2; } @@ -87,7 +128,7 @@ message MsgExecuteContract { // MsgExecuteContractResponse returns execution result data. message MsgExecuteContractResponse { - // Data contains base64-encoded bytes to returned from the contract + // Data contains bytes to returned from the contract bytes data = 1; } diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto index 739aed2af..8d140248a 100644 --- a/proto/cosmwasm/wasm/v1/types.proto +++ b/proto/cosmwasm/wasm/v1/types.proto @@ -19,12 +19,16 @@ enum AccessType { // AccessTypeNobody forbidden ACCESS_TYPE_NOBODY = 1 [ (gogoproto.enumvalue_customname) = "AccessTypeNobody" ]; - // AccessTypeOnlyAddress restricted to an address + // AccessTypeOnlyAddress restricted to a single address + // Deprecated: use AccessTypeAnyOfAddresses instead ACCESS_TYPE_ONLY_ADDRESS = 2 [ (gogoproto.enumvalue_customname) = "AccessTypeOnlyAddress" ]; // AccessTypeEverybody unrestricted ACCESS_TYPE_EVERYBODY = 3 [ (gogoproto.enumvalue_customname) = "AccessTypeEverybody" ]; + // AccessTypeAnyOfAddresses allow any of the addresses + ACCESS_TYPE_ANY_OF_ADDRESSES = 4 + [ (gogoproto.enumvalue_customname) = "AccessTypeAnyOfAddresses" ]; } // AccessTypeParam @@ -37,7 +41,11 @@ message AccessTypeParam { message AccessConfig { option (gogoproto.goproto_stringer) = true; AccessType permission = 1 [ (gogoproto.moretags) = "yaml:\"permission\"" ]; + + // Address + // Deprecated: replaced by addresses string address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + repeated string addresses = 3 [ (gogoproto.moretags) = "yaml:\"addresses\"" ]; } // Params defines the set of wasm parameters. diff --git a/third_party/proto/confio/README.md b/third_party/proto/confio/README.md new file mode 100644 index 000000000..c57da2e22 --- /dev/null +++ b/third_party/proto/confio/README.md @@ -0,0 +1 @@ +This project can be found at: https://github.com/confio/ics23 diff --git a/third_party/proto/confio/proofs.proto b/third_party/proto/confio/proofs.proto index da43503ec..12d9e2da6 100644 --- a/third_party/proto/confio/proofs.proto +++ b/third_party/proto/confio/proofs.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package ics23; -option go_package = "github.com/confio/ics23/go"; enum HashOp { // NO_HASH is the default if no data passed. Note this is an illegal argument some places. @@ -11,6 +10,7 @@ enum HashOp { KECCAK = 3; RIPEMD160 = 4; BITCOIN = 5; // ripemd160(sha256(x)) + SHA512_256 = 6; } /** diff --git a/third_party/proto/cosmos/authz/v1beta1/authz.proto b/third_party/proto/cosmos/authz/v1beta1/authz.proto index 2c376905e..05b1feefa 100644 --- a/third_party/proto/cosmos/authz/v1beta1/authz.proto +++ b/third_party/proto/cosmos/authz/v1beta1/authz.proto @@ -25,3 +25,15 @@ message Grant { google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"]; google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } + +// GrantAuthorization extends a grant with both the addresses of the grantee and granter. +// It is used in genesis.proto and query.proto +// +// Since: cosmos-sdk 0.45.2 +message GrantAuthorization { + string granter = 1; + string grantee = 2; + + google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} diff --git a/third_party/proto/cosmos/authz/v1beta1/genesis.proto b/third_party/proto/cosmos/authz/v1beta1/genesis.proto index ea8986944..310f62656 100644 --- a/third_party/proto/cosmos/authz/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/authz/v1beta1/genesis.proto @@ -2,10 +2,8 @@ syntax = "proto3"; package cosmos.authz.v1beta1; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; +import "cosmos/authz/v1beta1/authz.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; @@ -13,12 +11,3 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; message GenesisState { repeated GrantAuthorization authorization = 1 [(gogoproto.nullable) = false]; } - -// GrantAuthorization defines the GenesisState/GrantAuthorization type. -message GrantAuthorization { - string granter = 1; - string grantee = 2; - - google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"]; - google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} diff --git a/third_party/proto/cosmos/authz/v1beta1/query.proto b/third_party/proto/cosmos/authz/v1beta1/query.proto index 428210de0..f668309be 100644 --- a/third_party/proto/cosmos/authz/v1beta1/query.proto +++ b/third_party/proto/cosmos/authz/v1beta1/query.proto @@ -14,6 +14,20 @@ service Query { rpc Grants(QueryGrantsRequest) returns (QueryGrantsResponse) { option (google.api.http).get = "/cosmos/authz/v1beta1/grants"; } + + // GranterGrants returns list of `GrantAuthorization`, granted by granter. + // + // Since: cosmos-sdk 0.45.2 + rpc GranterGrants(QueryGranterGrantsRequest) returns (QueryGranterGrantsResponse) { + option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}"; + } + + // GranteeGrants returns a list of `GrantAuthorization` by grantee. + // + // Since: cosmos-sdk 0.45.2 + rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { + option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}"; + } } // QueryGrantsRequest is the request type for the Query/Grants RPC method. @@ -29,7 +43,39 @@ message QueryGrantsRequest { // QueryGrantsResponse is the response type for the Query/Authorizations RPC method. message QueryGrantsResponse { // authorizations is a list of grants granted for grantee by granter. - repeated cosmos.authz.v1beta1.Grant grants = 1; + repeated Grant grants = 1; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. +message QueryGranterGrantsRequest { + string granter = 1; + + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. +message QueryGranterGrantsResponse { + // grants is a list of grants granted by the granter. + repeated GrantAuthorization grants = 1; + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. +message QueryGranteeGrantsRequest { + string grantee = 1; + + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. +message QueryGranteeGrantsResponse { + // grants is a list of grants granted to the grantee. + repeated GrantAuthorization grants = 1; // pagination defines an pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/third_party/proto/cosmos/bank/v1beta1/query.proto b/third_party/proto/cosmos/bank/v1beta1/query.proto index 520ba0696..a567e073f 100644 --- a/third_party/proto/cosmos/bank/v1beta1/query.proto +++ b/third_party/proto/cosmos/bank/v1beta1/query.proto @@ -21,6 +21,12 @@ service Query { option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; } + // SpendableBalances queries the spenable balance of all coins for a single + // account. + rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}"; + } + // TotalSupply queries the total supply of all coins. rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; @@ -49,7 +55,7 @@ service Query { // QueryBalanceRequest is the request type for the Query/Balance RPC method. message QueryBalanceRequest { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // address is the address to query balances for. @@ -67,7 +73,7 @@ message QueryBalanceResponse { // QueryBalanceRequest is the request type for the Query/AllBalances RPC method. message QueryAllBalancesRequest { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // address is the address to query balances for. @@ -82,7 +88,31 @@ message QueryAllBalancesRequest { message QueryAllBalancesResponse { // balances is the balances of all the coins. repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QuerySpendableBalancesRequest defines the gRPC request structure for querying +// an account's spendable balances. +message QuerySpendableBalancesRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query spendable balances for. + string address = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QuerySpendableBalancesResponse defines the gRPC response structure for querying +// an account's spendable balances. +message QuerySpendableBalancesResponse { + // balances is the spendable balances of all the coins. + repeated cosmos.base.v1beta1.Coin balances = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -91,7 +121,7 @@ message QueryAllBalancesResponse { // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC // method. message QueryTotalSupplyRequest { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // pagination defines an optional pagination for the request. @@ -105,7 +135,7 @@ message QueryTotalSupplyRequest { message QueryTotalSupplyResponse { // supply is the supply of the coins repeated cosmos.base.v1beta1.Coin supply = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; // pagination defines the pagination in the response. // diff --git a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto index 9ac5a7c31..6dcc4a933 100644 --- a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -17,4 +17,41 @@ message Snapshot { // Metadata contains SDK-specific snapshot metadata. message Metadata { repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes -} \ No newline at end of file +} + +// SnapshotItem is an item contained in a rootmulti.Store snapshot. +message SnapshotItem { + // item is the specific type of snapshot item. + oneof item { + SnapshotStoreItem store = 1; + SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; + SnapshotExtensionMeta extension = 3; + SnapshotExtensionPayload extension_payload = 4; + } +} + +// SnapshotStoreItem contains metadata about a snapshotted store. +message SnapshotStoreItem { + string name = 1; +} + +// SnapshotIAVLItem is an exported IAVL node. +message SnapshotIAVLItem { + bytes key = 1; + bytes value = 2; + // version is block height + int64 version = 3; + // height is depth of the tree. + int32 height = 4; +} + +// SnapshotExtensionMeta contains metadata about an external snapshotter. +message SnapshotExtensionMeta { + string name = 1; + uint32 format = 2; +} + +// SnapshotExtensionPayload contains payloads of an external snapshotter. +message SnapshotExtensionPayload { + bytes payload = 1; +} diff --git a/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto deleted file mode 100644 index 834855093..000000000 --- a/third_party/proto/cosmos/base/store/v1beta1/snapshot.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package cosmos.base.store.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; - -// SnapshotItem is an item contained in a rootmulti.Store snapshot. -message SnapshotItem { - // item is the specific type of snapshot item. - oneof item { - SnapshotStoreItem store = 1; - SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; - } -} - -// SnapshotStoreItem contains metadata about a snapshotted store. -message SnapshotStoreItem { - string name = 1; -} - -// SnapshotIAVLItem is an exported IAVL node. -message SnapshotIAVLItem { - bytes key = 1; - bytes value = 2; - int64 version = 3; - int32 height = 4; -} \ No newline at end of file diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto index 3c31877aa..98542d23d 100644 --- a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -116,15 +116,15 @@ message GetNodeInfoResponse { // VersionInfo is the type for the GetNodeInfoResponse message. message VersionInfo { - string name = 1; - string app_name = 2; - string version = 3; - string git_commit = 4; - string build_tags = 5; - string go_version = 6; - repeated Module build_deps = 7; + string name = 1; + string app_name = 2; + string version = 3; + string git_commit = 4; + string build_tags = 5; + string go_version = 6; + repeated Module build_deps = 7; // Since: cosmos-sdk 0.43 - string cosmos_sdk_version = 8; + string cosmos_sdk_version = 8; } // Module is the type for VersionInfo diff --git a/third_party/proto/cosmos/feegrant/v1beta1/query.proto b/third_party/proto/cosmos/feegrant/v1beta1/query.proto index 9cf2a4987..42d7a842d 100644 --- a/third_party/proto/cosmos/feegrant/v1beta1/query.proto +++ b/third_party/proto/cosmos/feegrant/v1beta1/query.proto @@ -20,6 +20,12 @@ service Query { rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; } + + // AllowancesByGranter returns all the grants given by an address + // Since v0.46 + rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) { + option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; + } } // QueryAllowanceRequest is the request type for the Query/Allowance RPC method. @@ -53,3 +59,20 @@ message QueryAllowancesResponse { // pagination defines an pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. +message QueryAllowancesByGranterRequest { + string granter = 1; + + // pagination defines an pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. +message QueryAllowancesByGranterResponse { + // allowances that have been issued by the granter. + repeated cosmos.feegrant.v1beta1.Grant allowances = 1; + + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/gov.proto b/third_party/proto/cosmos/gov/v1beta1/gov.proto index 344b5ada1..01aebf950 100644 --- a/third_party/proto/cosmos/gov/v1beta1/gov.proto +++ b/third_party/proto/cosmos/gov/v1beta1/gov.proto @@ -136,7 +136,7 @@ message Vote { // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - VoteOption option = 3 [deprecated = true]; + VoteOption option = 3 [deprecated = true]; // Since: cosmos-sdk 0.43 repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto index 4c1be4059..50de89c8f 100644 --- a/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -24,6 +24,18 @@ enum SignMode { // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses // Amino JSON and will be removed in the future SIGN_MODE_LEGACY_AMINO_JSON = 127; + + // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + // + // Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + // but is not implemented on the SDK by default. To enable EIP-191, you need + // to pass a custom `TxConfig` that has an implementation of + // `SignModeHandler` for EIP-191. The SDK may decide to fully support + // EIP-191 in the future. + // + // Since: cosmos-sdk 0.45.2 + SIGN_MODE_EIP_191 = 191; } // SignatureDescriptors wraps multiple SignatureDescriptor's. diff --git a/third_party/proto/cosmos/tx/v1beta1/service.proto b/third_party/proto/cosmos/tx/v1beta1/service.proto index acfbf15b3..d9f828f76 100644 --- a/third_party/proto/cosmos/tx/v1beta1/service.proto +++ b/third_party/proto/cosmos/tx/v1beta1/service.proto @@ -6,6 +6,8 @@ import "cosmos/base/abci/v1beta1/abci.proto"; import "cosmos/tx/v1beta1/tx.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "tendermint/types/block.proto"; +import "tendermint/types/types.proto"; option (gogoproto.goproto_registration) = true; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; @@ -34,6 +36,12 @@ service Service { rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; } + // GetBlockWithTxs fetches a block with decoded txs. + // + // Since: cosmos-sdk 0.45.2 + rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}"; + } } // GetTxsEventRequest is the request type for the Service.TxsByEvents @@ -41,7 +49,7 @@ service Service { message GetTxsEventRequest { // events is the list of transaction event type. repeated string events = 1; - // pagination defines an pagination for the request. + // pagination defines a pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; OrderBy order_by = 3; } @@ -63,7 +71,7 @@ message GetTxsEventResponse { repeated cosmos.tx.v1beta1.Tx txs = 1; // tx_responses is the list of queried TxResponses. repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2; - // pagination defines an pagination for the response. + // pagination defines a pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 3; } @@ -131,4 +139,27 @@ message GetTxResponse { cosmos.tx.v1beta1.Tx tx = 1; // tx_response is the queried TxResponses. cosmos.base.abci.v1beta1.TxResponse tx_response = 2; +} + +// GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs +// RPC method. +// +// Since: cosmos-sdk 0.45.2 +message GetBlockWithTxsRequest { + // height is the height of the block to query. + int64 height = 1; + // pagination defines a pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. +// +// Since: cosmos-sdk 0.45.2 +message GetBlockWithTxsResponse { + // txs are the transactions in the block. + repeated cosmos.tx.v1beta1.Tx txs = 1; + .tendermint.types.BlockID block_id = 2; + .tendermint.types.Block block = 3; + // pagination defines a pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 4; } \ No newline at end of file diff --git a/third_party/proto/ibc/applications/transfer/v1/query.proto b/third_party/proto/ibc/applications/transfer/v1/query.proto index 2ed28049f..5298338c1 100644 --- a/third_party/proto/ibc/applications/transfer/v1/query.proto +++ b/third_party/proto/ibc/applications/transfer/v1/query.proto @@ -30,12 +30,17 @@ service Query { rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) { option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace}"; } + + // EscrowAddress returns the escrow address for a particular port and channel id. + rpc EscrowAddress(QueryEscrowAddressRequest) returns (QueryEscrowAddressResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/channels/{channel_id}/ports/{port_id}/escrow_address"; + } } // QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC // method message QueryDenomTraceRequest { - // hash (in hex format) of the denomination trace information. + // hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. string hash = 1; } @@ -84,3 +89,17 @@ message QueryDenomHashResponse { // hash (in hex format) of the denomination trace information. string hash = 1; } + +// QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. +message QueryEscrowAddressRequest { + // unique port identifier + string port_id = 1; + // unique channel identifier + string channel_id = 2; +} + +// QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. +message QueryEscrowAddressResponse { + // the escrow account address + string escrow_address = 1; +} \ No newline at end of file diff --git a/third_party/proto/ibc/core/channel/v1/tx.proto b/third_party/proto/ibc/core/channel/v1/tx.proto index d4d6df1d5..d34b00e91 100644 --- a/third_party/proto/ibc/core/channel/v1/tx.proto +++ b/third_party/proto/ibc/core/channel/v1/tx.proto @@ -47,11 +47,11 @@ enum ResponseResultType { option (gogoproto.goproto_enum_prefix) = false; // Default zero value enumeration - RESPONSE_RESULT_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; + RESPONSE_RESULT_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; // The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - RESPONSE_RESULT_NOOP = 1 [(gogoproto.enumvalue_customname) = "NOOP"]; + RESPONSE_RESULT_TYPE_NOOP = 1 [(gogoproto.enumvalue_customname) = "NOOP"]; // The message was executed successfully - RESPONSE_RESULT_SUCCESS = 2 [(gogoproto.enumvalue_customname) = "SUCCESS"]; + RESPONSE_RESULT_TYPE_SUCCESS = 2 [(gogoproto.enumvalue_customname) = "SUCCESS"]; } // MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -68,6 +68,7 @@ message MsgChannelOpenInit { // MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. message MsgChannelOpenInitResponse { string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string version = 2; } // MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel @@ -91,7 +92,9 @@ message MsgChannelOpenTry { } // MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. -message MsgChannelOpenTryResponse {} +message MsgChannelOpenTryResponse { + string version = 1; +} // MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge // the change of channel state to TRYOPEN on Chain B. diff --git a/third_party/proto/ibc/core/client/v1/client.proto b/third_party/proto/ibc/core/client/v1/client.proto index 657d99ed2..f97263c4f 100644 --- a/third_party/proto/ibc/core/client/v1/client.proto +++ b/third_party/proto/ibc/core/client/v1/client.proto @@ -7,6 +7,7 @@ option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; +import "cosmos_proto/cosmos.proto"; // IdentifiedClientState defines a client state with an additional client // identifier field. @@ -41,7 +42,8 @@ message ClientConsensusStates { // handler may fail if the subject and the substitute do not match in client and // chain parameters (with exception to latest height, frozen height, and chain-id). message ClientUpdateProposal { - option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_getters) = false; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // the title of the update proposal string title = 1; // the description of the proposal @@ -56,9 +58,10 @@ message ClientUpdateProposal { // UpgradeProposal is a gov Content type for initiating an IBC breaking // upgrade. message UpgradeProposal { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; string description = 2; diff --git a/third_party/proto/ibc/core/client/v1/query.proto b/third_party/proto/ibc/core/client/v1/query.proto index 91a906fe5..33a4191cd 100644 --- a/third_party/proto/ibc/core/client/v1/query.proto +++ b/third_party/proto/ibc/core/client/v1/query.proto @@ -36,6 +36,11 @@ service Query { option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}"; } + // ConsensusStateHeights queries the height of every consensus states associated with a given client. + rpc ConsensusStateHeights(QueryConsensusStateHeightsRequest) returns (QueryConsensusStateHeightsResponse) { + option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}/heights"; + } + // Status queries the status of an IBC client. rpc ClientStatus(QueryClientStatusRequest) returns (QueryClientStatusResponse) { option (google.api.http).get = "/ibc/core/client/v1/client_status/{client_id}"; @@ -137,6 +142,24 @@ message QueryConsensusStatesResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights +// RPC method. +message QueryConsensusStateHeightsRequest { + // client identifier + string client_id = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryConsensusStateHeightsResponse is the response type for the +// Query/ConsensusStateHeights RPC method +message QueryConsensusStateHeightsResponse { + // consensus state heights + repeated Height consensus_state_heights = 1 [(gogoproto.nullable) = false]; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + // QueryClientStatusRequest is the request type for the Query/ClientStatus RPC // method message QueryClientStatusRequest { diff --git a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto index ac39341db..f04dc1756 100644 --- a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -52,12 +52,11 @@ message ClientState { // "upgradedIBCState"}` repeated string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""]; - // This flag, when set to true, will allow governance to recover a client - // which has expired - bool allow_update_after_expiry = 10 [(gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""]; - // This flag, when set to true, will allow governance to unfreeze a client - // whose chain has experienced a misbehaviour event - bool allow_update_after_misbehaviour = 11 [(gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""]; + // allow_update_after_expiry is deprecated + bool allow_update_after_expiry = 10 [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""]; + // allow_update_after_misbehaviour is deprecated + bool allow_update_after_misbehaviour = 11 + [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""]; } // ConsensusState defines the consensus state from Tendermint. diff --git a/third_party/proto/tendermint/abci/types.proto b/third_party/proto/tendermint/abci/types.proto index 8e3a90936..340800f46 100644 --- a/third_party/proto/tendermint/abci/types.proto +++ b/third_party/proto/tendermint/abci/types.proto @@ -102,8 +102,7 @@ message RequestEndBlock { message RequestCommit {} // lists available snapshots -message RequestListSnapshots { -} +message RequestListSnapshots {} // offers a snapshot to the application message RequestOfferSnapshot { @@ -212,6 +211,12 @@ message ResponseCheckTx { repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; string codespace = 8; + string sender = 9; + int64 priority = 10; + + // mempool_error is set by Tendermint. + // ABCI applictions creating a ResponseCheckTX should not set mempool_error. + string mempool_error = 11; } message ResponseDeliverTx { @@ -221,16 +226,17 @@ message ResponseDeliverTx { string info = 4; // nondeterministic int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic + repeated Event events = 7 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "events,omitempty" + ]; // nondeterministic string codespace = 8; } message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [(gogoproto.nullable) = false]; - ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 + repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } @@ -364,10 +370,8 @@ message Evidence { // The height when the offense occurred int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; + google.protobuf.Timestamp time = 4 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 @@ -402,6 +406,8 @@ service ABCIApplication { rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); - rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); - rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) + returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) + returns (ResponseApplySnapshotChunk); } diff --git a/third_party/proto/tendermint/consensus/types.proto b/third_party/proto/tendermint/consensus/types.proto index 6e1f41371..5048f8545 100644 --- a/third_party/proto/tendermint/consensus/types.proto +++ b/third_party/proto/tendermint/consensus/types.proto @@ -18,7 +18,7 @@ message NewRoundStep { } // NewValidBlock is sent when a validator observes a valid block B in some round r, -//i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. +// i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. // In case the block is also committed, then IsCommit flag is set to true. message NewValidBlock { int64 height = 1; diff --git a/third_party/proto/tendermint/rpc/grpc/types.pb.go b/third_party/proto/tendermint/rpc/grpc/types.pb.go new file mode 100644 index 000000000..de580d2a6 --- /dev/null +++ b/third_party/proto/tendermint/rpc/grpc/types.pb.go @@ -0,0 +1,953 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: tendermint/rpc/grpc/types.proto + +package coregrpc + +import ( + context "context" + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" + types "github.com/tendermint/tendermint/abci/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal + +var ( + _ = 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. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type RequestPing struct{} + +func (m *RequestPing) Reset() { *m = RequestPing{} } +func (m *RequestPing) String() string { return proto.CompactTextString(m) } +func (*RequestPing) ProtoMessage() {} +func (*RequestPing) Descriptor() ([]byte, []int) { + return fileDescriptor_0ffff5682c662b95, []int{0} +} + +func (m *RequestPing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *RequestPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestPing.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 *RequestPing) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestPing.Merge(m, src) +} + +func (m *RequestPing) XXX_Size() int { + return m.Size() +} + +func (m *RequestPing) XXX_DiscardUnknown() { + xxx_messageInfo_RequestPing.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestPing proto.InternalMessageInfo + +type RequestBroadcastTx struct { + Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (m *RequestBroadcastTx) Reset() { *m = RequestBroadcastTx{} } +func (m *RequestBroadcastTx) String() string { return proto.CompactTextString(m) } +func (*RequestBroadcastTx) ProtoMessage() {} +func (*RequestBroadcastTx) Descriptor() ([]byte, []int) { + return fileDescriptor_0ffff5682c662b95, []int{1} +} + +func (m *RequestBroadcastTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *RequestBroadcastTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestBroadcastTx.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 *RequestBroadcastTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestBroadcastTx.Merge(m, src) +} + +func (m *RequestBroadcastTx) XXX_Size() int { + return m.Size() +} + +func (m *RequestBroadcastTx) XXX_DiscardUnknown() { + xxx_messageInfo_RequestBroadcastTx.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestBroadcastTx proto.InternalMessageInfo + +func (m *RequestBroadcastTx) GetTx() []byte { + if m != nil { + return m.Tx + } + return nil +} + +type ResponsePing struct{} + +func (m *ResponsePing) Reset() { *m = ResponsePing{} } +func (m *ResponsePing) String() string { return proto.CompactTextString(m) } +func (*ResponsePing) ProtoMessage() {} +func (*ResponsePing) Descriptor() ([]byte, []int) { + return fileDescriptor_0ffff5682c662b95, []int{2} +} + +func (m *ResponsePing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *ResponsePing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponsePing.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 *ResponsePing) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponsePing.Merge(m, src) +} + +func (m *ResponsePing) XXX_Size() int { + return m.Size() +} + +func (m *ResponsePing) XXX_DiscardUnknown() { + xxx_messageInfo_ResponsePing.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponsePing proto.InternalMessageInfo + +type ResponseBroadcastTx struct { + CheckTx *types.ResponseCheckTx `protobuf:"bytes,1,opt,name=check_tx,json=checkTx,proto3" json:"check_tx,omitempty"` + DeliverTx *types.ResponseDeliverTx `protobuf:"bytes,2,opt,name=deliver_tx,json=deliverTx,proto3" json:"deliver_tx,omitempty"` +} + +func (m *ResponseBroadcastTx) Reset() { *m = ResponseBroadcastTx{} } +func (m *ResponseBroadcastTx) String() string { return proto.CompactTextString(m) } +func (*ResponseBroadcastTx) ProtoMessage() {} +func (*ResponseBroadcastTx) Descriptor() ([]byte, []int) { + return fileDescriptor_0ffff5682c662b95, []int{3} +} + +func (m *ResponseBroadcastTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *ResponseBroadcastTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseBroadcastTx.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 *ResponseBroadcastTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBroadcastTx.Merge(m, src) +} + +func (m *ResponseBroadcastTx) XXX_Size() int { + return m.Size() +} + +func (m *ResponseBroadcastTx) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseBroadcastTx.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseBroadcastTx proto.InternalMessageInfo + +func (m *ResponseBroadcastTx) GetCheckTx() *types.ResponseCheckTx { + if m != nil { + return m.CheckTx + } + return nil +} + +func (m *ResponseBroadcastTx) GetDeliverTx() *types.ResponseDeliverTx { + if m != nil { + return m.DeliverTx + } + return nil +} + +func init() { + proto.RegisterType((*RequestPing)(nil), "tendermint.rpc.grpc.RequestPing") + proto.RegisterType((*RequestBroadcastTx)(nil), "tendermint.rpc.grpc.RequestBroadcastTx") + proto.RegisterType((*ResponsePing)(nil), "tendermint.rpc.grpc.ResponsePing") + proto.RegisterType((*ResponseBroadcastTx)(nil), "tendermint.rpc.grpc.ResponseBroadcastTx") +} + +func init() { proto.RegisterFile("tendermint/rpc/grpc/types.proto", fileDescriptor_0ffff5682c662b95) } + +var fileDescriptor_0ffff5682c662b95 = []byte{ + // 316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x49, 0xcd, 0x4b, + 0x49, 0x2d, 0xca, 0xcd, 0xcc, 0x2b, 0xd1, 0x2f, 0x2a, 0x48, 0xd6, 0x4f, 0x07, 0x11, 0x25, 0x95, + 0x05, 0xa9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xc2, 0x08, 0x05, 0x7a, 0x45, 0x05, + 0xc9, 0x7a, 0x20, 0x05, 0x52, 0xd2, 0x48, 0xba, 0x12, 0x93, 0x92, 0x33, 0x91, 0x75, 0x28, 0xf1, + 0x72, 0x71, 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x04, 0x64, 0xe6, 0xa5, 0x2b, 0xa9, 0x70, + 0x09, 0x41, 0xb9, 0x4e, 0x45, 0xf9, 0x89, 0x29, 0xc9, 0x89, 0xc5, 0x25, 0x21, 0x15, 0x42, 0x7c, + 0x5c, 0x4c, 0x25, 0x15, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x4c, 0x25, 0x15, 0x4a, 0x7c, + 0x5c, 0x3c, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x60, 0x5d, 0x53, 0x19, 0xb9, 0x84, + 0x61, 0x02, 0xc8, 0xfa, 0xac, 0xb9, 0x38, 0x92, 0x33, 0x52, 0x93, 0xb3, 0xe3, 0xa1, 0xba, 0xb9, + 0x8d, 0x14, 0xf4, 0x90, 0x5c, 0x08, 0x72, 0x8c, 0x1e, 0x4c, 0x9f, 0x33, 0x48, 0x61, 0x48, 0x45, + 0x10, 0x7b, 0x32, 0x84, 0x21, 0xe4, 0xc8, 0xc5, 0x95, 0x92, 0x9a, 0x93, 0x59, 0x96, 0x5a, 0x04, + 0xd2, 0xce, 0x04, 0xd6, 0xae, 0x84, 0x53, 0xbb, 0x0b, 0x44, 0x69, 0x48, 0x45, 0x10, 0x67, 0x0a, + 0x8c, 0x69, 0xb4, 0x97, 0x91, 0x8b, 0x07, 0xee, 0x1e, 0xc7, 0x00, 0x4f, 0x21, 0x6f, 0x2e, 0x16, + 0x90, 0x83, 0x85, 0x50, 0x9c, 0x01, 0x0b, 0x28, 0x3d, 0xa4, 0x80, 0x90, 0x52, 0xc4, 0xa1, 0x02, + 0xe1, 0x6b, 0xa1, 0x04, 0x2e, 0x6e, 0x64, 0xcf, 0xaa, 0xe3, 0x33, 0x13, 0x49, 0xa1, 0x94, 0x06, + 0x5e, 0xa3, 0x91, 0x54, 0x3a, 0xf9, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, + 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, + 0x94, 0x51, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x52, 0xf4, 0x62, + 0x49, 0x1f, 0xd6, 0xc9, 0xf9, 0x45, 0xa9, 0x20, 0x46, 0x12, 0x1b, 0x38, 0xc6, 0x8d, 0x01, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xf6, 0x4b, 0x02, 0xd8, 0x46, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ 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. +const _ = grpc.SupportPackageIsVersion4 + +// BroadcastAPIClient is the client API for BroadcastAPI service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type BroadcastAPIClient interface { + Ping(ctx context.Context, in *RequestPing, opts ...grpc.CallOption) (*ResponsePing, error) + BroadcastTx(ctx context.Context, in *RequestBroadcastTx, opts ...grpc.CallOption) (*ResponseBroadcastTx, error) +} + +type broadcastAPIClient struct { + cc *grpc.ClientConn +} + +func NewBroadcastAPIClient(cc *grpc.ClientConn) BroadcastAPIClient { + return &broadcastAPIClient{cc} +} + +func (c *broadcastAPIClient) Ping(ctx context.Context, in *RequestPing, opts ...grpc.CallOption) (*ResponsePing, error) { + out := new(ResponsePing) + err := c.cc.Invoke(ctx, "/tendermint.rpc.grpc.BroadcastAPI/Ping", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *broadcastAPIClient) BroadcastTx(ctx context.Context, in *RequestBroadcastTx, opts ...grpc.CallOption) (*ResponseBroadcastTx, error) { + out := new(ResponseBroadcastTx) + err := c.cc.Invoke(ctx, "/tendermint.rpc.grpc.BroadcastAPI/BroadcastTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BroadcastAPIServer is the server API for BroadcastAPI service. +type BroadcastAPIServer interface { + Ping(context.Context, *RequestPing) (*ResponsePing, error) + BroadcastTx(context.Context, *RequestBroadcastTx) (*ResponseBroadcastTx, error) +} + +// UnimplementedBroadcastAPIServer can be embedded to have forward compatible implementations. +type UnimplementedBroadcastAPIServer struct{} + +func (*UnimplementedBroadcastAPIServer) Ping(ctx context.Context, req *RequestPing) (*ResponsePing, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} + +func (*UnimplementedBroadcastAPIServer) BroadcastTx(ctx context.Context, req *RequestBroadcastTx) (*ResponseBroadcastTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented") +} + +func RegisterBroadcastAPIServer(s *grpc.Server, srv BroadcastAPIServer) { + s.RegisterService(&_BroadcastAPI_serviceDesc, srv) +} + +func _BroadcastAPI_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestPing) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BroadcastAPIServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tendermint.rpc.grpc.BroadcastAPI/Ping", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BroadcastAPIServer).Ping(ctx, req.(*RequestPing)) + } + return interceptor(ctx, in, info, handler) +} + +func _BroadcastAPI_BroadcastTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestBroadcastTx) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BroadcastAPIServer).BroadcastTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tendermint.rpc.grpc.BroadcastAPI/BroadcastTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BroadcastAPIServer).BroadcastTx(ctx, req.(*RequestBroadcastTx)) + } + return interceptor(ctx, in, info, handler) +} + +var _BroadcastAPI_serviceDesc = grpc.ServiceDesc{ + ServiceName: "tendermint.rpc.grpc.BroadcastAPI", + HandlerType: (*BroadcastAPIServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _BroadcastAPI_Ping_Handler, + }, + { + MethodName: "BroadcastTx", + Handler: _BroadcastAPI_BroadcastTx_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "tendermint/rpc/grpc/types.proto", +} + +func (m *RequestPing) 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 *RequestPing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *RequestBroadcastTx) 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 *RequestBroadcastTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestBroadcastTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResponsePing) 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 *ResponsePing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponsePing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResponseBroadcastTx) 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 *ResponseBroadcastTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseBroadcastTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DeliverTx != nil { + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CheckTx != nil { + { + size, err := m.CheckTx.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 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 *RequestPing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *RequestBroadcastTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tx) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ResponsePing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResponseBroadcastTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CheckTx != nil { + l = m.CheckTx.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.DeliverTx != nil { + l = m.DeliverTx.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +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 *RequestPing) 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: RequestPing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestPing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *RequestBroadcastTx) 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: RequestBroadcastTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestBroadcastTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", 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.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) + if m.Tx == nil { + m.Tx = []byte{} + } + 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 *ResponsePing) 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: ResponsePing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponsePing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *ResponseBroadcastTx) 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: ResponseBroadcastTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseBroadcastTx: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CheckTx", 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 m.CheckTx == nil { + m.CheckTx = &types.ResponseCheckTx{} + } + if err := m.CheckTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeliverTx", 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 m.DeliverTx == nil { + m.DeliverTx = &types.ResponseDeliverTx{} + } + if err := m.DeliverTx.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/third_party/proto/tendermint/state/types.pb.go b/third_party/proto/tendermint/state/types.pb.go index b9e4b6d12..6f5629482 100644 --- a/third_party/proto/tendermint/state/types.pb.go +++ b/third_party/proto/tendermint/state/types.pb.go @@ -218,6 +218,63 @@ func (m *ConsensusParamsInfo) GetLastHeightChanged() int64 { return 0 } +type ABCIResponsesInfo struct { + AbciResponses *ABCIResponses `protobuf:"bytes,1,opt,name=abci_responses,json=abciResponses,proto3" json:"abci_responses,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *ABCIResponsesInfo) Reset() { *m = ABCIResponsesInfo{} } +func (m *ABCIResponsesInfo) String() string { return proto.CompactTextString(m) } +func (*ABCIResponsesInfo) ProtoMessage() {} +func (*ABCIResponsesInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ccfacf933f22bf93, []int{3} +} + +func (m *ABCIResponsesInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} + +func (m *ABCIResponsesInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ABCIResponsesInfo.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 *ABCIResponsesInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ABCIResponsesInfo.Merge(m, src) +} + +func (m *ABCIResponsesInfo) XXX_Size() int { + return m.Size() +} + +func (m *ABCIResponsesInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ABCIResponsesInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ABCIResponsesInfo proto.InternalMessageInfo + +func (m *ABCIResponsesInfo) GetAbciResponses() *ABCIResponses { + if m != nil { + return m.AbciResponses + } + return nil +} + +func (m *ABCIResponsesInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + type Version struct { Consensus version.Consensus `protobuf:"bytes,1,opt,name=consensus,proto3" json:"consensus"` Software string `protobuf:"bytes,2,opt,name=software,proto3" json:"software,omitempty"` @@ -227,7 +284,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{3} + return fileDescriptor_ccfacf933f22bf93, []int{4} } func (m *Version) XXX_Unmarshal(b []byte) error { @@ -308,7 +365,7 @@ func (m *State) Reset() { *m = State{} } func (m *State) String() string { return proto.CompactTextString(m) } func (*State) ProtoMessage() {} func (*State) Descriptor() ([]byte, []int) { - return fileDescriptor_ccfacf933f22bf93, []int{4} + return fileDescriptor_ccfacf933f22bf93, []int{5} } func (m *State) XXX_Unmarshal(b []byte) error { @@ -444,6 +501,7 @@ func init() { proto.RegisterType((*ABCIResponses)(nil), "tendermint.state.ABCIResponses") proto.RegisterType((*ValidatorsInfo)(nil), "tendermint.state.ValidatorsInfo") proto.RegisterType((*ConsensusParamsInfo)(nil), "tendermint.state.ConsensusParamsInfo") + proto.RegisterType((*ABCIResponsesInfo)(nil), "tendermint.state.ABCIResponsesInfo") proto.RegisterType((*Version)(nil), "tendermint.state.Version") proto.RegisterType((*State)(nil), "tendermint.state.State") } @@ -451,55 +509,58 @@ func init() { func init() { proto.RegisterFile("tendermint/state/types.proto", fileDescriptor_ccfacf933f22bf93) } var fileDescriptor_ccfacf933f22bf93 = []byte{ - // 763 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6f, 0xd3, 0x30, - 0x14, 0x6e, 0xe8, 0xb6, 0xb6, 0xce, 0xda, 0x0e, 0x8f, 0x43, 0xd6, 0xb1, 0xb4, 0x2b, 0x3f, 0x34, - 0x71, 0x48, 0xa5, 0x71, 0x40, 0x5c, 0x26, 0x2d, 0x2d, 0x62, 0x95, 0x26, 0x04, 0xd9, 0xb4, 0x03, - 0x97, 0xc8, 0x6d, 0xbc, 0x24, 0xa2, 0x4d, 0xa2, 0xd8, 0x2d, 0xe3, 0x0f, 0xe0, 0xbe, 0x2b, 0xff, - 0xd1, 0x8e, 0x3b, 0x22, 0x0e, 0x03, 0xba, 0x7f, 0x04, 0xd9, 0xce, 0x0f, 0xb7, 0x65, 0xd2, 0x10, - 0x37, 0xfb, 0x7d, 0xdf, 0xfb, 0xfc, 0xf9, 0xf9, 0x3d, 0x19, 0x3c, 0xa6, 0x38, 0x70, 0x70, 0x3c, - 0xf6, 0x03, 0xda, 0x21, 0x14, 0x51, 0xdc, 0xa1, 0x5f, 0x22, 0x4c, 0x8c, 0x28, 0x0e, 0x69, 0x08, - 0x37, 0x72, 0xd4, 0xe0, 0x68, 0xe3, 0x91, 0x1b, 0xba, 0x21, 0x07, 0x3b, 0x6c, 0x25, 0x78, 0x8d, - 0x6d, 0x49, 0x05, 0x0d, 0x86, 0xbe, 0x2c, 0xd2, 0x90, 0x8f, 0xe0, 0xf1, 0x39, 0xb4, 0xb5, 0x84, - 0x4e, 0xd1, 0xc8, 0x77, 0x10, 0x0d, 0xe3, 0x84, 0xb1, 0xb3, 0xc4, 0x88, 0x50, 0x8c, 0xc6, 0xa9, - 0x80, 0x2e, 0xc1, 0x53, 0x1c, 0x13, 0x3f, 0x0c, 0xe6, 0x0e, 0x68, 0xba, 0x61, 0xe8, 0x8e, 0x70, - 0x87, 0xef, 0x06, 0x93, 0xf3, 0x0e, 0xf5, 0xc7, 0x98, 0x50, 0x34, 0x8e, 0x04, 0xa1, 0xfd, 0x43, - 0x01, 0xd5, 0x43, 0xb3, 0xdb, 0xb7, 0x30, 0x89, 0xc2, 0x80, 0x60, 0x02, 0xbb, 0x40, 0x75, 0xf0, - 0xc8, 0x9f, 0xe2, 0xd8, 0xa6, 0x17, 0x44, 0x53, 0x5a, 0xc5, 0x3d, 0x75, 0xbf, 0x6d, 0x48, 0xc5, - 0x60, 0x97, 0x34, 0xd2, 0x84, 0x9e, 0xe0, 0x9e, 0x5e, 0x58, 0xc0, 0x49, 0x97, 0x04, 0x1e, 0x80, - 0x0a, 0x0e, 0x1c, 0x7b, 0x30, 0x0a, 0x87, 0x9f, 0xb4, 0x07, 0x2d, 0x65, 0x4f, 0xdd, 0xdf, 0xbd, - 0x53, 0xe2, 0x4d, 0xe0, 0x98, 0x8c, 0x68, 0x95, 0x71, 0xb2, 0x82, 0x3d, 0xa0, 0x0e, 0xb0, 0xeb, - 0x07, 0x89, 0x42, 0x91, 0x2b, 0x3c, 0xb9, 0x53, 0xc1, 0x64, 0x5c, 0xa1, 0x01, 0x06, 0xd9, 0xba, - 0xfd, 0x55, 0x01, 0xb5, 0xb3, 0xb4, 0xa0, 0xa4, 0x1f, 0x9c, 0x87, 0xb0, 0x0b, 0xaa, 0x59, 0x89, - 0x6d, 0x82, 0xa9, 0xa6, 0x70, 0x69, 0x5d, 0x96, 0x16, 0x05, 0xcc, 0x12, 0x4f, 0x30, 0xb5, 0xd6, - 0xa7, 0xd2, 0x0e, 0x1a, 0x60, 0x73, 0x84, 0x08, 0xb5, 0x3d, 0xec, 0xbb, 0x1e, 0xb5, 0x87, 0x1e, - 0x0a, 0x5c, 0xec, 0xf0, 0x7b, 0x16, 0xad, 0x87, 0x0c, 0x3a, 0xe2, 0x48, 0x57, 0x00, 0xed, 0x6f, - 0x0a, 0xd8, 0xec, 0x32, 0x9f, 0x01, 0x99, 0x90, 0xf7, 0xfc, 0xfd, 0xb8, 0x19, 0x0b, 0x6c, 0x0c, - 0xd3, 0xb0, 0x2d, 0xde, 0x35, 0xf1, 0xb3, 0xbb, 0xec, 0x67, 0x41, 0xc0, 0x5c, 0xb9, 0xba, 0x69, - 0x16, 0xac, 0xfa, 0x70, 0x3e, 0xfc, 0xcf, 0xde, 0x3c, 0x50, 0x3a, 0x13, 0x8d, 0x03, 0x0f, 0x41, - 0x25, 0x53, 0x4b, 0x7c, 0xec, 0xc8, 0x3e, 0x92, 0x06, 0xcb, 0x9d, 0x24, 0x1e, 0xf2, 0x2c, 0xd8, - 0x00, 0x65, 0x12, 0x9e, 0xd3, 0xcf, 0x28, 0xc6, 0xfc, 0xc8, 0x8a, 0x95, 0xed, 0xdb, 0xbf, 0xd7, - 0xc0, 0xea, 0x09, 0x9b, 0x23, 0xf8, 0x1a, 0x94, 0x12, 0xad, 0xe4, 0x98, 0x2d, 0x63, 0x71, 0xd6, - 0x8c, 0xc4, 0x54, 0x72, 0x44, 0xca, 0x87, 0xcf, 0x41, 0x79, 0xe8, 0x21, 0x3f, 0xb0, 0x7d, 0x71, - 0xa7, 0x8a, 0xa9, 0xce, 0x6e, 0x9a, 0xa5, 0x2e, 0x8b, 0xf5, 0x7b, 0x56, 0x89, 0x83, 0x7d, 0x07, - 0x3e, 0x03, 0x35, 0x3f, 0xf0, 0xa9, 0x8f, 0x46, 0x49, 0x25, 0xb4, 0x1a, 0xaf, 0x40, 0x35, 0x89, - 0x8a, 0x22, 0xc0, 0x17, 0x80, 0x97, 0x44, 0xb4, 0x59, 0xca, 0x2c, 0x72, 0x66, 0x9d, 0x01, 0xbc, - 0x8f, 0x12, 0xae, 0x05, 0xaa, 0x12, 0xd7, 0x77, 0xb4, 0x95, 0x65, 0xef, 0xe2, 0xa9, 0x78, 0x56, - 0xbf, 0x67, 0x6e, 0x32, 0xef, 0xb3, 0x9b, 0xa6, 0x7a, 0x9c, 0x4a, 0xf5, 0x7b, 0x96, 0x9a, 0xe9, - 0xf6, 0x1d, 0x78, 0x0c, 0xea, 0x92, 0x26, 0x1b, 0x4e, 0x6d, 0x95, 0xab, 0x36, 0x0c, 0x31, 0xb9, - 0x46, 0x3a, 0xb9, 0xc6, 0x69, 0x3a, 0xb9, 0x66, 0x99, 0xc9, 0x5e, 0xfe, 0x6c, 0x2a, 0x56, 0x35, - 0xd3, 0x62, 0x28, 0x7c, 0x0b, 0xea, 0x01, 0xbe, 0xa0, 0x76, 0xd6, 0xac, 0x44, 0x5b, 0xbb, 0x57, - 0x7b, 0xd7, 0x58, 0x5a, 0x3e, 0x29, 0xf0, 0x00, 0x00, 0x49, 0xa3, 0x74, 0x2f, 0x0d, 0x29, 0x83, - 0x19, 0xe1, 0xd7, 0x92, 0x44, 0xca, 0xf7, 0x33, 0xc2, 0xd2, 0x24, 0x23, 0x5d, 0xa0, 0xcb, 0xdd, - 0x9c, 0xeb, 0x65, 0x8d, 0x5d, 0xe1, 0x8f, 0xb5, 0x9d, 0x37, 0x76, 0x9e, 0x9d, 0xb4, 0xf8, 0x5f, - 0xc7, 0x0c, 0xfc, 0xe7, 0x98, 0xbd, 0x03, 0x4f, 0xe7, 0xc6, 0x6c, 0x41, 0x3f, 0xb3, 0xa7, 0x72, - 0x7b, 0x2d, 0x69, 0xee, 0xe6, 0x85, 0x52, 0x8f, 0x69, 0x23, 0xc6, 0x98, 0x4c, 0x46, 0x94, 0xd8, - 0x1e, 0x22, 0x9e, 0xb6, 0xde, 0x52, 0xf6, 0xd6, 0x45, 0x23, 0x5a, 0x22, 0x7e, 0x84, 0x88, 0x07, - 0xb7, 0x40, 0x19, 0x45, 0x91, 0xa0, 0x54, 0x39, 0xa5, 0x84, 0xa2, 0x88, 0x41, 0xe6, 0x87, 0xab, - 0x99, 0xae, 0x5c, 0xcf, 0x74, 0xe5, 0xd7, 0x4c, 0x57, 0x2e, 0x6f, 0xf5, 0xc2, 0xf5, 0xad, 0x5e, - 0xf8, 0x7e, 0xab, 0x17, 0x3e, 0xbe, 0x72, 0x7d, 0xea, 0x4d, 0x06, 0xc6, 0x30, 0x1c, 0x77, 0xe4, - 0x3f, 0x25, 0x5f, 0x8a, 0x8f, 0x6d, 0xf1, 0x4b, 0x1c, 0xac, 0xf1, 0xf8, 0xcb, 0x3f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0xa5, 0x17, 0xac, 0x23, 0x2d, 0x07, 0x00, 0x00, + // 805 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x8e, 0xe3, 0x44, + 0x10, 0x8e, 0xc9, 0x6e, 0x7e, 0xca, 0x93, 0x64, 0xb7, 0x07, 0x21, 0x6f, 0x96, 0x75, 0xb2, 0xe1, + 0x47, 0x23, 0x0e, 0x8e, 0xb4, 0x1c, 0x10, 0x97, 0x95, 0xd6, 0x09, 0xb0, 0x91, 0x56, 0x08, 0x3c, + 0xa3, 0x39, 0x70, 0xb1, 0x3a, 0x71, 0x8f, 0x6d, 0x91, 0xd8, 0x96, 0xbb, 0x13, 0x86, 0x07, 0xe0, + 0x3e, 0x57, 0xde, 0x68, 0x8e, 0x73, 0x44, 0x1c, 0x06, 0xc8, 0xbc, 0x08, 0xea, 0x1f, 0xdb, 0x9d, + 0x84, 0x91, 0x06, 0xed, 0xad, 0x5d, 0xf5, 0xd5, 0x57, 0x5f, 0x55, 0x57, 0xb5, 0xe1, 0x63, 0x46, + 0x92, 0x80, 0xe4, 0xab, 0x38, 0x61, 0x63, 0xca, 0x30, 0x23, 0x63, 0xf6, 0x6b, 0x46, 0xa8, 0x93, + 0xe5, 0x29, 0x4b, 0xd1, 0x93, 0xca, 0xeb, 0x08, 0x6f, 0xff, 0xc3, 0x30, 0x0d, 0x53, 0xe1, 0x1c, + 0xf3, 0x93, 0xc4, 0xf5, 0x9f, 0x6b, 0x2c, 0x78, 0xbe, 0x88, 0x75, 0x92, 0xbe, 0x9e, 0x42, 0xd8, + 0x77, 0xbc, 0xc3, 0x03, 0xef, 0x06, 0x2f, 0xe3, 0x00, 0xb3, 0x34, 0x57, 0x88, 0x17, 0x07, 0x88, + 0x0c, 0xe7, 0x78, 0x55, 0x10, 0xd8, 0x9a, 0x7b, 0x43, 0x72, 0x1a, 0xa7, 0xc9, 0x4e, 0x82, 0x41, + 0x98, 0xa6, 0xe1, 0x92, 0x8c, 0xc5, 0xd7, 0x7c, 0x7d, 0x31, 0x66, 0xf1, 0x8a, 0x50, 0x86, 0x57, + 0x99, 0x04, 0x8c, 0xfe, 0x34, 0xa0, 0xf3, 0xc6, 0x9d, 0xcc, 0x3c, 0x42, 0xb3, 0x34, 0xa1, 0x84, + 0xa2, 0x09, 0x98, 0x01, 0x59, 0xc6, 0x1b, 0x92, 0xfb, 0xec, 0x92, 0x5a, 0xc6, 0xb0, 0x7e, 0x62, + 0xbe, 0x1a, 0x39, 0x5a, 0x33, 0x78, 0x91, 0x4e, 0x11, 0x30, 0x95, 0xd8, 0xb3, 0x4b, 0x0f, 0x82, + 0xe2, 0x48, 0xd1, 0x6b, 0x68, 0x93, 0x24, 0xf0, 0xe7, 0xcb, 0x74, 0xf1, 0xb3, 0xf5, 0xc1, 0xd0, + 0x38, 0x31, 0x5f, 0xbd, 0xbc, 0x97, 0xe2, 0x9b, 0x24, 0x70, 0x39, 0xd0, 0x6b, 0x11, 0x75, 0x42, + 0x53, 0x30, 0xe7, 0x24, 0x8c, 0x13, 0xc5, 0x50, 0x17, 0x0c, 0x9f, 0xdc, 0xcb, 0xe0, 0x72, 0xac, + 0xe4, 0x80, 0x79, 0x79, 0x1e, 0xfd, 0x66, 0x40, 0xf7, 0xbc, 0x68, 0x28, 0x9d, 0x25, 0x17, 0x29, + 0x9a, 0x40, 0xa7, 0x6c, 0xb1, 0x4f, 0x09, 0xb3, 0x0c, 0x41, 0x6d, 0xeb, 0xd4, 0xb2, 0x81, 0x65, + 0xe0, 0x29, 0x61, 0xde, 0xd1, 0x46, 0xfb, 0x42, 0x0e, 0x1c, 0x2f, 0x31, 0x65, 0x7e, 0x44, 0xe2, + 0x30, 0x62, 0xfe, 0x22, 0xc2, 0x49, 0x48, 0x02, 0x51, 0x67, 0xdd, 0x7b, 0xca, 0x5d, 0x6f, 0x85, + 0x67, 0x22, 0x1d, 0xa3, 0xdf, 0x0d, 0x38, 0x9e, 0x70, 0x9d, 0x09, 0x5d, 0xd3, 0x1f, 0xc4, 0xfd, + 0x09, 0x31, 0x1e, 0x3c, 0x59, 0x14, 0x66, 0x5f, 0xde, 0xab, 0xd2, 0xf3, 0xf2, 0x50, 0xcf, 0x1e, + 0x81, 0xfb, 0xe8, 0xfa, 0x76, 0x50, 0xf3, 0x7a, 0x8b, 0x5d, 0xf3, 0xff, 0xd6, 0x46, 0xe1, 0xe9, + 0xce, 0xfd, 0x0b, 0x61, 0xdf, 0x42, 0x97, 0xf7, 0xd7, 0xcf, 0x0b, 0xab, 0x92, 0x35, 0x70, 0xf6, + 0x77, 0xc2, 0xd9, 0x09, 0xf6, 0x3a, 0x3c, 0xac, 0x9a, 0xa5, 0x8f, 0xa0, 0x21, 0x75, 0xa8, 0xfc, + 0xea, 0x6b, 0x14, 0x41, 0xf3, 0x5c, 0x4e, 0x2b, 0x7a, 0x03, 0xed, 0xb2, 0x04, 0x95, 0xe5, 0x85, + 0x9e, 0x45, 0x4d, 0x75, 0x55, 0xbe, 0x2a, 0xbc, 0x8a, 0x42, 0x7d, 0x68, 0xd1, 0xf4, 0x82, 0xfd, + 0x82, 0x73, 0x22, 0xf2, 0xb4, 0xbd, 0xf2, 0x7b, 0xf4, 0x4f, 0x03, 0x1e, 0x9f, 0x72, 0xa1, 0xe8, + 0x6b, 0x68, 0x2a, 0x2e, 0x95, 0xe6, 0xd9, 0x61, 0x31, 0x4a, 0x94, 0x4a, 0x51, 0xe0, 0xd1, 0xe7, + 0xd0, 0x5a, 0x44, 0x38, 0x4e, 0xfc, 0x58, 0x36, 0xb2, 0xed, 0x9a, 0xdb, 0xdb, 0x41, 0x73, 0xc2, + 0x6d, 0xb3, 0xa9, 0xd7, 0x14, 0xce, 0x59, 0x80, 0x3e, 0x83, 0x6e, 0x9c, 0xc4, 0x2c, 0xc6, 0x4b, + 0xd5, 0x7e, 0xab, 0x2b, 0xca, 0xee, 0x28, 0xab, 0xec, 0x3c, 0xfa, 0x02, 0xc4, 0x3d, 0xc8, 0xd9, + 0x2e, 0x90, 0x75, 0x81, 0xec, 0x71, 0x87, 0x18, 0x5e, 0x85, 0xf5, 0xa0, 0xa3, 0x61, 0xe3, 0xc0, + 0x7a, 0x74, 0xa8, 0x5d, 0xce, 0x87, 0x88, 0x9a, 0x4d, 0xdd, 0x63, 0xae, 0x7d, 0x7b, 0x3b, 0x30, + 0xdf, 0x15, 0x54, 0xb3, 0xa9, 0x67, 0x96, 0xbc, 0xb3, 0x00, 0xbd, 0x83, 0x9e, 0xc6, 0xc9, 0x5f, + 0x04, 0xeb, 0xb1, 0x60, 0xed, 0x3b, 0xf2, 0xb9, 0x70, 0x8a, 0xe7, 0xc2, 0x39, 0x2b, 0x9e, 0x0b, + 0xb7, 0xc5, 0x69, 0xaf, 0xfe, 0x1a, 0x18, 0x5e, 0xa7, 0xe4, 0xe2, 0x5e, 0xf4, 0x1d, 0xf4, 0x12, + 0x72, 0xc9, 0xfc, 0x72, 0x43, 0xa8, 0xd5, 0x78, 0xd0, 0x4e, 0x75, 0x79, 0x58, 0xb5, 0x9e, 0xe8, + 0x35, 0x80, 0xc6, 0xd1, 0x7c, 0x10, 0x87, 0x16, 0xc1, 0x85, 0x88, 0xb2, 0x34, 0x92, 0xd6, 0xc3, + 0x84, 0xf0, 0x30, 0x4d, 0xc8, 0x04, 0x6c, 0x7d, 0x85, 0x2a, 0xbe, 0x72, 0x9b, 0xda, 0xe2, 0xb2, + 0x9e, 0x57, 0xdb, 0x54, 0x45, 0xab, 0xbd, 0xfa, 0xcf, 0xdd, 0x86, 0xf7, 0xdc, 0xed, 0xef, 0xe1, + 0xd3, 0x9d, 0xdd, 0xde, 0xe3, 0x2f, 0xe5, 0x99, 0x42, 0xde, 0x50, 0x5b, 0xf6, 0x5d, 0xa2, 0x42, + 0x63, 0x31, 0x88, 0x39, 0xa1, 0xeb, 0x25, 0xa3, 0x7e, 0x84, 0x69, 0x64, 0x1d, 0x0d, 0x8d, 0x93, + 0x23, 0x39, 0x88, 0x9e, 0xb4, 0xbf, 0xc5, 0x34, 0x42, 0xcf, 0xa0, 0x85, 0xb3, 0x4c, 0x42, 0x3a, + 0x02, 0xd2, 0xc4, 0x59, 0xc6, 0x5d, 0xee, 0x8f, 0xd7, 0x5b, 0xdb, 0xb8, 0xd9, 0xda, 0xc6, 0xdf, + 0x5b, 0xdb, 0xb8, 0xba, 0xb3, 0x6b, 0x37, 0x77, 0x76, 0xed, 0x8f, 0x3b, 0xbb, 0xf6, 0xd3, 0x57, + 0x61, 0xcc, 0xa2, 0xf5, 0xdc, 0x59, 0xa4, 0xab, 0xb1, 0xfe, 0x23, 0xab, 0x8e, 0xf2, 0x6f, 0xba, + 0xff, 0x1f, 0x9e, 0x37, 0x84, 0xfd, 0xcb, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x1a, 0xb9, + 0x2e, 0xa2, 0x07, 0x00, 0x00, } func (m *ABCIResponses) Marshal() (dAtA []byte, err error) { @@ -641,6 +702,46 @@ func (m *ConsensusParamsInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ABCIResponsesInfo) 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 *ABCIResponsesInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ABCIResponsesInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if m.AbciResponses != nil { + { + size, err := m.AbciResponses.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 *Version) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -776,12 +877,12 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) - if err10 != nil { - return 0, err10 + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) + if err11 != nil { + return 0, err11 } - i -= n10 - i = encodeVarintTypes(dAtA, i, uint64(n10)) + i -= n11 + i = encodeVarintTypes(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x2a { @@ -884,6 +985,22 @@ func (m *ConsensusParamsInfo) Size() (n int) { return n } +func (m *ABCIResponsesInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AbciResponses != nil { + l = m.AbciResponses.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovTypes(uint64(m.Height)) + } + return n +} + func (m *Version) Size() (n int) { if m == nil { return 0 @@ -1326,6 +1443,112 @@ func (m *ConsensusParamsInfo) Unmarshal(dAtA []byte) error { return nil } +func (m *ABCIResponsesInfo) 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: ABCIResponsesInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ABCIResponsesInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AbciResponses", 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 m.AbciResponses == nil { + m.AbciResponses = &ABCIResponses{} + } + if err := m.AbciResponses.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(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 *Version) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/third_party/proto/tendermint/state/types.proto b/third_party/proto/tendermint/state/types.proto index 919da91e5..f3fdc0ef3 100644 --- a/third_party/proto/tendermint/state/types.proto +++ b/third_party/proto/tendermint/state/types.proto @@ -32,6 +32,11 @@ message ConsensusParamsInfo { int64 last_height_changed = 2; } +message ABCIResponsesInfo { + ABCIResponses abci_responses = 1; + int64 height = 2; +} + message Version { tendermint.version.Consensus consensus = 1 [(gogoproto.nullable) = false]; string software = 2; diff --git a/third_party/proto/tendermint/types/evidence.proto b/third_party/proto/tendermint/types/evidence.proto index 3b234571b..451b8dca3 100644 --- a/third_party/proto/tendermint/types/evidence.proto +++ b/third_party/proto/tendermint/types/evidence.proto @@ -17,20 +17,20 @@ message Evidence { // DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. message DuplicateVoteEvidence { - tendermint.types.Vote vote_a = 1; - tendermint.types.Vote vote_b = 2; - int64 total_voting_power = 3; - int64 validator_power = 4; - google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + tendermint.types.Vote vote_a = 1; + tendermint.types.Vote vote_b = 2; + int64 total_voting_power = 3; + int64 validator_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } // LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. message LightClientAttackEvidence { - tendermint.types.LightBlock conflicting_block = 1; - int64 common_height = 2; + tendermint.types.LightBlock conflicting_block = 1; + int64 common_height = 2; repeated tendermint.types.Validator byzantine_validators = 3; - int64 total_voting_power = 4; - google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + int64 total_voting_power = 4; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } message EvidenceList { diff --git a/third_party/proto/tendermint/types/types.proto b/third_party/proto/tendermint/types/types.proto index 7f7ea74ca..8d4f00972 100644 --- a/third_party/proto/tendermint/types/types.proto +++ b/third_party/proto/tendermint/types/types.proto @@ -106,10 +106,10 @@ message Vote { // Commit contains the evidence that a block was committed by a set of validators. message Commit { - int64 height = 1; - int32 round = 2; - BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; - repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; } // CommitSig is a part of the Vote included in a Commit. diff --git a/x/wasm/alias.go b/x/wasm/alias.go index 67a79ac54..a64de37bd 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -102,6 +102,7 @@ type ( MsgStoreCode = types.MsgStoreCode MsgStoreCodeResponse = types.MsgStoreCodeResponse MsgInstantiateContract = types.MsgInstantiateContract + MsgInstantiateContract2 = types.MsgInstantiateContract2 MsgInstantiateContractResponse = types.MsgInstantiateContractResponse MsgExecuteContract = types.MsgExecuteContract MsgExecuteContractResponse = types.MsgExecuteContractResponse diff --git a/x/wasm/client/cli/genesis_msg.go b/x/wasm/client/cli/genesis_msg.go index c77ab3519..affeb34fa 100644 --- a/x/wasm/client/cli/genesis_msg.go +++ b/x/wasm/client/cli/genesis_msg.go @@ -8,8 +8,6 @@ import ( "errors" "fmt" - "github.com/CosmWasm/wasmd/x/wasm/keeper" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -22,6 +20,8 @@ import ( "github.com/spf13/cobra" tmtypes "github.com/tendermint/tendermint/types" + "github.com/CosmWasm/wasmd/x/wasm/ioutils" + "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -73,6 +73,7 @@ func GenesisStoreCodeCmd(defaultNodeHome string, genesisMutator GenesisMutator) cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional") cmd.Flags().String(flagInstantiateNobody, "", "Nobody except the governance process can instantiate a contract from the code, optional") cmd.Flags().String(flagInstantiateByAddress, "", "Only this address can instantiate a contract instance from the code, optional") + cmd.Flags().StringSlice(flagInstantiateByAnyOfAddress, []string{}, "Any of the addresses can instantiate a contract from the code, optional") cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") @@ -102,7 +103,7 @@ func GenesisInstantiateContractCmd(defaultNodeHome string, genesisMutator Genesi } return genesisMutator.AlterWasmModuleState(cmd, func(state *types.GenesisState, appState map[string]json.RawMessage) error { - // simple sanity check that sender has some balance although it may be consumed by appState previous message already + // simple sanity check that sender has some balance, although it may be consumed by appState previous message already switch ok, err := hasAccountBalance(cmd, appState, senderAddr, msg.Funds); { case err != nil: return err @@ -111,7 +112,7 @@ func GenesisInstantiateContractCmd(defaultNodeHome string, genesisMutator Genesi } // does code id exists? - codeInfos, err := GetAllCodes(state) + codeInfos := GetAllCodes(state) if err != nil { return err } @@ -127,10 +128,10 @@ func GenesisInstantiateContractCmd(defaultNodeHome string, genesisMutator Genesi } // permissions correct? if !codeInfo.Info.InstantiateConfig.Allowed(senderAddr) { - return fmt.Errorf("permissions were not granted for %state", senderAddr) + return fmt.Errorf("permissions were not granted for %s", senderAddr) } state.GenMsgs = append(state.GenMsgs, types.GenesisState_GenMsgs{ - Sum: &types.GenesisState_GenMsgs_InstantiateContract{InstantiateContract: &msg}, + Sum: &types.GenesisState_GenMsgs_InstantiateContract{InstantiateContract: msg}, }) return nil }) @@ -170,7 +171,7 @@ func GenesisExecuteContractCmd(defaultNodeHome string, genesisMutator GenesisMut } return genesisMutator.AlterWasmModuleState(cmd, func(state *types.GenesisState, appState map[string]json.RawMessage) error { - // simple sanity check that sender has some balance although it may be consumed by appState previous message already + // simple sanity check that sender has some balance, although it may be consumed by appState previous message already switch ok, err := hasAccountBalance(cmd, appState, senderAddr, msg.Funds); { case err != nil: return err @@ -180,7 +181,7 @@ func GenesisExecuteContractCmd(defaultNodeHome string, genesisMutator GenesisMut // - does contract address exists? if !hasContract(state, msg.Contract) { - return fmt.Errorf("unknown contract: %state", msg.Contract) + return fmt.Errorf("unknown contract: %s", msg.Contract) } state.GenMsgs = append(state.GenMsgs, types.GenesisState_GenMsgs{ Sum: &types.GenesisState_GenMsgs_ExecuteContract{ExecuteContract: &msg}, @@ -210,7 +211,7 @@ func GenesisListCodesCmd(defaultNodeHome string, genReader GenesisReader) *cobra if err != nil { return err } - all, err := GetAllCodes(g.WasmModuleState) + all := GetAllCodes(g.WasmModuleState) if err != nil { return err } @@ -244,7 +245,7 @@ func GenesisListContractsCmd(defaultNodeHome string, genReader GenesisReader) *c return cmd } -// clientCtx marshaller works only with proto or bytes so we marshal the output ourself +// clientCtx marshaller works only with proto or bytes, so we marshal the output ourselves func printJSONOutput(cmd *cobra.Command, obj interface{}) error { clientCtx := client.GetClientContextFromCmd(cmd) bz, err := json.MarshalIndent(obj, "", " ") @@ -259,7 +260,7 @@ type CodeMeta struct { Info types.CodeInfo `json:"info"` } -func GetAllCodes(state *types.GenesisState) ([]CodeMeta, error) { +func GetAllCodes(state *types.GenesisState) []CodeMeta { all := make([]CodeMeta, len(state.Codes)) for i, c := range state.Codes { all[i] = CodeMeta{ @@ -276,13 +277,18 @@ func GetAllCodes(state *types.GenesisState) ([]CodeMeta, error) { accessConfig = *msg.InstantiatePermission } else { // default - creator, err := sdk.AccAddressFromBech32(msg.Sender) + creator := sdk.MustAccAddressFromBech32(msg.Sender) + accessConfig = state.Params.InstantiateDefaultPermission.With(creator) + } + bz := msg.WASMByteCode + if ioutils.IsGzip(msg.WASMByteCode) { + var err error + bz, err = ioutils.Uncompress(msg.WASMByteCode, uint64(types.MaxWasmSize)) if err != nil { - return nil, fmt.Errorf("sender: %s", err) + panic(fmt.Sprintf("failed to unzip wasm binary: %s", err)) } - accessConfig = state.Params.InstantiateDefaultPermission.With(creator) } - hash := sha256.Sum256(msg.WASMByteCode) + hash := sha256.Sum256(bz) all = append(all, CodeMeta{ CodeID: seq, Info: types.CodeInfo{ @@ -294,7 +300,7 @@ func GetAllCodes(state *types.GenesisState) ([]CodeMeta, error) { seq++ } } - return all, nil + return all } type ContractMeta struct { @@ -315,7 +321,7 @@ func GetAllContracts(state *types.GenesisState) []ContractMeta { for _, m := range state.GenMsgs { if msg := m.GetInstantiateContract(); msg != nil { all = append(all, ContractMeta{ - ContractAddress: keeper.BuildContractAddress(msg.CodeID, seq).String(), + ContractAddress: keeper.BuildContractAddressClassic(msg.CodeID, seq).String(), Info: types.ContractInfo{ CodeID: msg.CodeID, Creator: msg.Sender, @@ -356,7 +362,7 @@ func hasContract(state *types.GenesisState, contractAddr string) bool { seq := contractSeqValue(state) for _, m := range state.GenMsgs { if msg := m.GetInstantiateContract(); msg != nil { - if keeper.BuildContractAddress(msg.CodeID, seq).String() == contractAddr { + if keeper.BuildContractAddressClassic(msg.CodeID, seq).String() == contractAddr { return true } seq++ @@ -500,16 +506,18 @@ func getActorAddress(cmd *cobra.Command) (sdk.AccAddress, error) { return nil, err } - homeDir := client.GetClientContextFromCmd(cmd).HomeDir + clientCtx := client.GetClientContextFromCmd(cmd) + homeDir := clientCtx.HomeDir // attempt to lookup address from Keybase if no address was provided - kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, homeDir, inBuf) + kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, homeDir, inBuf, clientCtx.Codec) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get keyring service name: %w", err) } info, err := kb.Key(actorArg) if err != nil { return nil, fmt.Errorf("failed to get address from Keybase: %w", err) } - return info.GetAddress(), nil + + return info.GetAddress() } diff --git a/x/wasm/client/cli/genesis_msg_test.go b/x/wasm/client/cli/genesis_msg_test.go index 4de9e7e3d..3b3173c8b 100644 --- a/x/wasm/client/cli/genesis_msg_test.go +++ b/x/wasm/client/cli/genesis_msg_test.go @@ -3,7 +3,6 @@ package cli import ( "context" "encoding/json" - "io/ioutil" "os" "path" "testing" @@ -42,7 +41,7 @@ func TestGenesisStoreCodeCmd(t *testing.T) { minimalWasmGenesis := types.GenesisState{ Params: types.DefaultParams(), } - anyValidWasmFile, err := ioutil.TempFile(t.TempDir(), "wasm") + anyValidWasmFile, err := os.CreateTemp(t.TempDir(), "wasm") require.NoError(t, err) anyValidWasmFile.Write(wasmIdent) require.NoError(t, anyValidWasmFile.Close()) @@ -109,7 +108,7 @@ func TestInstantiateContractCmd(t *testing.T) { minimalWasmGenesis := types.GenesisState{ Params: types.DefaultParams(), } - anyValidWasmFile, err := ioutil.TempFile(t.TempDir(), "wasm") + anyValidWasmFile, err := os.CreateTemp(t.TempDir(), "wasm") require.NoError(t, err) anyValidWasmFile.Write(wasmIdent) require.NoError(t, anyValidWasmFile.Close()) @@ -368,7 +367,7 @@ func TestExecuteContractCmd(t *testing.T) { minimalWasmGenesis := types.GenesisState{ Params: types.DefaultParams(), } - anyValidWasmFile, err := ioutil.TempFile(t.TempDir(), "wasm") + anyValidWasmFile, err := os.CreateTemp(t.TempDir(), "wasm") require.NoError(t, err) anyValidWasmFile.Write(wasmIdent) require.NoError(t, anyValidWasmFile.Close()) @@ -603,11 +602,11 @@ func TestGetAllContracts(t *testing.T) { }, exp: []ContractMeta{ { - ContractAddress: keeper.BuildContractAddress(0, 1).String(), + ContractAddress: keeper.BuildContractAddressClassic(0, 1).String(), Info: types.ContractInfo{Label: "first"}, }, { - ContractAddress: keeper.BuildContractAddress(0, 2).String(), + ContractAddress: keeper.BuildContractAddressClassic(0, 2).String(), Info: types.ContractInfo{Label: "second"}, }, }, @@ -623,7 +622,7 @@ func TestGetAllContracts(t *testing.T) { }, exp: []ContractMeta{ { - ContractAddress: keeper.BuildContractAddress(0, 100).String(), + ContractAddress: keeper.BuildContractAddressClassic(0, 100).String(), Info: types.ContractInfo{Label: "hundred"}, }, }, @@ -649,7 +648,7 @@ func TestGetAllContracts(t *testing.T) { Info: types.ContractInfo{Label: "first"}, }, { - ContractAddress: keeper.BuildContractAddress(0, 100).String(), + ContractAddress: keeper.BuildContractAddressClassic(0, 100).String(), Info: types.ContractInfo{Label: "hundred"}, }, }, @@ -709,7 +708,7 @@ func executeCmdWithContext(t *testing.T, homeDir string, cmd *cobra.Command) err flagSet.Set(flags.FlagKeyringBackend, keyring.BackendTest) mockIn := testutil.ApplyMockIODiscardOutErr(cmd) - kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, homeDir, mockIn) + kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, homeDir, mockIn, clientCtx.Codec) require.NoError(t, err) _, err = kb.NewAccount(defaultTestKeyName, testdata.TestMnemonic, "", sdk.FullFundraiserPath, hd.Secp256k1) require.NoError(t, err) diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go index 15a3ae6f2..3e1deb31c 100644 --- a/x/wasm/client/cli/gov_tx.go +++ b/x/wasm/client/cli/gov_tx.go @@ -10,7 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -39,11 +39,11 @@ func ProposalStoreCodeCmd() *cobra.Command { if len(runAs) == 0 { return errors.New("run-as address is required") } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -56,12 +56,18 @@ func ProposalStoreCodeCmd() *cobra.Command { return err } + unpinCode, err := cmd.Flags().GetBool(flagUnpinCode) + if err != nil { + return err + } + content := types.StoreCodeProposal{ Title: proposalTitle, Description: proposalDescr, RunAs: runAs, WASMByteCode: src.WASMByteCode, InstantiatePermission: src.InstantiatePermission, + UnpinCode: unpinCode, } msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) @@ -80,14 +86,15 @@ func ProposalStoreCodeCmd() *cobra.Command { cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional") cmd.Flags().String(flagInstantiateNobody, "", "Nobody except the governance process can instantiate a contract from the code, optional") cmd.Flags().String(flagInstantiateByAddress, "", "Only this address can instantiate a contract instance from the code, optional") + cmd.Flags().Bool(flagUnpinCode, false, "Unpin code on upload, optional") // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -114,11 +121,11 @@ func ProposalInstantiateContractCmd() *cobra.Command { if len(runAs) == 0 { return errors.New("run-as address is required") } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -160,12 +167,12 @@ func ProposalInstantiateContractCmd() *cobra.Command { cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -185,11 +192,11 @@ func ProposalMigrateContractCmd() *cobra.Command { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -223,12 +230,12 @@ func ProposalMigrateContractCmd() *cobra.Command { } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -261,11 +268,11 @@ func ProposalExecuteContractCmd() *cobra.Command { if len(runAs) == 0 { return errors.New("run-as address is required") } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -302,12 +309,12 @@ func ProposalExecuteContractCmd() *cobra.Command { cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -325,11 +332,11 @@ func ProposalSudoContractCmd() *cobra.Command { contract := args[0] sudoMsg := []byte(args[1]) - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -362,12 +369,12 @@ func ProposalSudoContractCmd() *cobra.Command { } // proposal flagsExecute - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -387,11 +394,11 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -423,12 +430,12 @@ func ProposalUpdateContractAdminCmd() *cobra.Command { }, } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -443,11 +450,11 @@ func ProposalClearContractAdminCmd() *cobra.Command { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -478,12 +485,12 @@ func ProposalClearContractAdminCmd() *cobra.Command { }, } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -498,11 +505,11 @@ func ProposalPinCodesCmd() *cobra.Command { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -537,12 +544,12 @@ func ProposalPinCodesCmd() *cobra.Command { }, } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } @@ -569,11 +576,11 @@ func ProposalUnpinCodesCmd() *cobra.Command { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -608,36 +615,47 @@ func ProposalUnpinCodesCmd() *cobra.Command { }, } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } -func parseAccessConfig(config string) (types.AccessConfig, error) { - switch config { +func parseAccessConfig(raw string) (c types.AccessConfig, err error) { + switch raw { case "nobody": return types.AllowNobody, nil case "everybody": return types.AllowEverybody, nil default: - address, err := sdk.AccAddressFromBech32(config) - if err != nil { - return types.AccessConfig{}, fmt.Errorf("unable to parse address %s", config) + parts := strings.Split(raw, ",") + addrs := make([]sdk.AccAddress, len(parts)) + for i, v := range parts { + addr, err := sdk.AccAddressFromBech32(v) + if err != nil { + return types.AccessConfig{}, fmt.Errorf("unable to parse address %q: %s", v, err) + } + addrs[i] = addr } - return types.AccessTypeOnlyAddress.With(address), nil + defer func() { // convert panic in ".With" to error for better output + if r := recover(); r != nil { + err = r.(error) + } + }() + cfg := types.AccessTypeAnyOfAddresses.With(addrs...) + return cfg, cfg.ValidateBasic() } } func parseAccessConfigUpdates(args []string) ([]types.AccessConfigUpdate, error) { updates := make([]types.AccessConfigUpdate, len(args)) for i, c := range args { - // format: code_id,access_config - // access_config: nobody|everybody|address - parts := strings.Split(c, ",") + // format: code_id:access_config + // access_config: nobody|everybody|address(es) + parts := strings.Split(c, ":") if len(parts) != 2 { return nil, fmt.Errorf("invalid format") } @@ -662,26 +680,26 @@ func parseAccessConfigUpdates(args []string) ([]types.AccessConfigUpdate, error) func ProposalUpdateInstantiateConfigCmd() *cobra.Command { bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix() cmd := &cobra.Command{ - Use: "update-instantiate-config [code-id,permission]...", + Use: "update-instantiate-config [code-id:permission]...", Short: "Submit an update instantiate config proposal.", Args: cobra.MinimumNArgs(1), Long: strings.TrimSpace( fmt.Sprintf(`Submit an update instantiate config proposal for multiple code ids. Example: -$ %s tx gov submit-proposal update-instantiate-config 1,nobody 2,everybody 3,%s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm -`, version.AppName, bech32Prefix)), +$ %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, err := client.GetClientTxContext(cmd) if err != nil { return err } - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) + proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal title: %s", err) } - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) + proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck if err != nil { return fmt.Errorf("proposal description: %s", err) } @@ -715,11 +733,11 @@ $ %s tx gov submit-proposal update-instantiate-config 1,nobody 2,everybody 3,%s1 }, } // proposal flags - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") + cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck + cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") + cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") //nolint:staticcheck // type values must match the "ProposalHandler" "routes" in cli - cmd.Flags().String(flagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") + cmd.Flags().String(cli.FlagProposalType, "", "Permission of proposal, types: store-code/instantiate/migrate/update-admin/clear-admin/text/parameter_change/software_upgrade") //nolint:staticcheck return cmd } diff --git a/x/wasm/client/cli/gov_tx_test.go b/x/wasm/client/cli/gov_tx_test.go new file mode 100644 index 000000000..7c8600e07 --- /dev/null +++ b/x/wasm/client/cli/gov_tx_test.go @@ -0,0 +1,97 @@ +package cli + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +func TestParseAccessConfigUpdates(t *testing.T) { + specs := map[string]struct { + src []string + exp []types.AccessConfigUpdate + expErr bool + }{ + "nobody": { + src: []string{"1:nobody"}, + exp: []types.AccessConfigUpdate{{ + CodeID: 1, + InstantiatePermission: types.AccessConfig{Permission: types.AccessTypeNobody}, + }}, + }, + "everybody": { + src: []string{"1:everybody"}, + exp: []types.AccessConfigUpdate{{ + CodeID: 1, + InstantiatePermission: types.AccessConfig{Permission: types.AccessTypeEverybody}, + }}, + }, + "any of addresses - single": { + src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, + exp: []types.AccessConfigUpdate{ + { + CodeID: 1, + InstantiatePermission: types.AccessConfig{ + Permission: types.AccessTypeAnyOfAddresses, + Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, + }, + }, + }, + }, + "any of addresses - multiple": { + src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, + exp: []types.AccessConfigUpdate{ + { + CodeID: 1, + InstantiatePermission: types.AccessConfig{ + Permission: types.AccessTypeAnyOfAddresses, + Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x", "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, + }, + }, + }, + }, + "multiple code ids with different permissions": { + src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", "2:nobody"}, + exp: []types.AccessConfigUpdate{ + { + CodeID: 1, + InstantiatePermission: types.AccessConfig{ + Permission: types.AccessTypeAnyOfAddresses, + Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x", "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, + }, + }, { + CodeID: 2, + InstantiatePermission: types.AccessConfig{ + Permission: types.AccessTypeNobody, + }, + }, + }, + }, + "any of addresses - empty list": { + src: []string{"1:"}, + expErr: true, + }, + "any of addresses - invalid address": { + src: []string{"1:foo"}, + expErr: true, + }, + "any of addresses - duplicate address": { + src: []string{"1:cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, + expErr: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + got, gotErr := parseAccessConfigUpdates(spec.src) + if spec.expErr { + require.Error(t, gotErr) + return + } + require.NoError(t, gotErr) + assert.Equal(t, spec.exp, got) + }) + } +} diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index 49cea64ea..b847b3d84 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -7,7 +7,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "strconv" wasmvm "github.com/CosmWasm/wasmvm" @@ -17,6 +17,7 @@ import ( "github.com/spf13/cobra" flag "github.com/spf13/pflag" + "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -38,6 +39,8 @@ func GetQueryCmd() *cobra.Command { GetCmdGetContractState(), GetCmdListPinnedCode(), GetCmdLibVersion(), + GetCmdQueryParams(), + GetCmdBuildAddress(), ) return queryCmd } @@ -62,6 +65,47 @@ func GetCmdLibVersion() *cobra.Command { return cmd } +// GetCmdBuildAddress build a contract address +func GetCmdBuildAddress() *cobra.Command { + decoder := newArgDecoder(hex.DecodeString) + cmd := &cobra.Command{ + Use: "build-address [code-hash] [creator-address] [salt-hex-encoded] [json_encoded_init_args (required when set as fixed)]", + Short: "build contract address", + 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]) + 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") + } + + if len(args) == 3 { + cmd.Println(keeper.BuildContractAddressPredictable(codeHash, creator, salt, []byte{}).String()) + return nil + } + msg := types.RawContractMessage(args[3]) + if err := msg.ValidateBasic(); err != nil { + return fmt.Errorf("init message: %s", err) + } + cmd.Println(keeper.BuildContractAddressPredictable(codeHash, creator, salt, msg).String()) + return nil + }, + } + decoder.RegisterFlags(cmd.PersistentFlags(), "salt") + return cmd +} + // GetCmdListCode lists all wasm code uploaded func GetCmdListCode() *cobra.Command { cmd := &cobra.Command{ @@ -116,6 +160,9 @@ func GetCmdListContractByCode() *cobra.Command { if err != nil { return err } + if codeID == 0 { + return errors.New("empty code id") + } pageReq, err := client.ReadPageRequest(withPageKeyDecoded(cmd.Flags())) if err != nil { @@ -174,7 +221,7 @@ func GetCmdQueryCode() *cobra.Command { } fmt.Printf("Downloading wasm code to %s\n", args[1]) - return ioutil.WriteFile(args[1], res.Data, 0o600) + return os.WriteFile(args[1], res.Data, 0o600) }, } flags.AddQueryFlagsToCmd(cmd) @@ -493,7 +540,7 @@ func newArgDecoder(def func(string) ([]byte, error)) *argumentDecoder { func (a *argumentDecoder) RegisterFlags(f *flag.FlagSet, argName string) { f.BoolVar(&a.asciiF, "ascii", false, "ascii encoded "+argName) - f.BoolVar(&a.hexF, "hex", false, "hex encoded "+argName) + f.BoolVar(&a.hexF, "hex", false, "hex encoded "+argName) f.BoolVar(&a.b64F, "b64", false, "base64 encoded "+argName) } @@ -540,3 +587,32 @@ func withPageKeyDecoded(flagSet *flag.FlagSet) *flag.FlagSet { } return flagSet } + +// GetCmdQueryParams implements a command to return the current wasm +// parameters. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current wasm parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryParamsRequest{} + res, err := queryClient.Params(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 8f3203ea6..d65e45c2d 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -1,9 +1,10 @@ package cli import ( + "encoding/hex" "errors" "fmt" - "io/ioutil" + "os" "strconv" "github.com/cosmos/cosmos-sdk/client" @@ -11,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" flag "github.com/spf13/pflag" @@ -19,15 +21,17 @@ import ( ) const ( - flagAmount = "amount" - flagLabel = "label" - flagAdmin = "admin" - flagNoAdmin = "no-admin" - flagRunAs = "run-as" - flagInstantiateByEverybody = "instantiate-everybody" - flagInstantiateNobody = "instantiate-nobody" - flagInstantiateByAddress = "instantiate-only-address" - flagProposalType = "type" + flagAmount = "amount" + flagLabel = "label" + flagAdmin = "admin" + flagNoAdmin = "no-admin" + flagFixMsg = "fix-msg" + flagRunAs = "run-as" + flagInstantiateByEverybody = "instantiate-everybody" + flagInstantiateNobody = "instantiate-nobody" + flagInstantiateByAddress = "instantiate-only-address" + flagInstantiateByAnyOfAddress = "instantiate-anyof-addresses" + flagUnpinCode = "unpin-code" ) // GetTxCmd returns the transaction commands for this module @@ -42,6 +46,7 @@ func GetTxCmd() *cobra.Command { txCmd.AddCommand( StoreCodeCmd(), InstantiateContractCmd(), + InstantiateContract2Cmd(), ExecuteContractCmd(), MigrateContractCmd(), UpdateContractAdminCmd(), @@ -75,13 +80,14 @@ func StoreCodeCmd() *cobra.Command { cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional") cmd.Flags().String(flagInstantiateNobody, "", "Nobody except the governance process can instantiate a contract from the code, optional") - cmd.Flags().String(flagInstantiateByAddress, "", "Only this address can instantiate a contract instance from the code, optional") + cmd.Flags().String(flagInstantiateByAddress, "", "Deprecated: Only this address can instantiate a contract from the code, optional") + cmd.Flags().StringSlice(flagInstantiateByAnyOfAddress, []string{}, "Any of the addresses can instantiate a contract from the code, optional") flags.AddTxFlagsToCmd(cmd) return cmd } func parseStoreCodeArgs(file string, sender sdk.AccAddress, flags *flag.FlagSet) (types.MsgStoreCode, error) { - wasm, err := ioutil.ReadFile(file) + wasm, err := os.ReadFile(file) if err != nil { return types.MsgStoreCode{}, err } @@ -97,62 +103,89 @@ func parseStoreCodeArgs(file string, sender sdk.AccAddress, flags *flag.FlagSet) return types.MsgStoreCode{}, fmt.Errorf("invalid input file. Use wasm binary or gzip") } - var perm *types.AccessConfig + perm, err := parseAccessConfigFlags(flags) + if err != nil { + return types.MsgStoreCode{}, err + } + + msg := types.MsgStoreCode{ + Sender: sender.String(), + WASMByteCode: wasm, + InstantiatePermission: perm, + } + return msg, nil +} + +func parseAccessConfigFlags(flags *flag.FlagSet) (*types.AccessConfig, error) { + addrs, err := flags.GetStringSlice(flagInstantiateByAnyOfAddress) + if err != nil { + return nil, fmt.Errorf("flag any of: %s", err) + } + if len(addrs) != 0 { + acceptedAddrs := make([]sdk.AccAddress, len(addrs)) + for i, v := range addrs { + acceptedAddrs[i], err = sdk.AccAddressFromBech32(v) + if err != nil { + return nil, fmt.Errorf("parse %q: %w", v, err) + } + } + x := types.AccessTypeAnyOfAddresses.With(acceptedAddrs...) + return &x, nil + } + onlyAddrStr, err := flags.GetString(flagInstantiateByAddress) if err != nil { - return types.MsgStoreCode{}, fmt.Errorf("instantiate by address: %s", err) + return nil, fmt.Errorf("instantiate by address: %s", err) } if onlyAddrStr != "" { allowedAddr, err := sdk.AccAddressFromBech32(onlyAddrStr) if err != nil { - return types.MsgStoreCode{}, sdkerrors.Wrap(err, flagInstantiateByAddress) + return nil, sdkerrors.Wrap(err, flagInstantiateByAddress) } x := types.AccessTypeOnlyAddress.With(allowedAddr) - perm = &x - } else { - everybodyStr, err := flags.GetString(flagInstantiateByEverybody) + return &x, nil + } + everybodyStr, err := flags.GetString(flagInstantiateByEverybody) + if err != nil { + return nil, fmt.Errorf("instantiate by everybody: %s", err) + } + if everybodyStr != "" { + ok, err := strconv.ParseBool(everybodyStr) if err != nil { - return types.MsgStoreCode{}, fmt.Errorf("instantiate by everybody: %s", err) + return nil, fmt.Errorf("boolean value expected for instantiate by everybody: %s", err) } - if everybodyStr != "" { - ok, err := strconv.ParseBool(everybodyStr) - if err != nil { - return types.MsgStoreCode{}, fmt.Errorf("boolean value expected for instantiate by everybody: %s", err) - } - if ok { - perm = &types.AllowEverybody - } + if ok { + return &types.AllowEverybody, nil } + } - nobodyStr, err := flags.GetString(flagInstantiateNobody) + nobodyStr, err := flags.GetString(flagInstantiateNobody) + if err != nil { + return nil, fmt.Errorf("instantiate by nobody: %s", err) + } + if nobodyStr != "" { + ok, err := strconv.ParseBool(nobodyStr) if err != nil { - return types.MsgStoreCode{}, fmt.Errorf("instantiate by nobody: %s", err) + return nil, fmt.Errorf("boolean value expected for instantiate by nobody: %s", err) } - if nobodyStr != "" { - ok, err := strconv.ParseBool(nobodyStr) - if err != nil { - return types.MsgStoreCode{}, fmt.Errorf("boolean value expected for instantiate by nobody: %s", err) - } - if ok { - perm = &types.AllowNobody - } + if ok { + return &types.AllowNobody, nil } - - } - - msg := types.MsgStoreCode{ - Sender: sender.String(), - WASMByteCode: wasm, - InstantiatePermission: perm, } - return msg, nil + return nil, nil } // InstantiateContractCmd will instantiate a contract from previously uploaded code. func InstantiateContractCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "instantiate [code_id_int64] [json_encoded_init_args] --label [text] --admin [address,optional] --amount [coins,optional]", - Short: "Instantiate a wasm contract", + Use: "instantiate [code_id_int64] [json_encoded_init_args] --label [text] --admin [address,optional] --amount [coins,optional] ", + Short: "Instantiate a wasm contract", + Long: fmt.Sprintf(`Creates a new instance of an uploaded wasm code with the given 'constructor' message. +Each contract instance has a unique address assigned. +Example: +$ %s wasmd tx wasm instantiate 1 '{"foo":"bar"}' --admin="$(%s keys show mykey -a)" \ + --from mykey --amount="100ustake" --label "local0.1.0" +`, version.AppName, version.AppName), Aliases: []string{"start", "init", "inst", "i"}, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -160,7 +193,6 @@ func InstantiateContractCmd() *cobra.Command { if err != nil { return err } - msg, err := parseInstantiateArgs(args[0], args[1], clientCtx.GetFromAddress(), cmd.Flags()) if err != nil { return err @@ -168,7 +200,67 @@ func InstantiateContractCmd() *cobra.Command { if err := msg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation") + cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") + cmd.Flags().String(flagAdmin, "", "Address of an admin") + cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// InstantiateContract2Cmd will instantiate a contract from previously uploaded code with predicable address generated +func InstantiateContract2Cmd() *cobra.Command { + decoder := newArgDecoder(hex.DecodeString) + cmd := &cobra.Command{ + Use: "instantiate2 [code_id_int64] [json_encoded_init_args] [salt] --label [text] --admin [address,optional] --amount [coins,optional] " + + "--fix-msg [bool,optional]", + Short: "Instantiate a wasm contract with predictable address", + Long: fmt.Sprintf(`Creates a new instance of an uploaded wasm code with the given 'constructor' message. +Each contract instance has a unique address assigned. They are assigned automatically but in order to have predictable addresses +for special use cases, the given 'salt' argument and '--fix-msg' parameters can be used to generate a custom address. + +Predictable address example (also see '%s query wasm build-address -h'): +$ %s wasmd tx wasm instantiate2 1 '{"foo":"bar"}' $(echo -n "testing" | xxd -ps) --admin="$(%s keys show mykey -a)" \ + --from mykey --amount="100ustake" --label "local0.1.0" \ + --fix-msg +`, version.AppName, version.AppName, version.AppName), + Aliases: []string{"start", "init", "inst", "i"}, + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + salt, err := decoder.DecodeString(args[2]) + if err != nil { + return fmt.Errorf("salt: %w", err) + } + fixMsg, err := cmd.Flags().GetBool(flagFixMsg) + if err != nil { + return fmt.Errorf("fix msg: %w", err) + } + data, err := parseInstantiateArgs(args[0], args[1], clientCtx.GetFromAddress(), cmd.Flags()) + if err != nil { + return err + } + msg := &types.MsgInstantiateContract2{ + Sender: data.Sender, + Admin: data.Admin, + CodeID: data.CodeID, + Label: data.Label, + Msg: data.Msg, + Funds: data.Funds, + Salt: salt, + FixMsg: fixMsg, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -176,47 +268,49 @@ func InstantiateContractCmd() *cobra.Command { cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists") cmd.Flags().String(flagAdmin, "", "Address of an admin") cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin") + cmd.Flags().Bool(flagFixMsg, false, "An optional flag to include the json_encoded_init_args for the predictable address generation mode") + decoder.RegisterFlags(cmd.PersistentFlags(), "salt") flags.AddTxFlagsToCmd(cmd) return cmd } -func parseInstantiateArgs(rawCodeID, initMsg string, sender sdk.AccAddress, flags *flag.FlagSet) (types.MsgInstantiateContract, error) { +func parseInstantiateArgs(rawCodeID, initMsg string, sender sdk.AccAddress, flags *flag.FlagSet) (*types.MsgInstantiateContract, error) { // get the id of the code to instantiate codeID, err := strconv.ParseUint(rawCodeID, 10, 64) if err != nil { - return types.MsgInstantiateContract{}, err + return nil, err } amountStr, err := flags.GetString(flagAmount) if err != nil { - return types.MsgInstantiateContract{}, fmt.Errorf("amount: %s", err) + return nil, fmt.Errorf("amount: %s", err) } amount, err := sdk.ParseCoinsNormalized(amountStr) if err != nil { - return types.MsgInstantiateContract{}, fmt.Errorf("amount: %s", err) + return nil, fmt.Errorf("amount: %s", err) } label, err := flags.GetString(flagLabel) if err != nil { - return types.MsgInstantiateContract{}, fmt.Errorf("label: %s", err) + return nil, fmt.Errorf("label: %s", err) } if label == "" { - return types.MsgInstantiateContract{}, errors.New("label is required on all contracts") + return nil, errors.New("label is required on all contracts") } adminStr, err := flags.GetString(flagAdmin) if err != nil { - return types.MsgInstantiateContract{}, fmt.Errorf("admin: %s", err) + return nil, fmt.Errorf("admin: %s", err) } noAdmin, err := flags.GetBool(flagNoAdmin) if err != nil { - return types.MsgInstantiateContract{}, fmt.Errorf("no-admin: %s", err) + return nil, fmt.Errorf("no-admin: %s", err) } // ensure sensible admin is set (or explicitly immutable) if adminStr == "" && !noAdmin { - return types.MsgInstantiateContract{}, fmt.Errorf("you must set an admin or explicitly pass --no-admin to make it immutible (wasmd issue #719)") + return nil, fmt.Errorf("you must set an admin or explicitly pass --no-admin to make it immutible (wasmd issue #719)") } if adminStr != "" && noAdmin { - return types.MsgInstantiateContract{}, fmt.Errorf("you set an admin and passed --no-admin, those cannot both be true") + return nil, fmt.Errorf("you set an admin and passed --no-admin, those cannot both be true") } // build and sign the transaction, then broadcast to Tendermint @@ -228,7 +322,7 @@ func parseInstantiateArgs(rawCodeID, initMsg string, sender sdk.AccAddress, flag Msg: []byte(initMsg), Admin: adminStr, } - return msg, nil + return &msg, nil } // ExecuteContractCmd will instantiate a contract from previously uploaded code. diff --git a/x/wasm/client/cli/tx_test.go b/x/wasm/client/cli/tx_test.go new file mode 100644 index 000000000..8fc0cc9de --- /dev/null +++ b/x/wasm/client/cli/tx_test.go @@ -0,0 +1,59 @@ +package cli + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +func TestParseAccessConfigFlags(t *testing.T) { + specs := map[string]struct { + args []string + expCfg *types.AccessConfig + expErr bool + }{ + "nobody": { + args: []string{"--instantiate-nobody=true"}, + expCfg: &types.AccessConfig{Permission: types.AccessTypeNobody}, + }, + "everybody": { + args: []string{"--instantiate-everybody=true"}, + expCfg: &types.AccessConfig{Permission: types.AccessTypeEverybody}, + }, + "only address": { + args: []string{"--instantiate-only-address=cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, + expCfg: &types.AccessConfig{Permission: types.AccessTypeOnlyAddress, Address: "cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"}, + }, + "only address - invalid": { + args: []string{"--instantiate-only-address=foo"}, + expErr: true, + }, + "any of address": { + args: []string{"--instantiate-anyof-addresses=cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}, + expCfg: &types.AccessConfig{Permission: types.AccessTypeAnyOfAddresses, Addresses: []string{"cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x", "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"}}, + }, + "any of address - invalid": { + args: []string{"--instantiate-anyof-addresses=cosmos1vx8knpllrj7n963p9ttd80w47kpacrhuts497x,foo"}, + expErr: true, + }, + "not set": { + args: []string{}, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + flags := StoreCodeCmd().Flags() + require.NoError(t, flags.Parse(spec.args)) + gotCfg, gotErr := parseAccessConfigFlags(flags) + if spec.expErr { + require.Error(t, gotErr) + return + } + require.NoError(t, gotErr) + assert.Equal(t, spec.expCfg, gotCfg) + }) + } +} diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go index 6d4735180..fc1c45ef8 100644 --- a/x/wasm/client/proposal_handler.go +++ b/x/wasm/client/proposal_handler.go @@ -4,19 +4,18 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" "github.com/CosmWasm/wasmd/x/wasm/client/cli" - "github.com/CosmWasm/wasmd/x/wasm/client/rest" ) // ProposalHandlers define the wasm cli proposal types and rest handler. var ProposalHandlers = []govclient.ProposalHandler{ - govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler), - govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler), - govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler), - govclient.NewProposalHandler(cli.ProposalExecuteContractCmd, rest.ExecuteProposalHandler), - govclient.NewProposalHandler(cli.ProposalSudoContractCmd, rest.SudoProposalHandler), - govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler), - govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler), - govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler), - govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd, rest.UnpinCodeProposalHandler), - govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd, rest.UpdateInstantiateConfigProposalHandler), + govclient.NewProposalHandler(cli.ProposalStoreCodeCmd), + govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd), + govclient.NewProposalHandler(cli.ProposalMigrateContractCmd), + govclient.NewProposalHandler(cli.ProposalExecuteContractCmd), + govclient.NewProposalHandler(cli.ProposalSudoContractCmd), + govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd), + govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd), + govclient.NewProposalHandler(cli.ProposalPinCodesCmd), + govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd), + govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd), } diff --git a/x/wasm/client/proposal_handler_test.go b/x/wasm/client/proposal_handler_test.go deleted file mode 100644 index 3e82c62e0..000000000 --- a/x/wasm/client/proposal_handler_test.go +++ /dev/null @@ -1,298 +0,0 @@ -package client - -import ( - "bytes" - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/gorilla/mux" - "github.com/stretchr/testify/require" - - "github.com/CosmWasm/wasmd/x/wasm/keeper" -) - -func TestGovRestHandlers(t *testing.T) { - type dict map[string]interface{} - var ( - anyAddress = "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz" - aBaseReq = dict{ - "from": anyAddress, - "memo": "rest test", - "chain_id": "testing", - "account_number": "1", - "sequence": "1", - "fees": []dict{{"denom": "ustake", "amount": "1000000"}}, - } - ) - encodingConfig := keeper.MakeEncodingConfig(t) - clientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(authtypes.AccountRetriever{}). - WithBroadcastMode(flags.BroadcastBlock). - WithChainID("testing") - - // router setup as in gov/client/rest/tx.go - propSubRtr := mux.NewRouter().PathPrefix("/gov/proposals").Subrouter() - for _, ph := range ProposalHandlers { - r := ph.RESTHandler(clientCtx) - propSubRtr.HandleFunc(fmt.Sprintf("/%s", r.SubRoute), r.Handler).Methods("POST") - } - - specs := map[string]struct { - srcBody dict - srcPath string - expCode int - }{ - "store-code": { - srcPath: "/gov/proposals/wasm_store_code", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "store-code", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "wasm_byte_code": []byte("valid wasm byte code"), - "source": "https://example.com/", - "builder": "my/builder:tag", - "instantiate_permission": dict{ - "permission": "OnlyAddress", - "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - }, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "store-code without permission": { - srcPath: "/gov/proposals/wasm_store_code", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "store-code", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "wasm_byte_code": []byte("valid wasm byte code"), - "source": "https://example.com/", - "builder": "my/builder:tag", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "store-code invalid permission": { - srcPath: "/gov/proposals/wasm_store_code", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "store-code", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "wasm_byte_code": []byte("valid wasm byte code"), - "source": "https://example.com/", - "builder": "my/builder:tag", - "instantiate_permission": dict{ - "permission": "Nobody", - "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - }, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "store-code with incomplete proposal data: blank title": { - srcPath: "/gov/proposals/wasm_store_code", - srcBody: dict{ - "title": "", - "description": "My proposal", - "type": "store-code", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "wasm_byte_code": []byte("valid wasm byte code"), - "source": "https://example.com/", - "builder": "my/builder:tag", - "instantiate_permission": dict{ - "permission": "OnlyAddress", - "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - }, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "store-code with incomplete content data: no wasm_byte_code": { - srcPath: "/gov/proposals/wasm_store_code", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "store-code", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "wasm_byte_code": "", - "source": "https://example.com/", - "builder": "my/builder:tag", - "instantiate_permission": dict{ - "permission": "OnlyAddress", - "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - }, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "instantiate contract": { - srcPath: "/gov/proposals/wasm_instantiate", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "instantiate", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "admin": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "code_id": "1", - "label": "https://example.com/", - "msg": dict{"recipient": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz"}, - "funds": []dict{{"denom": "ustake", "amount": "100"}}, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "migrate contract": { - srcPath: "/gov/proposals/wasm_migrate", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "code_id": "1", - "msg": dict{"foo": "bar"}, - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "execute contract": { - srcPath: "/gov/proposals/wasm_execute", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "msg": dict{"foo": "bar"}, - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "execute contract fails with no run_as": { - srcPath: "/gov/proposals/wasm_execute", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "msg": dict{"foo": "bar"}, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "execute contract fails with no message": { - srcPath: "/gov/proposals/wasm_execute", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "sudo contract": { - srcPath: "/gov/proposals/wasm_sudo", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "msg": dict{"foo": "bar"}, - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "sudo contract fails with no message": { - srcPath: "/gov/proposals/wasm_sudo", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusBadRequest, - }, - "update contract admin": { - srcPath: "/gov/proposals/wasm_update_admin", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "new_admin": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - "clear contract admin": { - srcPath: "/gov/proposals/wasm_clear_admin", - srcBody: dict{ - "title": "Test Proposal", - "description": "My proposal", - "type": "migrate", - "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - "deposit": []dict{{"denom": "ustake", "amount": "10"}}, - "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", - "base_req": aBaseReq, - }, - expCode: http.StatusOK, - }, - } - for msg, spec := range specs { - t.Run(msg, func(t *testing.T) { - src, err := json.Marshal(spec.srcBody) - require.NoError(t, err) - - // when - r := httptest.NewRequest("POST", spec.srcPath, bytes.NewReader(src)) - w := httptest.NewRecorder() - propSubRtr.ServeHTTP(w, r) - - // then - require.Equal(t, spec.expCode, w.Code, w.Body.String()) - }) - } -} diff --git a/x/wasm/client/rest/gov.go b/x/wasm/client/rest/gov.go deleted file mode 100644 index 3ba2b8f08..000000000 --- a/x/wasm/client/rest/gov.go +++ /dev/null @@ -1,523 +0,0 @@ -package rest - -import ( - "encoding/json" - "net/http" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - govrest "github.com/cosmos/cosmos-sdk/x/gov/client/rest" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -type StoreCodeProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - RunAs string `json:"run_as" yaml:"run_as"` - // WASMByteCode can be raw or gzip compressed - WASMByteCode []byte `json:"wasm_byte_code" yaml:"wasm_byte_code"` - // InstantiatePermission to apply on contract creation, optional - InstantiatePermission *types.AccessConfig `json:"instantiate_permission" yaml:"instantiate_permission"` -} - -func (s StoreCodeProposalJSONReq) Content() govtypes.Content { - return &types.StoreCodeProposal{ - Title: s.Title, - Description: s.Description, - RunAs: s.RunAs, - WASMByteCode: s.WASMByteCode, - InstantiatePermission: s.InstantiatePermission, - } -} - -func (s StoreCodeProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s StoreCodeProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s StoreCodeProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func StoreCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_store_code", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req StoreCodeProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type InstantiateProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - RunAs string `json:"run_as" yaml:"run_as"` - // Admin is an optional address that can execute migrations - Admin string `json:"admin,omitempty" yaml:"admin"` - Code uint64 `json:"code_id" yaml:"code_id"` - Label string `json:"label" yaml:"label"` - Msg json.RawMessage `json:"msg" yaml:"msg"` - Funds sdk.Coins `json:"funds" yaml:"funds"` -} - -func (s InstantiateProposalJSONReq) Content() govtypes.Content { - return &types.InstantiateContractProposal{ - Title: s.Title, - Description: s.Description, - RunAs: s.RunAs, - Admin: s.Admin, - CodeID: s.Code, - Label: s.Label, - Msg: types.RawContractMessage(s.Msg), - Funds: s.Funds, - } -} - -func (s InstantiateProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s InstantiateProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s InstantiateProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func InstantiateProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_instantiate", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req InstantiateProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type MigrateProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - Contract string `json:"contract" yaml:"contract"` - Code uint64 `json:"code_id" yaml:"code_id"` - Msg json.RawMessage `json:"msg" yaml:"msg"` -} - -func (s MigrateProposalJSONReq) Content() govtypes.Content { - return &types.MigrateContractProposal{ - Title: s.Title, - Description: s.Description, - Contract: s.Contract, - CodeID: s.Code, - Msg: types.RawContractMessage(s.Msg), - } -} - -func (s MigrateProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s MigrateProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s MigrateProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func MigrateProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_migrate", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req MigrateProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type ExecuteProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - Contract string `json:"contract" yaml:"contract"` - Msg json.RawMessage `json:"msg" yaml:"msg"` - // RunAs is the role that is passed to the contract's environment - RunAs string `json:"run_as" yaml:"run_as"` - Funds sdk.Coins `json:"funds" yaml:"funds"` -} - -func (s ExecuteProposalJSONReq) Content() govtypes.Content { - return &types.ExecuteContractProposal{ - Title: s.Title, - Description: s.Description, - Contract: s.Contract, - Msg: types.RawContractMessage(s.Msg), - RunAs: s.RunAs, - Funds: s.Funds, - } -} - -func (s ExecuteProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s ExecuteProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s ExecuteProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func ExecuteProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_execute", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req ExecuteProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type SudoProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - Contract string `json:"contract" yaml:"contract"` - Msg json.RawMessage `json:"msg" yaml:"msg"` -} - -func (s SudoProposalJSONReq) Content() govtypes.Content { - return &types.SudoContractProposal{ - Title: s.Title, - Description: s.Description, - Contract: s.Contract, - Msg: types.RawContractMessage(s.Msg), - } -} - -func (s SudoProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s SudoProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s SudoProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func SudoProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_sudo", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req SudoProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type UpdateAdminJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - NewAdmin string `json:"new_admin" yaml:"new_admin"` - Contract string `json:"contract" yaml:"contract"` -} - -func (s UpdateAdminJSONReq) Content() govtypes.Content { - return &types.UpdateAdminProposal{ - Title: s.Title, - Description: s.Description, - Contract: s.Contract, - NewAdmin: s.NewAdmin, - } -} - -func (s UpdateAdminJSONReq) GetProposer() string { - return s.Proposer -} - -func (s UpdateAdminJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s UpdateAdminJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func UpdateContractAdminProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_update_admin", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req UpdateAdminJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type ClearAdminJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - Contract string `json:"contract" yaml:"contract"` -} - -func (s ClearAdminJSONReq) Content() govtypes.Content { - return &types.ClearAdminProposal{ - Title: s.Title, - Description: s.Description, - Contract: s.Contract, - } -} - -func (s ClearAdminJSONReq) GetProposer() string { - return s.Proposer -} - -func (s ClearAdminJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s ClearAdminJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func ClearContractAdminProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "wasm_clear_admin", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req ClearAdminJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type PinCodeJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - CodeIDs []uint64 `json:"code_ids" yaml:"code_ids"` -} - -func (s PinCodeJSONReq) Content() govtypes.Content { - return &types.PinCodesProposal{ - Title: s.Title, - Description: s.Description, - CodeIDs: s.CodeIDs, - } -} - -func (s PinCodeJSONReq) GetProposer() string { - return s.Proposer -} - -func (s PinCodeJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s PinCodeJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func PinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "pin_code", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req PinCodeJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type UnpinCodeJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - - CodeIDs []uint64 `json:"code_ids" yaml:"code_ids"` -} - -func (s UnpinCodeJSONReq) Content() govtypes.Content { - return &types.UnpinCodesProposal{ - Title: s.Title, - Description: s.Description, - CodeIDs: s.CodeIDs, - } -} - -func (s UnpinCodeJSONReq) GetProposer() string { - return s.Proposer -} - -func (s UnpinCodeJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s UnpinCodeJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func UnpinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "unpin_code", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req UnpinCodeJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type UpdateInstantiateConfigProposalJSONReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - Proposer string `json:"proposer" yaml:"proposer"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - AccessConfigUpdates []types.AccessConfigUpdate `json:"access_config_updates" yaml:"access_config_updates"` -} - -func (s UpdateInstantiateConfigProposalJSONReq) Content() govtypes.Content { - return &types.UpdateInstantiateConfigProposal{ - Title: s.Title, - Description: s.Description, - AccessConfigUpdates: s.AccessConfigUpdates, - } -} - -func (s UpdateInstantiateConfigProposalJSONReq) GetProposer() string { - return s.Proposer -} - -func (s UpdateInstantiateConfigProposalJSONReq) GetDeposit() sdk.Coins { - return s.Deposit -} - -func (s UpdateInstantiateConfigProposalJSONReq) GetBaseReq() rest.BaseReq { - return s.BaseReq -} - -func UpdateInstantiateConfigProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler { - return govrest.ProposalRESTHandler{ - SubRoute: "update_instantiate_config", - Handler: func(w http.ResponseWriter, r *http.Request) { - var req UpdateInstantiateConfigProposalJSONReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - toStdTxResponse(cliCtx, w, req) - }, - } -} - -type wasmProposalData interface { - Content() govtypes.Content - GetProposer() string - GetDeposit() sdk.Coins - GetBaseReq() rest.BaseReq -} - -func toStdTxResponse(cliCtx client.Context, w http.ResponseWriter, data wasmProposalData) { - proposerAddr, err := sdk.AccAddressFromBech32(data.GetProposer()) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - msg, err := govtypes.NewMsgSubmitProposal(data.Content(), data.GetDeposit(), proposerAddr) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - baseReq := data.GetBaseReq().Sanitize() - if !baseReq.ValidateBasic(w) { - return - } - tx.WriteGeneratedTxResponse(cliCtx, w, baseReq, msg) -} diff --git a/x/wasm/client/rest/new_tx.go b/x/wasm/client/rest/new_tx.go deleted file mode 100644 index b261fd7fb..000000000 --- a/x/wasm/client/rest/new_tx.go +++ /dev/null @@ -1,86 +0,0 @@ -package rest - -import ( - "net/http" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" - - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func registerNewTxRoutes(cliCtx client.Context, r *mux.Router) { - r.HandleFunc("/wasm/contract/{contractAddr}/admin", setContractAdminHandlerFn(cliCtx)).Methods("PUT") - r.HandleFunc("/wasm/contract/{contractAddr}/code", migrateContractHandlerFn(cliCtx)).Methods("PUT") -} - -type migrateContractReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Admin string `json:"admin,omitempty" yaml:"admin"` - CodeID uint64 `json:"code_id" yaml:"code_id"` - Msg []byte `json:"msg,omitempty" yaml:"msg"` -} - -type updateContractAdministrateReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Admin string `json:"admin,omitempty" yaml:"admin"` -} - -func setContractAdminHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req updateContractAdministrateReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - vars := mux.Vars(r) - contractAddr := vars["contractAddr"] - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := &types.MsgUpdateAdmin{ - Sender: req.BaseReq.From, - NewAdmin: req.Admin, - Contract: contractAddr, - } - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) - } -} - -func migrateContractHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req migrateContractReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - vars := mux.Vars(r) - contractAddr := vars["contractAddr"] - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := &types.MsgMigrateContract{ - Sender: req.BaseReq.From, - Contract: contractAddr, - CodeID: req.CodeID, - Msg: req.Msg, - } - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg) - } -} diff --git a/x/wasm/client/rest/query.go b/x/wasm/client/rest/query.go deleted file mode 100644 index d497d2390..000000000 --- a/x/wasm/client/rest/query.go +++ /dev/null @@ -1,270 +0,0 @@ -package rest - -import ( - "encoding/base64" - "encoding/hex" - "encoding/json" - "fmt" - "net/http" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" - - "github.com/CosmWasm/wasmd/x/wasm/keeper" - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func registerQueryRoutes(cliCtx client.Context, r *mux.Router) { - r.HandleFunc("/wasm/code", listCodesHandlerFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/code/{codeID}", queryCodeHandlerFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/code/{codeID}/contracts", listContractsByCodeHandlerFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/contract/{contractAddr}", queryContractHandlerFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/contract/{contractAddr}/state", queryContractStateAllHandlerFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/contract/{contractAddr}/history", queryContractHistoryFn(cliCtx)).Methods("GET") - r.HandleFunc("/wasm/contract/{contractAddr}/smart/{query}", queryContractStateSmartHandlerFn(cliCtx)).Queries("encoding", "{encoding}").Methods("GET") - r.HandleFunc("/wasm/contract/{contractAddr}/raw/{key}", queryContractStateRawHandlerFn(cliCtx)).Queries("encoding", "{encoding}").Methods("GET") -} - -func listCodesHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, keeper.QueryListCode) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, json.RawMessage(res)) - } -} - -func queryCodeHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - codeID, err := strconv.ParseUint(mux.Vars(r)["codeID"], 10, 64) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%d", types.QuerierRoute, keeper.QueryGetCode, codeID) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - if len(res) == 0 { - rest.WriteErrorResponse(w, http.StatusNotFound, "contract not found") - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, json.RawMessage(res)) - } -} - -func listContractsByCodeHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - codeID, err := strconv.ParseUint(mux.Vars(r)["codeID"], 10, 64) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%d", types.QuerierRoute, keeper.QueryListContractByCode, codeID) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, json.RawMessage(res)) - } -} - -func queryContractHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContract, addr.String()) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, json.RawMessage(res)) - } -} - -func queryContractStateAllHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateAll) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - // parse res - var resultData []types.Model - err = json.Unmarshal(res, &resultData) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, resultData) - } -} - -func queryContractStateRawHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - decoder := newArgDecoder(hex.DecodeString) - addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - decoder.encoding = mux.Vars(r)["encoding"] - queryData, err := decoder.DecodeString(mux.Vars(r)["key"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateRaw) - res, height, err := cliCtx.QueryWithData(route, queryData) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx = cliCtx.WithHeight(height) - // ensure this is base64 encoded - encoded := base64.StdEncoding.EncodeToString(res) - rest.PostProcessResponse(w, cliCtx, encoded) - } -} - -type smartResponse struct { - Smart []byte `json:"smart"` -} - -func queryContractStateSmartHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - decoder := newArgDecoder(hex.DecodeString) - addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - decoder.encoding = mux.Vars(r)["encoding"] - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateSmart) - - queryData, err := decoder.DecodeString(mux.Vars(r)["query"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - res, height, err := cliCtx.QueryWithData(route, queryData) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - // return as raw bytes (to be base64-encoded) - responseData := smartResponse{Smart: res} - - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, responseData) - } -} - -func queryContractHistoryFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) - if !ok { - return - } - - route := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, keeper.QueryContractHistory, addr.String()) - res, height, err := cliCtx.Query(route) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - cliCtx = cliCtx.WithHeight(height) - rest.PostProcessResponse(w, cliCtx, json.RawMessage(res)) - } -} - -type argumentDecoder struct { - // dec is the default decoder - dec func(string) ([]byte, error) - encoding string -} - -func newArgDecoder(def func(string) ([]byte, error)) *argumentDecoder { - return &argumentDecoder{dec: def} -} - -func (a *argumentDecoder) DecodeString(s string) ([]byte, error) { - switch a.encoding { - case "hex": - return hex.DecodeString(s) - case "base64": - return base64.StdEncoding.DecodeString(s) - default: - return a.dec(s) - } -} diff --git a/x/wasm/client/rest/rest.go b/x/wasm/client/rest/rest.go deleted file mode 100644 index 2e697a6b5..000000000 --- a/x/wasm/client/rest/rest.go +++ /dev/null @@ -1,13 +0,0 @@ -package rest - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/gorilla/mux" -) - -// RegisterRoutes registers staking-related REST handlers to a router -func RegisterRoutes(cliCtx client.Context, r *mux.Router) { - registerQueryRoutes(cliCtx, r) - registerTxRoutes(cliCtx, r) - registerNewTxRoutes(cliCtx, r) -} diff --git a/x/wasm/client/rest/tx.go b/x/wasm/client/rest/tx.go deleted file mode 100644 index 17407c4b6..000000000 --- a/x/wasm/client/rest/tx.go +++ /dev/null @@ -1,149 +0,0 @@ -package rest - -import ( - "net/http" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" - - "github.com/CosmWasm/wasmd/x/wasm/ioutils" - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -func registerTxRoutes(cliCtx client.Context, r *mux.Router) { - r.HandleFunc("/wasm/code", storeCodeHandlerFn(cliCtx)).Methods("POST") - r.HandleFunc("/wasm/code/{codeId}", instantiateContractHandlerFn(cliCtx)).Methods("POST") - r.HandleFunc("/wasm/contract/{contractAddr}", executeContractHandlerFn(cliCtx)).Methods("POST") -} - -type storeCodeReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - WasmBytes []byte `json:"wasm_bytes"` -} - -type instantiateContractReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - Label string `json:"label" yaml:"label"` - Deposit sdk.Coins `json:"deposit" yaml:"deposit"` - Admin string `json:"admin,omitempty" yaml:"admin"` - Msg []byte `json:"msg" yaml:"msg"` -} - -type executeContractReq struct { - BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"` - ExecMsg []byte `json:"exec_msg" yaml:"exec_msg"` - Amount sdk.Coins `json:"coins" yaml:"coins"` -} - -func storeCodeHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req storeCodeReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - var err error - wasm := req.WasmBytes - - // gzip the wasm file - if ioutils.IsWasm(wasm) { - wasm, err = ioutils.GzipIt(wasm) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - } else if !ioutils.IsGzip(wasm) { - rest.WriteErrorResponse(w, http.StatusBadRequest, "Invalid input file, use wasm binary or zip") - return - } - - // build and sign the transaction, then broadcast to Tendermint - msg := types.MsgStoreCode{ - Sender: req.BaseReq.From, - WASMByteCode: wasm, - } - - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg) - } -} - -func instantiateContractHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req instantiateContractReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - vars := mux.Vars(r) - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - // get the id of the code to instantiate - codeID, err := strconv.ParseUint(vars["codeId"], 10, 64) - if err != nil { - return - } - - msg := types.MsgInstantiateContract{ - Sender: req.BaseReq.From, - CodeID: codeID, - Label: req.Label, - Funds: req.Deposit, - Msg: req.Msg, - Admin: req.Admin, - } - - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg) - } -} - -func executeContractHandlerFn(cliCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req executeContractReq - if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) { - return - } - vars := mux.Vars(r) - contractAddr := vars["contractAddr"] - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - msg := types.MsgExecuteContract{ - Sender: req.BaseReq.From, - Contract: contractAddr, - Msg: req.ExecMsg, - Funds: req.Amount, - } - - if err := msg.ValidateBasic(); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) - return - } - - tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg) - } -} diff --git a/x/wasm/genesis_test.go b/x/wasm/genesis_test.go index ea97c97f0..9b97213db 100644 --- a/x/wasm/genesis_test.go +++ b/x/wasm/genesis_test.go @@ -13,8 +13,8 @@ func TestInitGenesis(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := data.faucet.NewFundedAccount(data.ctx, deposit.Add(deposit...)...) - fred := data.faucet.NewFundedAccount(data.ctx, topUp...) + creator := data.faucet.NewFundedRandomAccount(data.ctx, deposit.Add(deposit...)...) + fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...) h := data.module.Route().Handler() q := data.module.LegacyQuerierHandler(nil) diff --git a/x/wasm/handler.go b/x/wasm/handler.go index e6004cd7a..c7f27b754 100644 --- a/x/wasm/handler.go +++ b/x/wasm/handler.go @@ -29,6 +29,8 @@ func NewHandler(k types.ContractOpsKeeper) sdk.Handler { res, err = msgServer.StoreCode(sdk.WrapSDKContext(ctx), msg) case *MsgInstantiateContract: res, err = msgServer.InstantiateContract(sdk.WrapSDKContext(ctx), msg) + case *MsgInstantiateContract2: + res, err = msgServer.InstantiateContract2(sdk.WrapSDKContext(ctx), msg) case *MsgExecuteContract: res, err = msgServer.ExecuteContract(sdk.WrapSDKContext(ctx), msg) case *MsgMigrateContract: diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 7e76f6e9a..0acc70527 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -3,15 +3,15 @@ package wasm import ( "math" - ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" + sdkerrors "cosmossdk.io/errors" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" types "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -37,14 +37,14 @@ func (i IBCHandler) OnChanOpenInit( chanCap *capabilitytypes.Capability, counterParty channeltypes.Counterparty, version string, -) error { +) (string, error) { // ensure port, version, capability if err := ValidateChannelParams(channelID); err != nil { - return err + return version, err } contractAddr, err := ContractFromPortID(portID) if err != nil { - return sdkerrors.Wrapf(err, "contract port id") + return version, sdkerrors.Wrapf(err, "contract port id") } msg := wasmvmtypes.IBCChannelOpenMsg{ @@ -61,13 +61,13 @@ func (i IBCHandler) OnChanOpenInit( } _, err = i.keeper.OnOpenChannel(ctx, contractAddr, msg) if err != nil { - return err + return version, err } // Claim channel capability passed back by IBC module if err := i.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return sdkerrors.Wrap(err, "claim capability") + return version, sdkerrors.Wrap(err, "claim capability") } - return nil + return version, nil } // OnChanOpenTry implements the IBCModule interface @@ -240,12 +240,12 @@ func (i IBCHandler) OnRecvPacket( ) ibcexported.Acknowledgement { contractAddr, err := ContractFromPortID(packet.DestinationPort) if err != nil { - return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(err, "contract port id").Error()) + return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(err, "contract port id")) } msg := wasmvmtypes.IBCPacketReceiveMsg{Packet: newIBCPacket(packet), Relayer: relayer.String()} ack, err := i.keeper.OnRecvPacket(ctx, contractAddr, msg) if err != nil { - return channeltypes.NewErrorAcknowledgement(err.Error()) + return channeltypes.NewErrorAcknowledgement(err) } return ContractConfirmStateAck(ack) } diff --git a/x/wasm/ibc_reflect_test.go b/x/wasm/ibc_reflect_test.go index 16a10c8b7..597fc92d2 100644 --- a/x/wasm/ibc_reflect_test.go +++ b/x/wasm/ibc_reflect_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v3/testing" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v5/testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/stretchr/testify/require" diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go index 767ccbe9a..51b290056 100644 --- a/x/wasm/ibc_test.go +++ b/x/wasm/ibc_test.go @@ -4,8 +4,8 @@ import ( "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/stretchr/testify/assert" ) diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index 16f46b7b3..b631796e2 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -2,43 +2,43 @@ package ibctesting import ( "bytes" + "context" "fmt" "testing" "time" - "github.com/cosmos/cosmos-sdk/baseapp" + tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version" + + sdkerrors "cosmossdk.io/errors" "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" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" 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/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" - "github.com/cosmos/ibc-go/v3/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" - "github.com/cosmos/ibc-go/v3/modules/core/types" - ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" - ibctesting "github.com/cosmos/ibc-go/v3/testing" - "github.com/cosmos/ibc-go/v3/testing/mock" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v5/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" + "github.com/cosmos/ibc-go/v5/modules/core/exported" + "github.com/cosmos/ibc-go/v5/modules/core/types" + ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" + "github.com/cosmos/ibc-go/v5/testing/mock" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version" tmtypes "github.com/tendermint/tendermint/types" tmversion "github.com/tendermint/tendermint/version" - wasmd "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/app/params" + "github.com/CosmWasm/wasmd/x/wasm" ) @@ -51,7 +51,7 @@ type TestChain struct { t *testing.T Coordinator *Coordinator - App ibctesting.TestingApp + App *app.WasmApp ChainID string LastHeader *ibctmtypes.Header // header for last block height committed CurrentHeader tmproto.Header // header for current block height @@ -104,7 +104,7 @@ func NewTestChain(t *testing.T, coord *Coordinator, chainID string, opts ...wasm Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amount)), } - app := NewTestingAppDecorator(t, wasmd.SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, opts, balance)) + wasmApp := app.SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, opts, balance) // create current header and call begin block header := tmproto.Header{ @@ -113,18 +113,18 @@ func NewTestChain(t *testing.T, coord *Coordinator, chainID string, opts ...wasm Time: coord.CurrentTime.UTC(), } - txConfig := app.GetTxConfig() + txConfig := params.MakeEncodingConfig().TxConfig // create an account to send transactions from chain := &TestChain{ t: t, Coordinator: coord, ChainID: chainID, - App: app, + App: wasmApp, CurrentHeader: header, - QueryServer: app.GetIBCKeeper(), + QueryServer: wasmApp.IBCKeeper, TxConfig: txConfig, - Codec: app.AppCodec(), + Codec: wasmApp.AppCodec(), Vals: valSet, Signers: signers, senderPrivKey: senderPrivKey, @@ -138,7 +138,7 @@ func NewTestChain(t *testing.T, coord *Coordinator, chainID string, opts ...wasm // GetContext returns the current context for the application. func (chain *TestChain) GetContext() sdk.Context { - return chain.App.GetBaseApp().NewContext(false, chain.CurrentHeader) + return chain.App.BaseApp.NewContext(false, chain.CurrentHeader) } // QueryProof performs an abci query with the given key and returns the proto encoded merkle proof @@ -244,10 +244,10 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) { // ensure the chain has the latest time chain.Coordinator.UpdateTimeForChain(chain) - _, r, err := wasmd.SignAndDeliver( + _, r, err := app.SignAndDeliver( chain.t, chain.TxConfig, - chain.App.GetBaseApp(), + chain.App.BaseApp, chain.GetContext().BlockHeader(), msgs, chain.ChainID, @@ -291,7 +291,7 @@ func (chain *TestChain) captureIBCEvents(r *sdk.Result) { // GetClientState retrieves the client state for the provided clientID. The client is // expected to exist otherwise testing will fail. func (chain *TestChain) GetClientState(clientID string) exported.ClientState { - clientState, found := chain.App.GetIBCKeeper().ClientKeeper.GetClientState(chain.GetContext(), clientID) + clientState, found := chain.App.IBCKeeper.ClientKeeper.GetClientState(chain.GetContext(), clientID) require.True(chain.t, found) return clientState @@ -300,13 +300,13 @@ func (chain *TestChain) GetClientState(clientID string) exported.ClientState { // GetConsensusState retrieves the consensus state for the provided clientID and height. // It will return a success boolean depending on if consensus state exists or not. func (chain *TestChain) GetConsensusState(clientID string, height exported.Height) (exported.ConsensusState, bool) { - return chain.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(chain.GetContext(), clientID, height) + return chain.App.IBCKeeper.ClientKeeper.GetClientConsensusState(chain.GetContext(), clientID, height) } // 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) + histInfo, ok := chain.App.StakingKeeper.GetHistoricalInfo(chain.GetContext(), height) if !ok { return nil, false } @@ -323,7 +323,7 @@ func (chain *TestChain) GetValsAtHeight(height int64) (*tmtypes.ValidatorSet, bo // GetAcknowledgement retrieves an acknowledgement for the provided packet. If the // acknowledgement does not exist then testing will fail. func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte { - ack, found := chain.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(chain.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) + ack, found := chain.App.IBCKeeper.ChannelKeeper.GetPacketAcknowledgement(chain.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) require.True(chain.t, found) return ack @@ -331,7 +331,7 @@ func (chain *TestChain) GetAcknowledgement(packet exported.PacketI) []byte { // GetPrefix returns the prefix for used by a chain in connection creation func (chain *TestChain) GetPrefix() commitmenttypes.MerklePrefix { - return commitmenttypes.NewMerklePrefix(chain.App.GetIBCKeeper().ConnectionKeeper.GetCommitmentPrefix().Bytes()) + return commitmenttypes.NewMerklePrefix(chain.App.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix().Bytes()) } // ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the @@ -423,7 +423,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set"))) voteSet := tmtypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet) - commit, err := tmtypes.MakeCommit(blockID, blockHeight, 1, voteSet, signers, timestamp) + commit, err := MakeCommit(context.Background(), blockID, blockHeight, 1, voteSet, signers, timestamp) require.NoError(chain.t, err) signedHeader := &tmproto.SignedHeader{ @@ -490,10 +490,10 @@ func CreateSortedSignerArray(altPrivVal, suitePrivVal tmtypes.PrivValidator, // Other applications must bind to the port in InitGenesis or modify this code. func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.ScopedKeeper, portID string) { // check if the portId is already binded, if not bind it - _, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.PortPath(portID)) + _, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.PortPath(portID)) if !ok { // create capability using the IBC capability keeper - cap, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), host.PortPath(portID)) + cap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), host.PortPath(portID)) require.NoError(chain.t, err) // claim capability using the scopedKeeper @@ -509,7 +509,7 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope // GetPortCapability returns the port capability for the given portID. The capability must // exist, otherwise testing will fail. func (chain *TestChain) GetPortCapability(portID string) *capabilitytypes.Capability { - cap, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.PortPath(portID)) + cap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.PortPath(portID)) require.True(chain.t, ok) return cap @@ -521,9 +521,9 @@ func (chain *TestChain) GetPortCapability(portID string) *capabilitytypes.Capabi func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.ScopedKeeper, portID, channelID string) { capName := host.ChannelCapabilityPath(portID, channelID) // check if the portId is already binded, if not bind it - _, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), capName) + _, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), capName) if !ok { - cap, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), capName) + cap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), capName) require.NoError(chain.t, err) err = scopedKeeper.ClaimCapability(chain.GetContext(), cap, capName) require.NoError(chain.t, err) @@ -537,55 +537,47 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc // GetChannelCapability returns the channel capability for the given portID and channelID. // The capability must exist, otherwise testing will fail. func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabilitytypes.Capability { - cap, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID)) + cap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID)) require.True(chain.t, ok) return cap } func (chain *TestChain) Balance(acc sdk.AccAddress, denom string) sdk.Coin { - return chain.GetTestSupport().BankKeeper().GetBalance(chain.GetContext(), acc, denom) + return chain.App.BankKeeper.GetBalance(chain.GetContext(), acc, denom) } func (chain *TestChain) AllBalances(acc sdk.AccAddress) sdk.Coins { - return chain.GetTestSupport().BankKeeper().GetAllBalances(chain.GetContext(), acc) + return chain.App.BankKeeper.GetAllBalances(chain.GetContext(), acc) } -func (chain TestChain) GetTestSupport() *wasmd.TestSupport { - return chain.App.(*TestingAppDecorator).TestSupport() -} - -var _ ibctesting.TestingApp = TestingAppDecorator{} - -type TestingAppDecorator struct { - *wasmd.WasmApp - t *testing.T -} - -func NewTestingAppDecorator(t *testing.T, wasmApp *wasmd.WasmApp) *TestingAppDecorator { - return &TestingAppDecorator{WasmApp: wasmApp, t: t} -} - -func (a TestingAppDecorator) GetBaseApp() *baseapp.BaseApp { - return a.TestSupport().GetBaseApp() -} - -func (a TestingAppDecorator) GetStakingKeeper() stakingkeeper.Keeper { - return a.TestSupport().StakingKeeper() -} - -func (a TestingAppDecorator) GetIBCKeeper() *ibckeeper.Keeper { - return a.TestSupport().IBCKeeper() -} +func MakeCommit(ctx context.Context, blockID tmtypes.BlockID, height int64, round int32, voteSet *tmtypes.VoteSet, validators []tmtypes.PrivValidator, now time.Time) (*tmtypes.Commit, error) { + // all sign + for i := 0; i < len(validators); i++ { + pubKey, err := validators[i].GetPubKey() + if err != nil { + return nil, err + } + vote := &tmtypes.Vote{ + ValidatorAddress: pubKey.Address(), + ValidatorIndex: int32(i), + Height: height, + Round: round, + Type: tmproto.PrecommitType, + BlockID: blockID, + Timestamp: now, + } -func (a TestingAppDecorator) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return a.TestSupport().ScopeIBCKeeper() -} + v := vote.ToProto() -func (a TestingAppDecorator) GetTxConfig() client.TxConfig { - return a.TestSupport().GetTxConfig() -} + if err := validators[i].SignVote(voteSet.ChainID(), v); err != nil { + return nil, err + } + vote.Signature = v.Signature + if _, err := voteSet.AddVote(vote); err != nil { + return nil, err + } + } -func (a TestingAppDecorator) TestSupport() *wasmd.TestSupport { - return wasmd.NewTestSupport(a.t, a.WasmApp) + return voteSet.MakeCommit(), nil } diff --git a/x/wasm/ibctesting/coordinator.go b/x/wasm/ibctesting/coordinator.go index ed85a4e78..4c9091962 100644 --- a/x/wasm/ibctesting/coordinator.go +++ b/x/wasm/ibctesting/coordinator.go @@ -6,9 +6,9 @@ import ( "testing" "time" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v3/testing" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v5/testing" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index 9411a7972..91640d428 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -3,18 +3,18 @@ package ibctesting import ( "fmt" - ibctesting "github.com/cosmos/ibc-go/v3/testing" + ibctesting "github.com/cosmos/ibc-go/v5/testing" // sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" - "github.com/cosmos/ibc-go/v3/modules/core/exported" - ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v5/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v5/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" + "github.com/cosmos/ibc-go/v5/modules/core/exported" + ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" ) // Endpoint is a which represents a channel endpoint and its associated @@ -184,7 +184,7 @@ func (endpoint *Endpoint) ConnOpenTry() error { counterpartyClient, proofClient, proofConsensus, consensusHeight, proofInit, proofHeight := endpoint.QueryConnectionHandshakeProof() msg := connectiontypes.NewMsgConnectionOpenTry( - "", endpoint.ClientID, // does not support handshake continuation + endpoint.ClientID, endpoint.Counterparty.ConnectionID, endpoint.Counterparty.ClientID, counterpartyClient, endpoint.Counterparty.Chain.GetPrefix(), []*connectiontypes.Version{ibctesting.ConnectionVersion}, endpoint.ConnectionConfig.DelayPeriod, proofInit, proofClient, proofConsensus, @@ -297,10 +297,11 @@ func (endpoint *Endpoint) ChanOpenTry() error { proof, height := endpoint.Counterparty.Chain.QueryProof(channelKey) msg := channeltypes.NewMsgChannelOpenTry( - endpoint.ChannelConfig.PortID, "", // does not support handshake continuation + endpoint.ChannelConfig.PortID, endpoint.ChannelConfig.Version, endpoint.ChannelConfig.Order, []string{endpoint.ConnectionID}, endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID, endpoint.Counterparty.ChannelConfig.Version, - proof, height, + proof, + height, endpoint.Chain.SenderAccount.GetAddress().String(), ) res, err := endpoint.Chain.SendMsgs(msg) @@ -381,7 +382,7 @@ func (endpoint *Endpoint) SendPacket(packet exported.PacketI) error { channelCap := endpoint.Chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel()) // no need to send message, acting as a module - err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), channelCap, packet) + err := endpoint.Chain.App.IBCKeeper.ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), channelCap, packet) if err != nil { return err } @@ -415,7 +416,7 @@ func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, pac channelCap := endpoint.Chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel()) // no need to send message, acting as a handler - err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack) + err := endpoint.Chain.App.IBCKeeper.ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack) if err != nil { return err } @@ -452,7 +453,7 @@ func (endpoint *Endpoint) TimeoutPacket(packet channeltypes.Packet) error { } proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) - nextSeqRecv, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextSequenceRecv(endpoint.Counterparty.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID) + nextSeqRecv, found := endpoint.Counterparty.Chain.App.IBCKeeper.ChannelKeeper.GetNextSequenceRecv(endpoint.Counterparty.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID) require.True(endpoint.Chain.t, found) timeoutMsg := channeltypes.NewMsgTimeout( @@ -468,7 +469,7 @@ func (endpoint *Endpoint) SetChannelClosed() error { channel := endpoint.GetChannel() channel.State = channeltypes.CLOSED - endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.SetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID, channel) + endpoint.Chain.App.IBCKeeper.ChannelKeeper.SetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID, channel) endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain) @@ -483,7 +484,7 @@ func (endpoint *Endpoint) GetClientState() exported.ClientState { // SetClientState sets the client state for this endpoint. func (endpoint *Endpoint) SetClientState(clientState exported.ClientState) { - endpoint.Chain.App.GetIBCKeeper().ClientKeeper.SetClientState(endpoint.Chain.GetContext(), endpoint.ClientID, clientState) + endpoint.Chain.App.IBCKeeper.ClientKeeper.SetClientState(endpoint.Chain.GetContext(), endpoint.ClientID, clientState) } // GetConsensusState retrieves the Consensus State for this endpoint at the provided height. @@ -497,13 +498,13 @@ func (endpoint *Endpoint) GetConsensusState(height exported.Height) exported.Con // SetConsensusState sets the consensus state for this endpoint. func (endpoint *Endpoint) SetConsensusState(consensusState exported.ConsensusState, height exported.Height) { - endpoint.Chain.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(endpoint.Chain.GetContext(), endpoint.ClientID, height, consensusState) + endpoint.Chain.App.IBCKeeper.ClientKeeper.SetClientConsensusState(endpoint.Chain.GetContext(), endpoint.ClientID, height, consensusState) } // GetConnection retrieves an IBC Connection for the endpoint. The // connection is expected to exist otherwise testing will fail. func (endpoint *Endpoint) GetConnection() connectiontypes.ConnectionEnd { - connection, found := endpoint.Chain.App.GetIBCKeeper().ConnectionKeeper.GetConnection(endpoint.Chain.GetContext(), endpoint.ConnectionID) + connection, found := endpoint.Chain.App.IBCKeeper.ConnectionKeeper.GetConnection(endpoint.Chain.GetContext(), endpoint.ConnectionID) require.True(endpoint.Chain.t, found) return connection @@ -511,13 +512,13 @@ func (endpoint *Endpoint) GetConnection() connectiontypes.ConnectionEnd { // SetConnection sets the connection for this endpoint. func (endpoint *Endpoint) SetConnection(connection connectiontypes.ConnectionEnd) { - endpoint.Chain.App.GetIBCKeeper().ConnectionKeeper.SetConnection(endpoint.Chain.GetContext(), endpoint.ConnectionID, connection) + endpoint.Chain.App.IBCKeeper.ConnectionKeeper.SetConnection(endpoint.Chain.GetContext(), endpoint.ConnectionID, connection) } // GetChannel retrieves an IBC Channel for the endpoint. The channel // is expected to exist otherwise testing will fail. func (endpoint *Endpoint) GetChannel() channeltypes.Channel { - channel, found := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID) + channel, found := endpoint.Chain.App.IBCKeeper.ChannelKeeper.GetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID) require.True(endpoint.Chain.t, found) return channel @@ -525,7 +526,7 @@ func (endpoint *Endpoint) GetChannel() channeltypes.Channel { // SetChannel sets the channel for this endpoint. func (endpoint *Endpoint) SetChannel(channel channeltypes.Channel) { - endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.SetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID, channel) + endpoint.Chain.App.IBCKeeper.ChannelKeeper.SetChannel(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID, channel) } // QueryClientStateProof performs and abci query for a client stat associated diff --git a/x/wasm/ibctesting/event_utils.go b/x/wasm/ibctesting/event_utils.go index 6463515ff..fb298816e 100644 --- a/x/wasm/ibctesting/event_utils.go +++ b/x/wasm/ibctesting/event_utils.go @@ -4,8 +4,8 @@ import ( "strconv" "strings" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/wasm/ibctesting/path.go b/x/wasm/ibctesting/path.go index 2ce5e044a..f4c6891d5 100644 --- a/x/wasm/ibctesting/path.go +++ b/x/wasm/ibctesting/path.go @@ -5,7 +5,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" ) // Path contains two endpoints representing two chains connected over IBC @@ -40,7 +40,7 @@ func (path *Path) SetChannelOrdered() { // if EndpointA does not contain a packet commitment for that packet. An error is returned // if a relay step fails or the packet commitment does not exist on either endpoint. func (path *Path) RelayPacket(packet channeltypes.Packet, ack []byte) error { - pc := path.EndpointA.Chain.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(path.EndpointA.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) + pc := path.EndpointA.Chain.App.IBCKeeper.ChannelKeeper.GetPacketCommitment(path.EndpointA.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) if bytes.Equal(pc, channeltypes.CommitPacket(path.EndpointA.Chain.App.AppCodec(), packet)) { // packet found, relay from A to B @@ -59,7 +59,7 @@ func (path *Path) RelayPacket(packet channeltypes.Packet, ack []byte) error { } - pc = path.EndpointB.Chain.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(path.EndpointB.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) + pc = path.EndpointB.Chain.App.IBCKeeper.ChannelKeeper.GetPacketCommitment(path.EndpointB.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) if bytes.Equal(pc, channeltypes.CommitPacket(path.EndpointB.Chain.App.AppCodec(), packet)) { // packet found, relay B to A diff --git a/x/wasm/ibctesting/wasm.go b/x/wasm/ibctesting/wasm.go index 6957f6340..b26cd854b 100644 --- a/x/wasm/ibctesting/wasm.go +++ b/x/wasm/ibctesting/wasm.go @@ -5,14 +5,11 @@ import ( "compress/gzip" "encoding/json" "fmt" - "io/ioutil" + "os" "strings" - wasmd "github.com/CosmWasm/wasmd/app" - - ibctesting "github.com/cosmos/ibc-go/v3/testing" - sdk "github.com/cosmos/cosmos-sdk/types" + ibctesting "github.com/cosmos/ibc-go/v5/testing" "github.com/golang/protobuf/proto" //nolint "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -37,7 +34,7 @@ func (chain *TestChain) SeedNewContractInstance() sdk.AccAddress { } func (chain *TestChain) StoreCodeFile(filename string) types.MsgStoreCodeResponse { - wasmCode, err := ioutil.ReadFile(filename) + wasmCode, err := os.ReadFile(filename) require.NoError(chain.t, err) if strings.HasSuffix(filename, "wasm") { // compress for gas limit var buf bytes.Buffer @@ -58,12 +55,11 @@ func (chain *TestChain) StoreCode(byteCode []byte) types.MsgStoreCodeResponse { } r, err := chain.SendMsgs(storeMsg) require.NoError(chain.t, err) - protoResult := chain.parseSDKResultData(r) - require.Len(chain.t, protoResult.Data, 1) - // unmarshal protobuf response from data + var pInstResp types.MsgStoreCodeResponse - require.NoError(chain.t, pInstResp.Unmarshal(protoResult.Data[0].Data)) + require.NoError(chain.t, pInstResp.Unmarshal(r.MsgResponses[0].Value)) require.NotEmpty(chain.t, pInstResp.CodeID) + require.NotEmpty(chain.t, pInstResp.Checksum) return pInstResp } @@ -79,11 +75,9 @@ func (chain *TestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.A r, err := chain.SendMsgs(instantiateMsg) require.NoError(chain.t, err) - protoResult := chain.parseSDKResultData(r) - require.Len(chain.t, protoResult.Data, 1) var pExecResp types.MsgInstantiateContractResponse - require.NoError(chain.t, pExecResp.Unmarshal(protoResult.Data[0].Data)) + require.NoError(chain.t, pExecResp.Unmarshal(r.MsgResponses[0].Value)) a, err := sdk.AccAddressFromBech32(pExecResp.Address) require.NoError(chain.t, err) return a @@ -127,16 +121,7 @@ func (chain *TestChain) SmartQuery(contractAddr string, queryMsg interface{}, re return json.Unmarshal(resp.Data, response) } -func (chain *TestChain) parseSDKResultData(r *sdk.Result) sdk.TxMsgData { - var protoResult sdk.TxMsgData - require.NoError(chain.t, proto.Unmarshal(r.Data, &protoResult)) - return protoResult -} - // ContractInfo is a helper function to returns the ContractInfo for the given contract address func (chain *TestChain) ContractInfo(contractAddr sdk.AccAddress) *types.ContractInfo { - type testSupporter interface { - TestSupport() *wasmd.TestSupport - } - return chain.App.(testSupporter).TestSupport().WasmKeeper().GetContractInfo(chain.GetContext(), contractAddr) + return chain.App.WasmKeeper.GetContractInfo(chain.GetContext(), contractAddr) } diff --git a/x/wasm/ioutils/ioutil.go b/x/wasm/ioutils/ioutil.go index 9c7bd81f0..a34a43e9e 100644 --- a/x/wasm/ioutils/ioutil.go +++ b/x/wasm/ioutils/ioutil.go @@ -4,29 +4,22 @@ import ( "bytes" "compress/gzip" "io" - "io/ioutil" "github.com/CosmWasm/wasmd/x/wasm/types" ) -// Uncompress returns gzip uncompressed content if input was gzip, or original src otherwise -func Uncompress(src []byte, limit uint64) ([]byte, error) { - switch n := uint64(len(src)); { - case n < 3: - return src, nil - case n > limit: +// Uncompress expects a valid gzip source to unpack or fails. See IsGzip +func Uncompress(gzipSrc []byte, limit uint64) ([]byte, error) { + if uint64(len(gzipSrc)) > limit { return nil, types.ErrLimit } - if !bytes.Equal(gzipIdent, src[0:3]) { - return src, nil - } - zr, err := gzip.NewReader(bytes.NewReader(src)) + zr, err := gzip.NewReader(bytes.NewReader(gzipSrc)) if err != nil { return nil, err } zr.Multistream(false) defer zr.Close() - return ioutil.ReadAll(LimitReader(zr, int64(limit))) + return io.ReadAll(LimitReader(zr, int64(limit))) } // LimitReader returns a Reader that reads from r diff --git a/x/wasm/ioutils/ioutil_test.go b/x/wasm/ioutils/ioutil_test.go index 13bbbb110..3399abf29 100644 --- a/x/wasm/ioutils/ioutil_test.go +++ b/x/wasm/ioutils/ioutil_test.go @@ -5,8 +5,7 @@ import ( "compress/gzip" "errors" "io" - "io/ioutil" - "strings" + "os" "testing" "github.com/stretchr/testify/assert" @@ -16,10 +15,10 @@ import ( ) func TestUncompress(t *testing.T) { - wasmRaw, err := ioutil.ReadFile("../keeper/testdata/hackatom.wasm") + wasmRaw, err := os.ReadFile("../keeper/testdata/hackatom.wasm") require.NoError(t, err) - wasmGzipped, err := ioutil.ReadFile("../keeper/testdata/hackatom.wasm.gzip") + wasmGzipped, err := os.ReadFile("../keeper/testdata/hackatom.wasm.gzip") require.NoError(t, err) const maxSize = 400_000 @@ -29,30 +28,10 @@ func TestUncompress(t *testing.T) { expError error expResult []byte }{ - "handle wasm uncompressed": { - src: wasmRaw, - expResult: wasmRaw, - }, "handle wasm compressed": { src: wasmGzipped, expResult: wasmRaw, }, - "handle nil slice": { - src: nil, - expResult: nil, - }, - "handle short unidentified": { - src: []byte{0x1, 0x2}, - expResult: []byte{0x1, 0x2}, - }, - "handle input slice exceeding limit": { - src: []byte(strings.Repeat("a", maxSize+1)), - expError: types.ErrLimit, - }, - "handle input slice at limit": { - src: []byte(strings.Repeat("a", maxSize)), - expResult: []byte(strings.Repeat("a", maxSize)), - }, "handle gzip identifier only": { src: gzipIdent, expError: io.ErrUnexpectedEOF, diff --git a/x/wasm/ioutils/utils.go b/x/wasm/ioutils/utils.go index d4b8abf34..197c44c36 100644 --- a/x/wasm/ioutils/utils.go +++ b/x/wasm/ioutils/utils.go @@ -17,7 +17,7 @@ var ( // IsGzip returns checks if the file contents are gzip compressed func IsGzip(input []byte) bool { - return bytes.Equal(input[:3], gzipIdent) + return len(input) >= 3 && bytes.Equal(gzipIdent, input[0:3]) } // IsWasm checks if the file contents are of wasm binary diff --git a/x/wasm/ioutils/utils_test.go b/x/wasm/ioutils/utils_test.go index 0d2c0a130..2dea0c5c0 100644 --- a/x/wasm/ioutils/utils_test.go +++ b/x/wasm/ioutils/utils_test.go @@ -1,14 +1,14 @@ package ioutils import ( - "io/ioutil" + "os" "testing" "github.com/stretchr/testify/require" ) func GetTestData() ([]byte, []byte, []byte, error) { - wasmCode, err := ioutil.ReadFile("../keeper/testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("../keeper/testdata/hackatom.wasm") if err != nil { return nil, nil, nil, err } @@ -41,6 +41,8 @@ func TestIsGzip(t *testing.T) { require.False(t, IsGzip(wasmCode)) require.False(t, IsGzip(someRandomStr)) + require.False(t, IsGzip(nil)) + require.True(t, IsGzip(gzipData[0:3])) require.True(t, IsGzip(gzipData)) } diff --git a/x/wasm/keeper/addresses.go b/x/wasm/keeper/addresses.go new file mode 100644 index 000000000..67eabb440 --- /dev/null +++ b/x/wasm/keeper/addresses.go @@ -0,0 +1,76 @@ +package keeper + +import ( + "encoding/binary" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +// AddressGenerator abstract address generator to be used for a single contract address +type AddressGenerator func(ctx sdk.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.KeyLastInstanceID) + return BuildContractAddressClassic(codeID, instanceID) + } +} + +// PredicableAddressGenerator generates a predictable contract address +func PredicableAddressGenerator(creator sdk.AccAddress, salt []byte, msg []byte, fixMsg bool) AddressGenerator { + return func(ctx sdk.Context, _ uint64, checksum []byte) sdk.AccAddress { + if !fixMsg { // clear msg to not be included in the address generation + msg = []byte{} + } + return BuildContractAddressPredictable(checksum, creator, salt, msg) + } +} + +// BuildContractAddressClassic builds an sdk account address for a contract. +func BuildContractAddressClassic(codeID, instanceID uint64) sdk.AccAddress { + contractID := make([]byte, 16) + binary.BigEndian.PutUint64(contractID[:8], codeID) + binary.BigEndian.PutUint64(contractID[8:], instanceID) + return address.Module(types.ModuleName, contractID)[:types.ContractAddrLen] +} + +// BuildContractAddressPredictable generates a contract address for the wasm module with len = types.ContractAddrLen using the +// Cosmos SDK address.Module function. +// Internally a key is built containing: +// (len(checksum) | checksum | len(sender_address) | sender_address | len(salt) | salt| len(initMsg) | initMsg). +// +// All method parameter values must be valid and not nil. +func BuildContractAddressPredictable(checksum []byte, creator sdk.AccAddress, salt, initMsg types.RawContractMessage) sdk.AccAddress { + if len(checksum) != 32 { + panic("invalid checksum") + } + if err := sdk.VerifyAddressFormat(creator); err != nil { + panic(fmt.Sprintf("creator: %s", err)) + } + if err := types.ValidateSalt(salt); err != nil { + panic(fmt.Sprintf("salt: %s", err)) + } + if err := initMsg.ValidateBasic(); len(initMsg) != 0 && err != nil { + panic(fmt.Sprintf("initMsg: %s", err)) + } + checksum = UInt64LengthPrefix(checksum) + creator = UInt64LengthPrefix(creator) + salt = UInt64LengthPrefix(salt) + initMsg = UInt64LengthPrefix(initMsg) + key := make([]byte, len(checksum)+len(creator)+len(salt)+len(initMsg)) + copy(key[0:], checksum) + copy(key[len(checksum):], creator) + copy(key[len(checksum)+len(creator):], salt) + copy(key[len(checksum)+len(creator)+len(salt):], initMsg) + return address.Module(types.ModuleName, key)[:types.ContractAddrLen] +} + +// UInt64LengthPrefix prepend big endian encoded byte length +func UInt64LengthPrefix(bz []byte) []byte { + return append(sdk.Uint64ToBigEndian(uint64(len(bz))), bz...) +} diff --git a/x/wasm/keeper/addresses_test.go b/x/wasm/keeper/addresses_test.go new file mode 100644 index 000000000..fbcc607fc --- /dev/null +++ b/x/wasm/keeper/addresses_test.go @@ -0,0 +1,432 @@ +package keeper + +import ( + "encoding/json" + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + tmbytes "github.com/tendermint/tendermint/libs/bytes" +) + +func TestBuildContractAddress(t *testing.T) { + x, y := sdk.GetConfig().GetBech32AccountAddrPrefix(), sdk.GetConfig().GetBech32AccountPubPrefix() + t.Cleanup(func() { + sdk.GetConfig().SetBech32PrefixForAccount(x, y) + }) + sdk.GetConfig().SetBech32PrefixForAccount("purple", "purple") + + // test vectors generated via cosmjs: https://github.com/cosmos/cosmjs/pull/1253/files + type Spec struct { + In struct { + Checksum tmbytes.HexBytes `json:"checksum"` + Creator sdk.AccAddress `json:"creator"` + Salt tmbytes.HexBytes `json:"salt"` + Msg string `json:"msg"` + } `json:"in"` + Out struct { + Address sdk.AccAddress `json:"address"` + } `json:"out"` + } + var specs []Spec + require.NoError(t, json.Unmarshal([]byte(goldenMasterPredictableContractAddr), &specs)) + require.NotEmpty(t, specs) + for i, spec := range specs { + t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) { + // when + gotAddr := BuildContractAddressPredictable(spec.In.Checksum, spec.In.Creator, spec.In.Salt.Bytes(), []byte(spec.In.Msg)) + + require.Equal(t, spec.Out.Address.String(), gotAddr.String()) + require.NoError(t, sdk.VerifyAddressFormat(gotAddr)) + }) + } +} + +const goldenMasterPredictableContractAddr = `[ + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": null + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000001610000000000000000", + "addressData": "5e865d3e45ad3e961f77fd77d46543417ced44d924dc3e079b5415ff6775f847" + }, + "out": { + "address": "purple1t6r960j945lfv8mhl4mage2rg97w63xeynwrupum2s2l7em4lprs9ce5hk" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc00000000000000016100000000000000027b7d", + "addressData": "0995499608947a5281e2c7ebd71bdb26a1ad981946dad57f6c4d3ee35de77835" + }, + "out": { + "address": "purple1px25n9sgj3a99q0zcl4awx7my6s6mxqegmdd2lmvf5lwxh080q6suttktr" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc000000000000000161000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "83326e554723b15bac664ceabc8a5887e27003abe9fbd992af8c7bcea4745167" + }, + "out": { + "address": "purple1svexu428ywc4htrxfn4tezjcsl38qqata8aany4033auafr529ns4v254c" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": null + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae0000000000000000", + "addressData": "9384c6248c0bb171e306fd7da0993ec1e20eba006452a3a9e078883eb3594564" + }, + "out": { + "address": "purple1jwzvvfyvpwchrccxl476pxf7c83qawsqv3f2820q0zyrav6eg4jqdcq7gc" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae00000000000000027b7d", + "addressData": "9a8d5f98fb186825401a26206158e7a1213311a9b6a87944469913655af52ffb" + }, + "out": { + "address": "purple1n2x4lx8mrp5z2sq6ycsxzk885ysnxydfk658j3zxnyfk2kh49lasesxf6j" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "932f07bc53f7d0b0b43cb5a54ac3e245b205e6ae6f7c1d991dc6af4a2ff9ac18" + }, + "out": { + "address": "purple1jvhs00zn7lgtpdpukkj54slzgkeqte4wda7pmxgac6h55tle4svq8cmp60" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": null + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000001610000000000000000", + "addressData": "9725e94f528d8b78d33c25f3dfcd60e6142d8be60ab36f6a5b59036fd51560db" + }, + "out": { + "address": "purple1juj7jn6j3k9h35euyhealntquc2zmzlxp2ek76jmtypkl4g4vrdsfwmwxk" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff00000000000000016100000000000000027b7d", + "addressData": "b056e539bbaf447ba18f3f13b792970111fc78933eb6700f4d227b5216d63658" + }, + "out": { + "address": "purple1kptw2wdm4az8hgv08ufm0y5hqyglc7yn86m8qr6dyfa4y9kkxevqmkm9q3" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff000000000000000161000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "6c98434180f052294ff89fb6d2dae34f9f4468b0b8e6e7c002b2a44adee39abd" + }, + "out": { + "address": "purple1djvyxsvq7pfzjnlcn7md9khrf705g69shrnw0sqzk2jy4hhrn27sjh2ysy" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": null + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae0000000000000000", + "addressData": "0aaf1c31c5d529d21d898775bc35b3416f47bfd99188c334c6c716102cbd3101" + }, + "out": { + "address": "purple1p2h3cvw9655ay8vfsa6mcddng9h5007ejxyvxdxxcutpqt9axyqsagmmay" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae00000000000000027b7d", + "addressData": "36fe6ab732187cdfed46290b448b32eb7f4798e7a4968b0537de8a842cbf030e" + }, + "out": { + "address": "purple1xmlx4dejrp7dlm2x9y95fzejadl50x885jtgkpfhm69ggt9lqv8qk3vn4f" + } + }, + { + "in": { + "checksum": "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d00000000000000002013a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a500000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "a0d0c942adac6f3e5e7c23116c4c42a24e96e0ab75f53690ec2d3de16067c751" + }, + "out": { + "address": "purple15rgvjs4d43hnuhnuyvgkcnzz5f8fdc9twh6ndy8v9577zcr8cags40l9dt" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": null + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000001610000000000000000", + "addressData": "b95c467218d408a0f93046f227b6ece7fe18133ff30113db4d2a7becdfeca141" + }, + "out": { + "address": "purple1h9wyvusc6sy2p7fsgmez0dhvullpsyel7vq38k6d9fa7ehlv59qsvnyh36" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc00000000000000016100000000000000027b7d", + "addressData": "23fe45dbbd45dc6cd25244a74b6e99e7a65bf0bac2f2842a05049d37555a3ae6" + }, + "out": { + "address": "purple1y0lytkaaghwxe5jjgjn5km5eu7n9hu96ctegg2s9qjwnw4268tnqxhg60a" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "61", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc000000000000000161000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "6faea261ed63baa65b05726269e83b217fa6205dc7d9fb74f9667d004a69c082" + }, + "out": { + "address": "purple1d7h2yc0dvwa2vkc9wf3xn6pmy9l6vgzaclvlka8eve7sqjnfczpqqsdnwu" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": null + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae0000000000000000", + "addressData": "67a3ab6384729925fdb144574628ce96836fe098d2c6be4e84ac106b2728d96c" + }, + "out": { + "address": "purple1v736kcuyw2vjtld3g3t5v2xwj6pklcyc6trtun5y4sgxkfegm9kq7vgpnt" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae00000000000000027b7d", + "addressData": "23a121263bfce05c144f4af86f3d8a9f87dc56f9dc48dbcffc8c5a614da4c661" + }, + "out": { + "address": "purple1ywsjzf3mlns9c9z0ftux70v2n7rac4hem3ydhnlu33dxzndycesssc7x2m" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvhxf2py", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbcccccccccc", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000149999999999aaaaaaaaaabbbbbbbbbbcccccccccc0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "dd90dba6d6fcd5fb9c9c8f536314eb1bb29cb5aa084b633c5806b926a5636b58" + }, + "out": { + "address": "purple1mkgdhfkkln2lh8yu3afkx98trwefedd2pp9kx0zcq6ujdftrddvq50esay" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": null + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000001610000000000000000", + "addressData": "547a743022f4f1af05b102f57bf1c1c7d7ee81bae427dc20d36b2c4ec57612ae" + }, + "out": { + "address": "purple123a8gvpz7nc67pd3qt6hhuwpclt7aqd6usnacgxndvkya3tkz2hq5hz38f" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff00000000000000016100000000000000027b7d", + "addressData": "416e169110e4b411bc53162d7503b2bbf14d6b36b1413a4f4c9af622696e9665" + }, + "out": { + "address": "purple1g9hpdygsuj6pr0znzckh2qajh0c566ekk9qn5n6vntmzy6twjejsrl9alk" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "61", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff000000000000000161000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "619a0988b92d8796cea91dea63cbb1f1aefa4a6b6ee5c5d1e937007252697220" + }, + "out": { + "address": "purple1vxdqnz9e9kredn4frh4x8ja37xh05jntdmjut50fxuq8y5nfwgsquu9mxh" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": null + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae0000000000000000", + "addressData": "d8af856a6a04852d19b647ad6d4336eb26e077f740aef1a0331db34d299a885a" + }, + "out": { + "address": "purple1mzhc26n2qjzj6xdkg7kk6sekavnwqalhgzh0rgpnrke562v63pdq8grp8q" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae00000000000000027b7d", + "addressData": "c7fb7bea96daab23e416c4fcf328215303005e1d0d5424257335568e5381e33c" + }, + "out": { + "address": "purple1clahh65km24j8eqkcn70x2pp2vpsqhsap42zgftnx4tgu5upuv7q9ywjws" + } + }, + { + "in": { + "checksum": "1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b", + "creator": "purple1nxvenxve42424242hwamhwamenxvenxvmhwamhwaamhwamhwlllsatsy6m", + "creatorData": "9999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff", + "salt": "aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae", + "msg": "{\"some\":123,\"structure\":{\"nested\":[\"ok\",true]}}" + }, + "intermediate": { + "key": "7761736d0000000000000000201da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b00000000000000209999999999aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffff0000000000000040aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbccddeeffffeeddbbccddaa66551155aaaabbcc787878789900aabbbbcc221100acadae000000000000002f7b22736f6d65223a3132332c22737472756374757265223a7b226e6573746564223a5b226f6b222c747275655d7d7d", + "addressData": "ccdf9dea141a6c2475870529ab38fae9dec30df28e005894fe6578b66133ab4a" + }, + "out": { + "address": "purple1en0em6s5rfkzgav8q556kw86a80vxr0j3cq93987v4utvcfn4d9q0tql4w" + } + } +] +` diff --git a/x/wasm/keeper/ante.go b/x/wasm/keeper/ante.go index 1ffd34bef..08dfdf64b 100644 --- a/x/wasm/keeper/ante.go +++ b/x/wasm/keeper/ante.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/binary" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -10,11 +11,11 @@ import ( // CountTXDecorator ante handler to count the tx position in a block. type CountTXDecorator struct { - storeKey sdk.StoreKey + storeKey storetypes.StoreKey } // NewCountTXDecorator constructor -func NewCountTXDecorator(storeKey sdk.StoreKey) *CountTXDecorator { +func NewCountTXDecorator(storeKey storetypes.StoreKey) *CountTXDecorator { return &CountTXDecorator{storeKey: storeKey} } diff --git a/x/wasm/keeper/ante_test.go b/x/wasm/keeper/ante_test.go index fa64b62fe..e96332c9f 100644 --- a/x/wasm/keeper/ante_test.go +++ b/x/wasm/keeper/ante_test.go @@ -9,6 +9,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -23,7 +24,7 @@ func TestCountTxDecorator(t *testing.T) { keyWasm := sdk.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(keyWasm, sdk.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db) require.NoError(t, ms.LoadLatestVersion()) const myCurrentBlockHeight = 100 diff --git a/x/wasm/keeper/authz_policy.go b/x/wasm/keeper/authz_policy.go index 32d8c9952..1a222719a 100644 --- a/x/wasm/keeper/authz_policy.go +++ b/x/wasm/keeper/authz_policy.go @@ -10,6 +10,7 @@ type AuthorizationPolicy interface { CanCreateCode(c types.AccessConfig, creator sdk.AccAddress) bool CanInstantiateContract(c types.AccessConfig, actor sdk.AccAddress) bool CanModifyContract(admin, actor sdk.AccAddress) bool + CanModifyCodeAccessConfig(creator, actor sdk.AccAddress, isSubset bool) bool } type DefaultAuthorizationPolicy struct{} @@ -26,6 +27,10 @@ func (p DefaultAuthorizationPolicy) CanModifyContract(admin, actor sdk.AccAddres return admin != nil && admin.Equals(actor) } +func (p DefaultAuthorizationPolicy) CanModifyCodeAccessConfig(creator, actor sdk.AccAddress, isSubset bool) bool { + return creator != nil && creator.Equals(actor) && isSubset +} + type GovAuthorizationPolicy struct{} func (p GovAuthorizationPolicy) CanCreateCode(types.AccessConfig, sdk.AccAddress) bool { @@ -39,3 +44,7 @@ func (p GovAuthorizationPolicy) CanInstantiateContract(types.AccessConfig, sdk.A func (p GovAuthorizationPolicy) CanModifyContract(sdk.AccAddress, sdk.AccAddress) bool { return true } + +func (p GovAuthorizationPolicy) CanModifyCodeAccessConfig(sdk.AccAddress, sdk.AccAddress, bool) bool { + return true +} diff --git a/x/wasm/keeper/authz_policy_test.go b/x/wasm/keeper/authz_policy_test.go new file mode 100644 index 000000000..acc9cb346 --- /dev/null +++ b/x/wasm/keeper/authz_policy_test.go @@ -0,0 +1,311 @@ +package keeper + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +func TestDefaultAuthzPolicyCanCreateCode(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + specs := map[string]struct { + config types.AccessConfig + actor sdk.AccAddress + exp bool + panics bool + }{ + "nobody": { + config: types.AllowNobody, + exp: false, + }, + "everybody": { + config: types.AllowEverybody, + exp: true, + }, + "only address - same": { + config: types.AccessTypeOnlyAddress.With(myActorAddress), + exp: true, + }, + "only address - different": { + config: types.AccessTypeOnlyAddress.With(otherAddress), + exp: false, + }, + "any address - included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress, myActorAddress), + exp: true, + }, + "any address - not included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress), + exp: false, + }, + "undefined config - panics": { + config: types.AccessConfig{}, + panics: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := DefaultAuthorizationPolicy{} + if !spec.panics { + got := policy.CanCreateCode(spec.config, myActorAddress) + assert.Equal(t, spec.exp, got) + return + } + assert.Panics(t, func() { + policy.CanCreateCode(spec.config, myActorAddress) + }) + }) + } +} + +func TestDefaultAuthzPolicyCanInstantiateContract(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + specs := map[string]struct { + config types.AccessConfig + actor sdk.AccAddress + exp bool + panics bool + }{ + "nobody": { + config: types.AllowNobody, + exp: false, + }, + "everybody": { + config: types.AllowEverybody, + exp: true, + }, + "only address - same": { + config: types.AccessTypeOnlyAddress.With(myActorAddress), + exp: true, + }, + "only address - different": { + config: types.AccessTypeOnlyAddress.With(otherAddress), + exp: false, + }, + "any address - included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress, myActorAddress), + exp: true, + }, + "any address - not included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress), + exp: false, + }, + "undefined config - panics": { + config: types.AccessConfig{}, + panics: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := DefaultAuthorizationPolicy{} + if !spec.panics { + got := policy.CanInstantiateContract(spec.config, myActorAddress) + assert.Equal(t, spec.exp, got) + return + } + assert.Panics(t, func() { + policy.CanInstantiateContract(spec.config, myActorAddress) + }) + }) + } +} + +func TestDefaultAuthzPolicyCanModifyContract(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + + specs := map[string]struct { + admin sdk.AccAddress + exp bool + }{ + "same as actor": { + admin: myActorAddress, + exp: true, + }, + "different admin": { + admin: otherAddress, + exp: false, + }, + "no admin": { + exp: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := DefaultAuthorizationPolicy{} + got := policy.CanModifyContract(spec.admin, myActorAddress) + assert.Equal(t, spec.exp, got) + }) + } +} + +func TestDefaultAuthzPolicyCanModifyCodeAccessConfig(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + + specs := map[string]struct { + admin sdk.AccAddress + subset bool + exp bool + }{ + "same as actor - subset": { + admin: myActorAddress, + subset: true, + exp: true, + }, + "same as actor - not subset": { + admin: myActorAddress, + subset: false, + exp: false, + }, + "different admin": { + admin: otherAddress, + exp: false, + }, + "no admin": { + exp: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := DefaultAuthorizationPolicy{} + got := policy.CanModifyCodeAccessConfig(spec.admin, myActorAddress, spec.subset) + assert.Equal(t, spec.exp, got) + }) + } +} + +func TestGovAuthzPolicyCanCreateCode(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + specs := map[string]struct { + config types.AccessConfig + actor sdk.AccAddress + }{ + "nobody": { + config: types.AllowNobody, + }, + "everybody": { + config: types.AllowEverybody, + }, + "only address - same": { + config: types.AccessTypeOnlyAddress.With(myActorAddress), + }, + "only address - different": { + config: types.AccessTypeOnlyAddress.With(otherAddress), + }, + "any address - included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress, myActorAddress), + }, + "any address - not included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress), + }, + "undefined config - panics": { + config: types.AccessConfig{}, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := GovAuthorizationPolicy{} + got := policy.CanCreateCode(spec.config, myActorAddress) + assert.True(t, got) + }) + } +} + +func TestGovAuthzPolicyCanInstantiateContract(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + specs := map[string]struct { + config types.AccessConfig + actor sdk.AccAddress + }{ + "nobody": { + config: types.AllowNobody, + }, + "everybody": { + config: types.AllowEverybody, + }, + "only address - same": { + config: types.AccessTypeOnlyAddress.With(myActorAddress), + }, + "only address - different": { + config: types.AccessTypeOnlyAddress.With(otherAddress), + }, + "any address - included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress, myActorAddress), + }, + "any address - not included": { + config: types.AccessTypeAnyOfAddresses.With(otherAddress), + }, + "undefined config - panics": { + config: types.AccessConfig{}, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := GovAuthorizationPolicy{} + got := policy.CanInstantiateContract(spec.config, myActorAddress) + assert.True(t, got) + }) + } +} + +func TestGovAuthzPolicyCanModifyContract(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + + specs := map[string]struct { + admin sdk.AccAddress + }{ + "same as actor": { + admin: myActorAddress, + }, + "different admin": { + admin: otherAddress, + }, + "no admin": {}, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := GovAuthorizationPolicy{} + got := policy.CanModifyContract(spec.admin, myActorAddress) + assert.True(t, got) + }) + } +} + +func TestGovAuthzPolicyCanModifyCodeAccessConfig(t *testing.T) { + myActorAddress := RandomAccountAddress(t) + otherAddress := RandomAccountAddress(t) + + specs := map[string]struct { + admin sdk.AccAddress + subset bool + }{ + "same as actor - subset": { + admin: myActorAddress, + subset: true, + }, + "same as actor - not subset": { + admin: myActorAddress, + subset: false, + }, + "different admin": { + admin: otherAddress, + }, + "no admin": {}, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + policy := GovAuthorizationPolicy{} + got := policy.CanModifyCodeAccessConfig(spec.admin, myActorAddress, spec.subset) + assert.True(t, got) + }) + } +} diff --git a/x/wasm/keeper/bench_test.go b/x/wasm/keeper/bench_test.go index ca5489d5b..f32b39a0c 100644 --- a/x/wasm/keeper/bench_test.go +++ b/x/wasm/keeper/bench_test.go @@ -1,7 +1,7 @@ package keeper import ( - "io/ioutil" + "os" "testing" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -51,7 +51,7 @@ func BenchmarkInstantiationOverhead(b *testing.B) { for name, spec := range specs { b.Run(name, func(b *testing.B) { wasmConfig := types.WasmConfig{MemoryCacheSize: 0} - ctx, keepers := createTestInput(b, false, SupportedFeatures, wasmConfig, spec.db()) + ctx, keepers := createTestInput(b, false, AvailableCapabilities, wasmConfig, spec.db()) example := InstantiateHackatomExampleContract(b, ctx, keepers) if spec.pinned { require.NoError(b, keepers.ContractKeeper.PinCode(ctx, example.CodeID)) @@ -86,10 +86,10 @@ func BenchmarkCompilation(b *testing.B) { b.Run(name, func(b *testing.B) { wasmConfig := types.WasmConfig{MemoryCacheSize: 0} db := dbm.NewMemDB() - ctx, keepers := createTestInput(b, false, SupportedFeatures, wasmConfig, db) + ctx, keepers := createTestInput(b, false, AvailableCapabilities, wasmConfig, db) // print out code size for comparisons - code, err := ioutil.ReadFile(spec.wasmFile) + code, err := os.ReadFile(spec.wasmFile) require.NoError(b, err) b.Logf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b(size: %d) ", len(code)) diff --git a/x/wasm/keeper/contract_keeper.go b/x/wasm/keeper/contract_keeper.go index 9dc0a4be9..564adc553 100644 --- a/x/wasm/keeper/contract_keeper.go +++ b/x/wasm/keeper/contract_keeper.go @@ -10,8 +10,19 @@ 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 AuthorizationPolicy) (codeID uint64, err error) - instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, authZ AuthorizationPolicy) (sdk.AccAddress, []byte, error) + create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, checksum []byte, err error) + + instantiate( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + addressGenerator AddressGenerator, + authZ AuthorizationPolicy, + ) (sdk.AccAddress, []byte, error) + migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ AuthorizationPolicy) ([]byte, error) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ AuthorizationPolicy) error pinCode(ctx sdk.Context, codeID uint64) error @@ -19,7 +30,8 @@ type decoratedKeeper interface { execute(ctx sdk.Context, contractAddress sdk.AccAddress, 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, config types.AccessConfig) error + setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, autz AuthorizationPolicy) error + ClassicAddressGenerator() AddressGenerator } type PermissionedKeeper struct { @@ -39,12 +51,44 @@ func NewDefaultPermissionKeeper(nested decoratedKeeper) *PermissionedKeeper { return NewPermissionedKeeper(nested, DefaultAuthorizationPolicy{}) } -func (p PermissionedKeeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig) (codeID uint64, err error) { +func (p PermissionedKeeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig) (codeID uint64, checksum []byte, err error) { return p.nested.create(ctx, creator, wasmCode, instantiateAccess, p.authZPolicy) } -func (p PermissionedKeeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error) { - return p.nested.instantiate(ctx, codeID, creator, admin, initMsg, label, deposit, p.authZPolicy) +// Instantiate creates an instance of a WASM contract using the classic sequence based address generator +func (p PermissionedKeeper) Instantiate( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, +) (sdk.AccAddress, []byte, error) { + return p.nested.instantiate(ctx, codeID, creator, admin, initMsg, label, deposit, p.nested.ClassicAddressGenerator(), p.authZPolicy) +} + +// Instantiate2 creates an instance of a WASM contract using the predictable address generator +func (p PermissionedKeeper) Instantiate2( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + salt []byte, + fixMsg bool, +) (sdk.AccAddress, []byte, error) { + return p.nested.instantiate( + ctx, + codeID, + creator, + admin, + initMsg, + label, + deposit, + PredicableAddressGenerator(creator, salt, initMsg, fixMsg), + p.authZPolicy, + ) } func (p PermissionedKeeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) { @@ -75,12 +119,12 @@ func (p PermissionedKeeper) UnpinCode(ctx sdk.Context, codeID uint64) error { return p.nested.unpinCode(ctx, codeID) } -// SetExtraContractAttributes updates the extra attributes that can be stored with the contract info +// SetContractInfoExtension updates the extra attributes that can be stored with the contract info func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error { return p.nested.setContractInfoExtension(ctx, contract, extra) } // SetAccessConfig updates the access config of a code id. -func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error { - return p.nested.setAccessConfig(ctx, codeID, config) +func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig) error { + return p.nested.setAccessConfig(ctx, codeID, caller, newConfig, p.authZPolicy) } diff --git a/x/wasm/keeper/contract_keeper_test.go b/x/wasm/keeper/contract_keeper_test.go new file mode 100644 index 000000000..0a8bd1e22 --- /dev/null +++ b/x/wasm/keeper/contract_keeper_test.go @@ -0,0 +1,168 @@ +package keeper + +import ( + "encoding/json" + "fmt" + "math" + "strings" + "testing" + + "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +func TestInstantiate2(t *testing.T) { + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) + example := StoreHackatomExampleContract(t, parentCtx, keepers) + otherExample := StoreReflectContract(t, parentCtx, keepers) + mock := &wasmtesting.MockWasmer{} + wasmtesting.MakeInstantiable(mock) + keepers.WasmKeeper.wasmVM = mock // set mock to not fail on contract init message + + verifierAddr := RandomAccountAddress(t) + beneficiaryAddr := RandomAccountAddress(t) + initMsg := mustMarshal(t, HackatomExampleInitMsg{Verifier: verifierAddr, Beneficiary: beneficiaryAddr}) + + otherAddr := keepers.Faucet.NewFundedRandomAccount(parentCtx, sdk.NewInt64Coin("denom", 1_000_000_000)) + + const ( + mySalt = "my salt" + myLabel = "my label" + ) + // create instances for duplicate checks + exampleContract := func(t *testing.T, ctx sdk.Context, fixMsg bool) { + _, _, err := keepers.ContractKeeper.Instantiate2( + ctx, + example.CodeID, + example.CreatorAddr, + nil, + initMsg, + myLabel, + sdk.NewCoins(sdk.NewInt64Coin("denom", 1)), + []byte(mySalt), + fixMsg, + ) + require.NoError(t, err) + } + exampleWithFixMsg := func(t *testing.T, ctx sdk.Context) { + exampleContract(t, ctx, true) + } + exampleWithoutFixMsg := func(t *testing.T, ctx sdk.Context) { + exampleContract(t, ctx, false) + } + specs := map[string]struct { + setup func(t *testing.T, ctx sdk.Context) + codeID uint64 + sender sdk.AccAddress + salt []byte + initMsg json.RawMessage + fixMsg bool + expErr error + }{ + "fix msg - generates different address than without fixMsg": { + setup: exampleWithoutFixMsg, + codeID: example.CodeID, + sender: example.CreatorAddr, + salt: []byte(mySalt), + initMsg: initMsg, + fixMsg: true, + }, + "fix msg - different sender": { + setup: exampleWithFixMsg, + codeID: example.CodeID, + sender: otherAddr, + salt: []byte(mySalt), + initMsg: initMsg, + fixMsg: true, + }, + "fix msg - different code": { + setup: exampleWithFixMsg, + codeID: otherExample.CodeID, + sender: example.CreatorAddr, + salt: []byte(mySalt), + initMsg: []byte(`{}`), + fixMsg: true, + }, + "fix msg - different salt": { + setup: exampleWithFixMsg, + codeID: example.CodeID, + sender: example.CreatorAddr, + salt: []byte("other salt"), + initMsg: initMsg, + fixMsg: true, + }, + "fix msg - different init msg": { + setup: exampleWithFixMsg, + codeID: example.CodeID, + sender: example.CreatorAddr, + salt: []byte(mySalt), + initMsg: mustMarshal(t, HackatomExampleInitMsg{Verifier: otherAddr, Beneficiary: beneficiaryAddr}), + fixMsg: true, + }, + "different sender": { + setup: exampleWithoutFixMsg, + codeID: example.CodeID, + sender: otherAddr, + salt: []byte(mySalt), + initMsg: initMsg, + }, + "different code": { + setup: exampleWithoutFixMsg, + codeID: otherExample.CodeID, + sender: example.CreatorAddr, + salt: []byte(mySalt), + initMsg: []byte(`{}`), + }, + "different salt": { + setup: exampleWithoutFixMsg, + codeID: example.CodeID, + sender: example.CreatorAddr, + salt: []byte(`other salt`), + initMsg: initMsg, + }, + "different init msg - reject same address": { + setup: exampleWithoutFixMsg, + codeID: example.CodeID, + sender: example.CreatorAddr, + salt: []byte(mySalt), + initMsg: mustMarshal(t, HackatomExampleInitMsg{Verifier: otherAddr, Beneficiary: beneficiaryAddr}), + expErr: types.ErrDuplicate, + }, + "fix msg - long msg": { + setup: exampleWithFixMsg, + codeID: example.CodeID, + sender: otherAddr, + salt: []byte(mySalt), + initMsg: []byte(fmt.Sprintf(`{"foo":%q}`, strings.Repeat("b", math.MaxInt16+1))), // too long kills CI + fixMsg: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() + spec.setup(t, ctx) + gotAddr, _, gotErr := keepers.ContractKeeper.Instantiate2( + ctx, + spec.codeID, + spec.sender, + nil, + spec.initMsg, + myLabel, + sdk.NewCoins(sdk.NewInt64Coin("denom", 2)), + spec.salt, + spec.fixMsg, + ) + if spec.expErr != nil { + assert.ErrorIs(t, gotErr, spec.expErr) + return + } + require.NoError(t, gotErr) + assert.NotEmpty(t, gotAddr) + }) + } +} diff --git a/x/wasm/keeper/gas_register.go b/x/wasm/keeper/gas_register.go index c21606344..51f8e607c 100644 --- a/x/wasm/keeper/gas_register.go +++ b/x/wasm/keeper/gas_register.go @@ -54,12 +54,26 @@ const ( DefaultEventAttributeDataFreeTier = 100 ) +// default: 0.15 gas. +// see https://github.com/CosmWasm/wasmd/pull/898#discussion_r937727200 +var defaultPerByteUncompressCost = wasmvmtypes.UFraction{ + Numerator: 15, + Denominator: 100, +} + +// DefaultPerByteUncompressCost is how much SDK gas we charge per source byte to unpack +func DefaultPerByteUncompressCost() wasmvmtypes.UFraction { + return defaultPerByteUncompressCost +} + // GasRegister abstract source for gas costs type GasRegister interface { // NewContractInstanceCosts costs to crate 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 // ReplyCosts costs to to handle a message reply @@ -78,6 +92,8 @@ type WasmGasRegisterConfig struct { InstanceCost sdk.Gas // CompileCosts costs to persist and "compile" a new wasm contract CompileCost sdk.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 @@ -107,6 +123,7 @@ func DefaultGasRegisterConfig() WasmGasRegisterConfig { EventAttributeDataCost: DefaultEventAttributeDataCost, EventAttributeDataFreeTier: DefaultEventAttributeDataFreeTier, ContractMessageDataCost: DefaultContractMessageDataCost, + UncompressCost: DefaultPerByteUncompressCost(), } } @@ -143,6 +160,14 @@ func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas { return g.c.CompileCost * uint64(byteLength) } +// UncompressCosts costs to unpack a new wasm contract +func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas { + if byteLength < 0 { + panic(sdkerrors.Wrap(types.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 { if msgLen < 0 { diff --git a/x/wasm/keeper/gas_register_test.go b/x/wasm/keeper/gas_register_test.go index bc3e761a2..03f6cdd86 100644 --- a/x/wasm/keeper/gas_register_test.go +++ b/x/wasm/keeper/gas_register_test.go @@ -5,6 +5,8 @@ import ( "strings" "testing" + "github.com/CosmWasm/wasmd/x/wasm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -430,3 +432,41 @@ func TestFromWasmVMGasConversion(t *testing.T) { }) } } + +func TestUncompressCosts(t *testing.T) { + specs := map[string]struct { + lenIn int + exp sdk.Gas + expPanic bool + }{ + "0": { + exp: 0, + }, + "even": { + lenIn: 100, + exp: 15, + }, + "round down when uneven": { + lenIn: 19, + exp: 2, + }, + "max len": { + lenIn: types.MaxWasmSize, + exp: 122880, + }, + "invalid len": { + lenIn: -1, + expPanic: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + if spec.expPanic { + assert.Panics(t, func() { NewDefaultWasmGasRegister().UncompressCosts(spec.lenIn) }) + return + } + got := NewDefaultWasmGasRegister().UncompressCosts(spec.lenIn) + assert.Equal(t, spec.exp, got) + }) + } +} diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index ff7c6db53..3cff3bf79 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -6,7 +6,6 @@ import ( "encoding/base64" "errors" "fmt" - "io/ioutil" "math/rand" "os" "testing" @@ -14,10 +13,12 @@ import ( "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" 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" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -40,7 +41,7 @@ func TestGenesisExportImport(t *testing.T) { wasmKeeper, srcCtx, srcStoreKeys := setupKeeper(t) contractKeeper := NewGovPermissionKeeper(wasmKeeper) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) // store some test data @@ -66,22 +67,22 @@ func TestGenesisExportImport(t *testing.T) { creatorAddr, err := sdk.AccAddressFromBech32(codeInfo.Creator) require.NoError(t, err) - codeID, err := contractKeeper.Create(srcCtx, creatorAddr, wasmCode, &codeInfo.InstantiateConfig) + codeID, _, err := contractKeeper.Create(srcCtx, creatorAddr, wasmCode, &codeInfo.InstantiateConfig) require.NoError(t, err) if pinned { contractKeeper.PinCode(srcCtx, codeID) } if contractExtension { anyTime := time.Now().UTC() - var nestedType govtypes.TextProposal + var nestedType govtypesv1beta1.TextProposal f.NilChance(0).Fuzz(&nestedType) - myExtension, err := govtypes.NewProposal(&nestedType, 1, anyTime, anyTime) + myExtension, err := govtypesv1beta1.NewProposal(&nestedType, 1, anyTime, anyTime) require.NoError(t, err) contract.SetExtension(&myExtension) } contract.CodeID = codeID - contractAddr := wasmKeeper.generateContractAddress(srcCtx, codeID) + contractAddr := wasmKeeper.ClassicAddressGenerator()(srcCtx, codeID, nil) wasmKeeper.storeContractInfo(srcCtx, contractAddr, &contract) wasmKeeper.appendToContractHistory(srcCtx, contractAddr, history...) wasmKeeper.importContractState(srcCtx, contractAddr, stateModels) @@ -153,7 +154,7 @@ func TestGenesisExportImport(t *testing.T) { } func TestGenesisInit(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) myCodeInfo := wasmTypes.CodeInfoFixture(wasmTypes.WithSHA256CodeHash(wasmCode)) @@ -268,7 +269,7 @@ func TestGenesisInit(t *testing.T) { }}, Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, }, @@ -289,10 +290,10 @@ func TestGenesisInit(t *testing.T) { }}, Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, { - ContractAddress: BuildContractAddress(1, 2).String(), + ContractAddress: BuildContractAddressClassic(1, 2).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, }, @@ -308,7 +309,7 @@ func TestGenesisInit(t *testing.T) { src: types.GenesisState{ Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, }, @@ -324,10 +325,10 @@ func TestGenesisInit(t *testing.T) { }}, Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, }, @@ -343,7 +344,7 @@ func TestGenesisInit(t *testing.T) { }}, Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), ContractState: []types.Model{ { @@ -391,7 +392,7 @@ func TestGenesisInit(t *testing.T) { }}, Contracts: []types.Contract{ { - ContractAddress: BuildContractAddress(1, 1).String(), + ContractAddress: BuildContractAddressClassic(1, 1).String(), ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.OnlyGenesisFields), }, }, @@ -498,7 +499,7 @@ func TestImportContractWithCodeHistoryReset(t *testing.T) { keeper, ctx, _ := setupKeeper(t) contractKeeper := NewGovPermissionKeeper(keeper) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) wasmCodeHash := sha256.Sum256(wasmCode) @@ -564,7 +565,7 @@ func TestImportContractWithCodeHistoryReset(t *testing.T) { } func TestSupportedGenMsgTypes(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) var ( myAddress sdk.AccAddress = bytes.Repeat([]byte{1}, types.ContractAddrLen) @@ -601,7 +602,7 @@ func TestSupportedGenMsgTypes(t *testing.T) { Sum: &types.GenesisState_GenMsgs_ExecuteContract{ ExecuteContract: &types.MsgExecuteContract{ Sender: verifierAddress.String(), - Contract: BuildContractAddress(1, 1).String(), + Contract: BuildContractAddressClassic(1, 1).String(), Msg: []byte(`{"release":{}}`), }, }, @@ -626,7 +627,7 @@ func TestSupportedGenMsgTypes(t *testing.T) { require.NotNil(t, codeInfo) // verify contract instantiated - cInfo := keeper.GetContractInfo(ctx, BuildContractAddress(1, 1)) + cInfo := keeper.GetContractInfo(ctx, BuildContractAddressClassic(1, 1)) require.NotNil(t, cInfo) // verify contract executed @@ -634,9 +635,9 @@ func TestSupportedGenMsgTypes(t *testing.T) { assert.Equal(t, sdk.NewCoin(denom, sdk.NewInt(10)), gotBalance) } -func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) { +func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []storetypes.StoreKey) { t.Helper() - tempDir, err := ioutil.TempDir("", "wasm") + tempDir, err := os.MkdirTemp("", "wasm") require.NoError(t, err) t.Cleanup(func() { os.RemoveAll(tempDir) }) var ( @@ -647,9 +648,9 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) { db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(keyWasm, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db) - ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db) + ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyParams, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(tkeyParams, storetypes.StoreTypeTransient, db) require.NoError(t, ms.LoadLatestVersion()) ctx := sdk.NewContext(ms, tmproto.Header{ @@ -661,16 +662,16 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) { // register an example extension. must be protobuf encodingConfig.InterfaceRegistry.RegisterImplementations( (*types.ContractInfoExtension)(nil), - &govtypes.Proposal{}, + &govtypesv1beta1.Proposal{}, ) // also registering gov interfaces for nested Any type - govtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + govtypesv1beta1.RegisterInterfaces(encodingConfig.InterfaceRegistry) wasmConfig := wasmTypes.DefaultWasmConfig() pk := paramskeeper.NewKeeper(encodingConfig.Marshaler, encodingConfig.Amino, keyParams, tkeyParams) - srcKeeper := NewKeeper(encodingConfig.Marshaler, keyWasm, pk.Subspace(wasmTypes.ModuleName), authkeeper.AccountKeeper{}, nil, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, tempDir, wasmConfig, SupportedFeatures) - return &srcKeeper, ctx, []sdk.StoreKey{keyWasm, keyParams} + srcKeeper := NewKeeper(encodingConfig.Marshaler, keyWasm, pk.Subspace(wasmTypes.ModuleName), authkeeper.AccountKeeper{}, bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, tempDir, wasmConfig, AvailableCapabilities) + return &srcKeeper, ctx, []storetypes.StoreKey{keyWasm, keyParams} } type StakingKeeperMock struct { diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index c138e5ed0..c91247697 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -9,8 +9,8 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go index 90734c1dc..628c1d2c7 100644 --- a/x/wasm/keeper/handler_plugin_encoders.go +++ b/x/wasm/keeper/handler_plugin_encoders.go @@ -10,11 +10,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "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" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -294,18 +294,18 @@ func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context } func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, error) { - var option govtypes.VoteOption + var option govv1.VoteOption switch msg.Vote.Vote { case wasmvmtypes.Yes: - option = govtypes.OptionYes + option = govv1.OptionYes case wasmvmtypes.No: - option = govtypes.OptionNo + option = govv1.OptionNo case wasmvmtypes.NoWithVeto: - option = govtypes.OptionNoWithVeto + option = govv1.OptionNoWithVeto case wasmvmtypes.Abstain: - option = govtypes.OptionAbstain + option = govv1.OptionAbstain } - vote := &govtypes.MsgVote{ + vote := &govv1.MsgVote{ ProposalId: msg.Vote.ProposalId, Voter: sender.String(), Option: option, diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go index e1c49c591..cc5ee26e7 100644 --- a/x/wasm/keeper/handler_plugin_encoders_test.go +++ b/x/wasm/keeper/handler_plugin_encoders_test.go @@ -4,10 +4,12 @@ import ( "testing" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" @@ -509,10 +511,10 @@ func TestEncoding(t *testing.T) { }, }, output: []sdk.Msg{ - &govtypes.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: addr1.String(), - Option: govtypes.OptionYes, + Option: govv1.OptionYes, }, }, }, @@ -525,10 +527,10 @@ func TestEncoding(t *testing.T) { }, }, output: []sdk.Msg{ - &govtypes.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: addr1.String(), - Option: govtypes.OptionNo, + Option: govv1.OptionNo, }, }, }, @@ -541,10 +543,10 @@ func TestEncoding(t *testing.T) { }, }, output: []sdk.Msg{ - &govtypes.MsgVote{ + &govv1.MsgVote{ ProposalId: 10, Voter: addr1.String(), - Option: govtypes.OptionAbstain, + Option: govv1.OptionAbstain, }, }, }, @@ -557,10 +559,10 @@ func TestEncoding(t *testing.T) { }, }, output: []sdk.Msg{ - &govtypes.MsgVote{ + &govv1.MsgVote{ ProposalId: 1, Voter: addr1.String(), - Option: govtypes.OptionNoWithVeto, + Option: govv1.OptionNoWithVeto, }, }, }, diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index 4c60bc550..cbbb977b8 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -11,9 +11,9 @@ import ( 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" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -327,7 +327,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { // picks the message in the default handler chain ctx, keepers := CreateDefaultTestInput(t) // set some supply - keepers.Faucet.NewFundedAccount(ctx, sdk.NewCoin("denom", sdk.NewInt(10_000_000))) + keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewCoin("denom", sdk.NewInt(10_000_000))) k := keepers.WasmKeeper example := InstantiateHackatomExampleContract(t, ctx, keepers) // with deposit of 100 stake @@ -400,7 +400,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { // and total supply reduced by burned amount after, err := keepers.BankKeeper.TotalSupply(sdk.WrapSDKContext(ctx), &banktypes.QueryTotalSupplyRequest{}) require.NoError(t, err) - diff := before.Supply.Sub(after.Supply) + diff := before.Supply.Sub(after.Supply...) assert.Equal(t, sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(100))), diff) }) } diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go index f6f928df6..7c0a79c31 100644 --- a/x/wasm/keeper/ibc.go +++ b/x/wasm/keeper/ibc.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + host "github.com/cosmos/ibc-go/v5/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/ibc_test.go b/x/wasm/keeper/ibc_test.go index 704e2f6c2..063dfb7f7 100644 --- a/x/wasm/keeper/ibc_test.go +++ b/x/wasm/keeper/ibc_test.go @@ -11,14 +11,14 @@ import ( ) func TestDontBindPortNonIBCContract(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) example := InstantiateHackatomExampleContract(t, ctx, keepers) // ensure we bound the port _, _, err := keepers.IBCKeeper.PortKeeper.LookupModuleByPort(ctx, keepers.WasmKeeper.GetContractInfo(ctx, example.Contract).IBCPortID) require.Error(t, err) } func TestBindingPortForIBCContractOnInstantiate(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) example := InstantiateIBCReflectContract(t, ctx, keepers) // ensure we bound the port owner, _, err := keepers.IBCKeeper.PortKeeper.LookupModuleByPort(ctx, keepers.WasmKeeper.GetContractInfo(ctx, example.Contract).IBCPortID) require.NoError(t, err) @@ -41,7 +41,7 @@ func TestBindingPortForIBCContractOnInstantiate(t *testing.T) { } func TestContractFromPortID(t *testing.T) { - contractAddr := BuildContractAddress(1, 100) + contractAddr := BuildContractAddressClassic(1, 100) specs := map[string]struct { srcPort string expAddr sdk.AccAddress diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 3fdcbec48..347c32ff0 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -4,22 +4,25 @@ import ( "bytes" "context" "encoding/binary" + "encoding/hex" "fmt" "math" "path/filepath" + "reflect" "strconv" "strings" "time" - "github.com/cosmos/cosmos-sdk/types/address" - wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/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/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" @@ -54,6 +57,15 @@ type CoinTransferrer interface { TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error } +// AccountPruner handles the balances and data cleanup for accounts that are pruned on contract instantiate. +// This is an extension point to attach custom logic +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) +} + // WasmVMResponseHandler is an extension point to handles the response data returned by a contract call. type WasmVMResponseHandler interface { // Handle processes the data returned by a contract invocation. @@ -66,9 +78,15 @@ type WasmVMResponseHandler interface { ) ([]byte, error) } +// list of account types that are accepted for wasm contracts. Chains importing wasmd +// can overwrite this list with the WithAcceptedAccountTypesOnContractInstantiation option. +var defaultAcceptedAccountTypes = map[reflect.Type]struct{}{ + reflect.TypeOf(&authtypes.BaseAccount{}): {}, +} + // Keeper will have a reference to Wasmer with it's own data directory. type Keeper struct { - storeKey sdk.StoreKey + storeKey storetypes.StoreKey cdc codec.Codec accountKeeper types.AccountKeeper bank CoinTransferrer @@ -79,17 +97,19 @@ type Keeper struct { wasmVMResponseHandler WasmVMResponseHandler messenger Messenger // queryGasLimit is the max wasmvm gas that can be spent on executing a query with a contract - queryGasLimit uint64 - paramSpace paramtypes.Subspace - gasRegister GasRegister - maxQueryStackSize uint32 + queryGasLimit uint64 + paramSpace paramtypes.Subspace + gasRegister GasRegister + maxQueryStackSize uint32 + acceptedAccountTypes map[reflect.Type]struct{} + accountPruner AccountPruner } // NewKeeper creates a new contract Keeper instance // If customEncoders is non-nil, we can use this to override some of the message handler, especially custom func NewKeeper( cdc codec.Codec, - storeKey sdk.StoreKey, + storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, @@ -103,10 +123,10 @@ func NewKeeper( queryRouter GRPCQueryRouter, homeDir string, wasmConfig types.WasmConfig, - supportedFeatures string, + availableCapabilities string, opts ...Option, ) Keeper { - wasmer, err := wasmvm.NewVM(filepath.Join(homeDir, "wasm"), supportedFeatures, contractMemoryLimit, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize) + wasmer, err := wasmvm.NewVM(filepath.Join(homeDir, "wasm"), availableCapabilities, contractMemoryLimit, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize) if err != nil { panic(err) } @@ -116,18 +136,20 @@ func NewKeeper( } keeper := &Keeper{ - storeKey: storeKey, - cdc: cdc, - wasmVM: wasmer, - accountKeeper: accountKeeper, - bank: NewBankCoinTransferrer(bankKeeper), - portKeeper: portKeeper, - capabilityKeeper: capabilityKeeper, - messenger: NewDefaultMessageHandler(router, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource), - queryGasLimit: wasmConfig.SmartQueryGasLimit, - paramSpace: paramSpace, - gasRegister: NewDefaultWasmGasRegister(), - maxQueryStackSize: types.DefaultMaxQueryStackSize, + storeKey: storeKey, + cdc: cdc, + wasmVM: wasmer, + accountKeeper: accountKeeper, + bank: NewBankCoinTransferrer(bankKeeper), + accountPruner: NewVestingCoinBurner(bankKeeper), + portKeeper: portKeeper, + capabilityKeeper: capabilityKeeper, + messenger: NewDefaultMessageHandler(router, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource), + queryGasLimit: wasmConfig.SmartQueryGasLimit, + paramSpace: paramSpace, + gasRegister: NewDefaultWasmGasRegister(), + maxQueryStackSize: types.DefaultMaxQueryStackSize, + acceptedAccountTypes: defaultAcceptedAccountTypes, } keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distKeeper, channelKeeper, queryRouter, keeper) for _, o := range opts { @@ -161,13 +183,13 @@ func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) { k.paramSpace.SetParamSet(ctx, &ps) } -func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, err error) { +func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, checksum []byte, err error) { if creator == nil { - return 0, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "cannot be nil") + return 0, checksum, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "cannot be nil") } if !authZ.CanCreateCode(k.getUploadAccessConfig(ctx), creator) { - return 0, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not create code") + return 0, checksum, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not create code") } // figure out proper instantiate access defaultAccessConfig := k.getInstantiateAccessConfig(ctx).With(creator) @@ -175,38 +197,42 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess = &defaultAccessConfig } else if !instantiateAccess.IsSubset(defaultAccessConfig) { // we enforce this must be subset of default upload access - return 0, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "instantiate access must be subset of default upload access") + return 0, checksum, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "instantiate access must be subset of default upload access") } - wasmCode, err = ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize)) - if err != nil { - return 0, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + if ioutils.IsGzip(wasmCode) { + ctx.GasMeter().ConsumeGas(k.gasRegister.UncompressCosts(len(wasmCode)), "Uncompress gzip bytecode") + wasmCode, err = ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize)) + if err != nil { + return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + } } - ctx.GasMeter().ConsumeGas(k.gasRegister.CompileCosts(len(wasmCode)), "Compiling WASM Bytecode") - checksum, err := k.wasmVM.Create(wasmCode) + ctx.GasMeter().ConsumeGas(k.gasRegister.CompileCosts(len(wasmCode)), "Compiling wasm bytecode") + checksum, err = k.wasmVM.Create(wasmCode) if err != nil { - return 0, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) } report, err := k.wasmVM.AnalyzeCode(checksum) if err != nil { - return 0, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) } codeID = k.autoIncrementID(ctx, types.KeyLastCodeID) - k.Logger(ctx).Debug("storing new contract", "features", report.RequiredFeatures, "code_id", codeID) + k.Logger(ctx).Debug("storing new contract", "capabilities", report.RequiredCapabilities, "code_id", codeID) codeInfo := types.NewCodeInfo(checksum, creator, *instantiateAccess) k.storeCodeInfo(ctx, codeID, codeInfo) evt := sdk.NewEvent( types.EventTypeStoreCode, - sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)), + sdk.NewAttribute(types.AttributeKeyChecksum, hex.EncodeToString(checksum)), + sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(codeID, 10)), // last element to be compatible with scripts ) - for _, f := range strings.Split(report.RequiredFeatures, ",") { - evt.AppendAttributes(sdk.NewAttribute(types.AttributeKeyFeature, strings.TrimSpace(f))) + for _, f := range strings.Split(report.RequiredCapabilities, ",") { + evt.AppendAttributes(sdk.NewAttribute(types.AttributeKeyRequiredCapability, strings.TrimSpace(f))) } ctx.EventManager().EmitEvent(evt) - return codeID, nil + return codeID, checksum, nil } func (k Keeper) storeCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo) { @@ -216,9 +242,12 @@ func (k Keeper) storeCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.Cod } func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo, wasmCode []byte) error { - wasmCode, err := ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize)) - if err != nil { - return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + if ioutils.IsGzip(wasmCode) { + var err error + wasmCode, err = ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize)) + if err != nil { + return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + } } newCodeHash, err := k.wasmVM.Create(wasmCode) if err != nil { @@ -238,42 +267,75 @@ func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeIn return nil } -func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, authZ AuthorizationPolicy) (sdk.AccAddress, []byte, error) { +func (k Keeper) instantiate( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + addressGenerator AddressGenerator, + authPolicy AuthorizationPolicy, +) (sdk.AccAddress, []byte, error) { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "instantiate") + 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") - // create contract address - contractAddress := k.generateContractAddress(ctx, codeID) - existingAcct := k.accountKeeper.GetAccount(ctx, contractAddress) - if existingAcct != nil { - return nil, nil, sdkerrors.Wrap(types.ErrAccountExists, existingAcct.GetAddress().String()) + // get contact info + codeInfo := k.GetCodeInfo(ctx, codeID) + if codeInfo == nil { + return nil, nil, sdkerrors.Wrap(types.ErrNotFound, "code") + } + if !authPolicy.CanInstantiateContract(codeInfo.InstantiateConfig, creator) { + return nil, nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not instantiate") } - // deposit initial contract funds - if !deposit.IsZero() { - if err := k.bank.TransferCoins(ctx, creator, contractAddress, deposit); err != nil { - return nil, nil, err + 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") + } + + // check account + // every cosmos module can define custom account types when needed. The cosmos-sdk comes with extension points + // to support this and a set of base and vesting account types that we integrated in our default lists. + // 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) + 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()) + } 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) + // also handle balance to not open cases where these accounts are abused and become liquid + switch handled, err := k.accountPruner.CleanupExistingAccount(ctx, existingAcct); { + case err != nil: + return nil, nil, sdkerrors.Wrap(err, "prune balance") + case !handled: + return nil, nil, types.ErrAccountExists.Wrap("address is claimed by external account") + } } } else { // create an empty account (so we don't have issues later) - // TODO: can we remove this? contractAccount := k.accountKeeper.NewAccountWithAddress(ctx, contractAddress) k.accountKeeper.SetAccount(ctx, contractAccount) } - - // get contact info - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetCodeKey(codeID)) - if bz == nil { - return nil, nil, sdkerrors.Wrap(types.ErrNotFound, "code") - } - var codeInfo types.CodeInfo - k.cdc.MustUnmarshal(bz, &codeInfo) - - if !authZ.CanInstantiateContract(codeInfo.InstantiateConfig, creator) { - return nil, nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not instantiate") + // deposit initial contract funds + if !deposit.IsZero() { + if err := k.bank.TransferCoins(ctx, creator, contractAddress, deposit); err != nil { + return nil, nil, err + } } // prepare params for contract instantiate call @@ -281,7 +343,7 @@ func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A info := types.NewInfo(creator, deposit) // create prefixed data store - // 0x03 | BuildContractAddress (sdk.AccAddress) + // 0x03 | BuildContractAddressClassic (sdk.AccAddress) prefixStoreKey := types.GetContractStorePrefix(contractAddress) prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) @@ -395,6 +457,10 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown code") } + if !authZ.CanInstantiateContract(newCodeInfo.InstantiateConfig, caller) { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "to use new code") + } + // check for IBC flag switch report, err := k.wasmVM.AnalyzeCode(newCodeInfo.CodeHash); { case err != nil: @@ -500,6 +566,7 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was // prepare querier querier := k.newQueryHandler(ctx, contractAddress) gas := k.runtimeGasForContract(ctx) + res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { @@ -566,7 +633,7 @@ func (k Keeper) appendToContractHistory(ctx sdk.Context, contractAddr sdk.AccAdd defer iter.Close() if iter.Valid() { - pos = sdk.BigEndianToUint64(iter.Value()) + pos = sdk.BigEndianToUint64(iter.Key()) } // then store with incrementing position for _, e := range newEntries { @@ -879,12 +946,17 @@ func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAd } // setAccessConfig updates the access config of a code id. -func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error { +func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, authz AuthorizationPolicy) error { info := k.GetCodeInfo(ctx, codeID) if info == nil { return sdkerrors.Wrap(types.ErrNotFound, "code info") } - info.InstantiateConfig = config + isSubset := newConfig.Permission.IsSubset(k.getInstantiateAccessConfig(ctx)) + if !authz.CanModifyCodeAccessConfig(sdk.MustAccAddressFromBech32(info.Creator), caller, isSubset) { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not modify code access config") + } + + info.InstantiateConfig = newConfig k.storeCodeInfo(ctx, codeID, *info) return nil } @@ -924,9 +996,10 @@ func (k Keeper) runtimeGasForContract(ctx sdk.Context) uint64 { if meter.IsOutOfGas() { return 0 } - if meter.Limit() == 0 { // infinite gas meter with limit=0 and not out of gas + if meter.Limit() == math.MaxUint64 { // infinite gas meter with limit=math.MaxUint64 and not out of gas return math.MaxUint64 } + return k.gasRegister.ToWasmVMGas(meter.Limit() - meter.GasConsumedToLimit()) } @@ -939,20 +1012,6 @@ func (k Keeper) consumeRuntimeGas(ctx sdk.Context, gas uint64) { } } -// generates a contract address from codeID + instanceID -func (k Keeper) generateContractAddress(ctx sdk.Context, codeID uint64) sdk.AccAddress { - instanceID := k.autoIncrementID(ctx, types.KeyLastInstanceID) - return BuildContractAddress(codeID, instanceID) -} - -// BuildContractAddress builds an sdk account address for a contract. -func BuildContractAddress(codeID, instanceID uint64) sdk.AccAddress { - contractID := make([]byte, 16) - binary.BigEndian.PutUint64(contractID[:8], codeID) - binary.BigEndian.PutUint64(contractID[8:], instanceID) - return address.Module(types.ModuleName, contractID)[:types.ContractAddrLen] -} - func (k Keeper) autoIncrementID(ctx sdk.Context, lastIDKey []byte) uint64 { store := ctx.KVStore(k.storeKey) bz := store.Get(lastIDKey) @@ -1081,6 +1140,43 @@ func (c BankCoinTransferrer) TransferCoins(parentCtx sdk.Context, fromAddr sdk.A return nil } +var _ AccountPruner = VestingCoinBurner{} + +// VestingCoinBurner default implementation for AccountPruner to burn the coins +type VestingCoinBurner struct { + bank types.BankKeeper +} + +// NewVestingCoinBurner constructor +func NewVestingCoinBurner(bank types.BankKeeper) VestingCoinBurner { + if bank == nil { + panic("bank keeper must not be nil") + } + return VestingCoinBurner{bank: bank} +} + +// 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) { + v, ok := existingAcc.(vestingexported.VestingAccount) + if !ok { + return false, nil + } + + ctx = ctx.WithGasMeter(sdk.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)) + } + if err := b.bank.SendCoinsFromAccountToModule(ctx, existingAcc.GetAddress(), types.ModuleName, coinsToBurn); err != nil { + return false, sdkerrors.Wrap(err, "prune account balance") + } + if err := b.bank.BurnCoins(ctx, types.ModuleName, coinsToBurn); err != nil { + return false, sdkerrors.Wrap(err, "burn account balance") + } + return true, nil +} + type msgDispatcher interface { DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []wasmvmtypes.SubMsg) ([]byte, error) } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index bb20a3926..7a3c5305a 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2,60 +2,56 @@ package keeper import ( "bytes" + _ "embed" "encoding/json" "errors" - "io/ioutil" - "math" + "fmt" + "os" "testing" "time" - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/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" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + fuzz "github.com/google/gofuzz" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - + "github.com/tendermint/tendermint/libs/rand" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" ) -// When migrated to go 1.16, embed package should be used instead. -func init() { - b, err := ioutil.ReadFile("./testdata/hackatom.wasm") - if err != nil { - panic(err) - } - hackatomWasm = b -} - +//go:embed testdata/hackatom.wasm var hackatomWasm []byte -const SupportedFeatures = "iterator,staking,stargate" +const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1" func TestNewKeeper(t *testing.T) { - _, keepers := CreateTestInput(t, false, SupportedFeatures) + _, keepers := CreateTestInput(t, false, AvailableCapabilities) require.NotNil(t, keepers.ContractKeeper) } func TestCreateSuccess(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) em := sdk.NewEventManager() - contractID, err := keeper.Create(ctx.WithEventManager(em), creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx.WithEventManager(em), creator, hackatomWasm, nil) require.NoError(t, err) require.Equal(t, uint64(1), contractID) // and verify content @@ -63,32 +59,33 @@ func TestCreateSuccess(t *testing.T) { require.NoError(t, err) require.Equal(t, hackatomWasm, storedCode) // and events emitted - exp := sdk.Events{sdk.NewEvent("store_code", sdk.NewAttribute("code_id", "1"))} + codeHash := "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5" + exp := sdk.Events{sdk.NewEvent("store_code", sdk.NewAttribute("code_checksum", codeHash), sdk.NewAttribute("code_id", "1"))} assert.Equal(t, exp, em.Events()) } func TestCreateNilCreatorAddress(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) - _, err := keepers.ContractKeeper.Create(ctx, nil, hackatomWasm, nil) + _, _, err := keepers.ContractKeeper.Create(ctx, nil, hackatomWasm, nil) require.Error(t, err, "nil creator is not allowed") } func TestCreateNilWasmCode(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) - _, err := keepers.ContractKeeper.Create(ctx, creator, nil, nil) + _, _, err := keepers.ContractKeeper.Create(ctx, creator, nil, nil) require.Error(t, err, "nil WASM code is not allowed") } func TestCreateInvalidWasmCode(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) - _, err := keepers.ContractKeeper.Create(ctx, creator, []byte("potatoes"), nil) + _, _, err := keepers.ContractKeeper.Create(ctx, creator, []byte("potatoes"), nil) require.Error(t, err, "potatoes are not valid WASM code") } @@ -121,7 +118,7 @@ func TestCreateStoresInstantiatePermission(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper keepers.WasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowEverybody, @@ -129,7 +126,7 @@ func TestCreateStoresInstantiatePermission(t *testing.T) { }) fundAccounts(t, ctx, accKeeper, bankKeeper, myAddr, deposit) - codeID, err := keeper.Create(ctx, myAddr, hackatomWasm, nil) + codeID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, nil) require.NoError(t, err) codeInfo := keepers.WasmKeeper.GetCodeInfo(ctx, codeID) @@ -140,12 +137,12 @@ func TestCreateStoresInstantiatePermission(t *testing.T) { } func TestCreateWithParamPermissions(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) - otherAddr := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + otherAddr := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) specs := map[string]struct { srcPermission types.AccessConfig @@ -174,7 +171,7 @@ func TestCreateWithParamPermissions(t *testing.T) { params := types.DefaultParams() params.CodeUploadAccess = spec.srcPermission keepers.WasmKeeper.SetParams(ctx, params) - _, err := keeper.Create(ctx, creator, hackatomWasm, nil) + _, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.True(t, spec.expError.Is(err), err) if spec.expError != nil { return @@ -186,13 +183,13 @@ func TestCreateWithParamPermissions(t *testing.T) { // ensure that the user cannot set the code instantiate permission to something more permissive // than the default func TestEnforceValidPermissionsOnCreate(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper contractKeeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) - other := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + other := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) onlyCreator := types.AccessTypeOnlyAddress.With(creator) onlyOther := types.AccessTypeOnlyAddress.With(other) @@ -251,7 +248,7 @@ func TestEnforceValidPermissionsOnCreate(t *testing.T) { params := types.DefaultParams() params.InstantiateDefaultPermission = spec.defaultPermssion keeper.SetParams(ctx, params) - codeID, err := contractKeeper.Create(ctx, creator, hackatomWasm, spec.requestedPermission) + codeID, _, err := contractKeeper.Create(ctx, creator, hackatomWasm, spec.requestedPermission) require.True(t, spec.expError.Is(err), err) if spec.expError == nil { codeInfo := keeper.GetCodeInfo(ctx, codeID) @@ -262,19 +259,19 @@ func TestEnforceValidPermissionsOnCreate(t *testing.T) { } func TestCreateDuplicate(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) // create one copy - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) require.Equal(t, uint64(1), contractID) // create second copy - duplicateID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + duplicateID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) require.Equal(t, uint64(2), duplicateID) @@ -288,24 +285,24 @@ func TestCreateDuplicate(t *testing.T) { } func TestCreateWithSimulation(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) ctx = ctx.WithBlockHeader(tmproto.Header{Height: 1}). WithGasMeter(stypes.NewInfiniteGasMeter()) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) // create this once in simulation mode - contractID, err := keepers.ContractKeeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keepers.ContractKeeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) require.Equal(t, uint64(1), contractID) // then try to create it in non-simulation mode (should not fail) - ctx, keepers = CreateTestInput(t, false, SupportedFeatures) + ctx, keepers = CreateTestInput(t, false, AvailableCapabilities) ctx = ctx.WithGasMeter(sdk.NewGasMeter(10_000_000)) - creator = keepers.Faucet.NewFundedAccount(ctx, deposit...) - contractID, err = keepers.ContractKeeper.Create(ctx, creator, hackatomWasm, nil) + creator = keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + contractID, _, err = keepers.ContractKeeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) require.Equal(t, uint64(1), contractID) @@ -342,16 +339,16 @@ func TestIsSimulationMode(t *testing.T) { } func TestCreateWithGzippedPayload(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm.gzip") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm.gzip") require.NoError(t, err, "reading gzipped WASM code") - contractID, err := keeper.Create(ctx, creator, wasmCode, nil) + contractID, _, err := keeper.Create(ctx, creator, wasmCode, nil) require.NoError(t, err) require.Equal(t, uint64(1), contractID) // and verify content @@ -360,22 +357,35 @@ func TestCreateWithGzippedPayload(t *testing.T) { require.Equal(t, hackatomWasm, storedCode) } -func TestInstantiate(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) +func TestCreateWithBrokenGzippedPayload(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) - codeID, err := keeper.Create(ctx, creator, hackatomWasm, nil) - require.NoError(t, err) + wasmCode, err := os.ReadFile("./testdata/broken_crc.gzip") + require.NoError(t, err, "reading gzipped WASM code") - _, _, bob := keyPubAddr() - _, _, fred := keyPubAddr() + gm := sdk.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 +} + +func TestInstantiate(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: fred, - Beneficiary: bob, + Verifier: RandomAccountAddress(t), + Beneficiary: RandomAccountAddress(t), } initMsgBz, err := json.Marshal(initMsg) require.NoError(t, err) @@ -384,25 +394,25 @@ func TestInstantiate(t *testing.T) { em := sdk.NewEventManager() // create with no balance is also legal - gotContractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), codeID, creator, nil, initMsgBz, "demo contract 1", nil) + gotContractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil) require.NoError(t, err) require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", gotContractAddr.String()) gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x18db5), gasAfter-gasBefore) + require.Equal(t, uint64(0x1a455), gasAfter-gasBefore) } // ensure it is stored properly info := keepers.WasmKeeper.GetContractInfo(ctx, gotContractAddr) require.NotNil(t, info) assert.Equal(t, creator.String(), info.Creator) - assert.Equal(t, codeID, info.CodeID) + assert.Equal(t, example.CodeID, info.CodeID) assert.Equal(t, "demo contract 1", info.Label) exp := []types.ContractCodeHistoryEntry{{ Operation: types.ContractCodeHistoryOperationTypeInit, - CodeID: codeID, + CodeID: example.CodeID, Updated: types.NewAbsoluteTxPosition(ctx), Msg: initMsgBz, }} @@ -424,12 +434,9 @@ func TestInstantiateWithDeposit(t *testing.T) { fred = bytes.Repeat([]byte{2}, types.SDKAddrLen) deposit = sdk.NewCoins(sdk.NewInt64Coin("denom", 100)) - initMsg = HackatomExampleInitMsg{Verifier: fred, Beneficiary: bob} + initMsg = mustMarshal(t, HackatomExampleInitMsg{Verifier: fred, Beneficiary: bob}) ) - initMsgBz, err := json.Marshal(initMsg) - require.NoError(t, err) - specs := map[string]struct { srcActor sdk.AccAddress expError bool @@ -451,17 +458,17 @@ func TestInstantiateWithDeposit(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper if spec.fundAddr { fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, sdk.NewCoins(sdk.NewInt64Coin("denom", 200))) } - contractID, err := keeper.Create(ctx, spec.srcActor, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, spec.srcActor, hackatomWasm, nil) require.NoError(t, err) // when - addr, _, err := keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsgBz, "my label", deposit) + addr, _, err := keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsg, "my label", deposit) // then if spec.expError { require.Error(t, err) @@ -512,17 +519,20 @@ func TestInstantiateWithPermissions(t *testing.T) { srcActor: myAddr, }, "onlyAddress with non matching address": { + srcActor: myAddr, srcPermission: types.AccessTypeOnlyAddress.With(otherAddr), expError: sdkerrors.ErrUnauthorized, }, } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper - fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, deposit) + if spec.srcActor != nil { + fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, deposit) + } - contractID, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) + contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) require.NoError(t, err) _, _, err = keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsgBz, "demo contract 1", nil) @@ -531,11 +541,147 @@ func TestInstantiateWithPermissions(t *testing.T) { } } +func TestInstantiateWithAccounts(t *testing.T) { + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) + example := StoreHackatomExampleContract(t, parentCtx, keepers) + require.Equal(t, uint64(1), example.CodeID) + initMsg := mustMarshal(t, HackatomExampleInitMsg{Verifier: RandomAccountAddress(t), Beneficiary: RandomAccountAddress(t)}) + + senderAddr := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(parentCtx, senderAddr, sdk.NewInt64Coin("denom", 100000000)) + const myLabel = "testing" + mySalt := []byte(`my salt`) + contractAddr := BuildContractAddressPredictable(example.Checksum, senderAddr, mySalt, []byte{}) + + lastAccountNumber := keepers.AccountKeeper.GetAccount(parentCtx, senderAddr).GetAccountNumber() + + specs := map[string]struct { + option Option + account authtypes.AccountI + initBalance sdk.Coin + deposit sdk.Coins + expErr error + expAccount authtypes.AccountI + expBalance sdk.Coins + }{ + "unused BaseAccount exists": { + account: authtypes.NewBaseAccount(contractAddr, nil, 0, 0), + initBalance: sdk.NewInt64Coin("denom", 100000000), + expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+1, 0), // +1 for next seq + expBalance: sdk.NewCoins(sdk.NewInt64Coin("denom", 100000000)), + }, + "BaseAccount with sequence exists": { + account: authtypes.NewBaseAccount(contractAddr, nil, 0, 1), + expErr: types.ErrAccountExists, + }, + "BaseAccount with pubkey exists": { + account: authtypes.NewBaseAccount(contractAddr, &ed25519.PubKey{}, 0, 0), + expErr: types.ErrAccountExists, + }, + "no account existed": { + expAccount: authtypes.NewBaseAccount(contractAddr, nil, lastAccountNumber+1, 0), // +1 for next seq, + expBalance: sdk.NewCoins(), + }, + "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))), + }, + "prunable DelayedVestingAccount gets overwritten": { + account: 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: 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 ContinuousVestingAccount gets overwritten": { + account: 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))), + 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(), + }, + "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)), + expErr: types.ErrAccountExists, + }, + "with option used to set non default type to accept list": { + option: WithAcceptedAccountTypesOnContractInstantiation(&vestingtypes.DelayedVestingAccount{}), + account: 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))), + }, + "pruning account fails": { + option: WithAccountPruner(wasmtesting.AccountPrunerMock{CleanupExistingAccountFn: func(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) { + return false, types.ErrUnsupportedForContract.Wrap("testing") + }}), + account: vestingtypes.NewDelayedVestingAccount( + authtypes.NewBaseAccount(contractAddr, nil, 0, 0), + sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))), time.Now().Add(30*time.Hour).Unix()), + expErr: types.ErrUnsupportedForContract, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() + if spec.account != nil { + keepers.AccountKeeper.SetAccount(ctx, keepers.AccountKeeper.NewAccount(ctx, spec.account)) + } + if !spec.initBalance.IsNil() { + keepers.Faucet.Fund(ctx, spec.account.GetAddress(), spec.initBalance) + } + if spec.option != nil { + spec.option.apply(keepers.WasmKeeper) + } + defer func() { + if spec.option != nil { // reset + WithAcceptedAccountTypesOnContractInstantiation(&authtypes.BaseAccount{}).apply(keepers.WasmKeeper) + WithAccountPruner(NewVestingCoinBurner(keepers.BankKeeper)).apply(keepers.WasmKeeper) + } + }() + // when + gotAddr, _, gotErr := keepers.ContractKeeper.Instantiate2(ctx, 1, senderAddr, nil, initMsg, myLabel, spec.deposit, mySalt, false) + if spec.expErr != nil { + assert.ErrorIs(t, gotErr, spec.expErr) + return + } + require.NoError(t, gotErr) + assert.Equal(t, contractAddr, gotAddr) + // and + gotAcc := keepers.AccountKeeper.GetAccount(ctx, contractAddr) + assert.Equal(t, spec.expAccount, gotAcc) + // and + gotBalance := keepers.BankKeeper.GetAllBalances(ctx, contractAddr) + assert.Equal(t, spec.expBalance, gotBalance) + }) + } +} + func TestInstantiateWithNonExistingCodeID(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) initMsg := HackatomExampleInitMsg{} initMsgBz, err := json.Marshal(initMsg) @@ -548,7 +694,7 @@ func TestInstantiateWithNonExistingCodeID(t *testing.T) { } func TestInstantiateWithContractDataResponse(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) wasmerMock := &wasmtesting.MockWasmer{ 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) { @@ -564,19 +710,96 @@ func TestInstantiateWithContractDataResponse(t *testing.T) { assert.Equal(t, []byte("my-response-data"), data) } +func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) { + // Scenario: + // given a factory contract stored + // when instantiated, the contract creates a new child contract instance + // and the child contracts queries the senders ContractInfo on instantiation + // then the factory contract's ContractInfo should be returned to the child contract + // + // see also: https://github.com/CosmWasm/wasmd/issues/896 + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + 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) + wasmerMock := &wasmtesting.MockWasmer{ + // 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) { + require.Greater(t, len(callbacks), instantiationCount, "unexpected call to instantiation") + do := callbacks[instantiationCount] + instantiationCount++ + return do(codeID, env, info, initMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) + }, + AnalyzeCodeFn: wasmtesting.WithoutIBCAnalyzeFn, + CreateFn: wasmtesting.NoOpCreateFn, + } + + // overwrite wasmvm in router + router := baseapp.NewMsgServiceRouter() + router.SetInterfaceRegistry(keepers.EncodingConfig.InterfaceRegistry) + types.RegisterMsgServer(router, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper))) + keeper.messenger = NewDefaultMessageHandler(router, nil, nil, nil, keepers.EncodingConfig.Marshaler, nil) + // overwrite wasmvm in response handler + keeper.wasmVMResponseHandler = NewDefaultWasmVMContractResponseHandler(NewMessageDispatcher(keeper.messenger, keeper)) + + example := StoreRandomContract(t, ctx, keepers, wasmerMock) + // 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) { + 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"}, + }, + }, + }, + }}, 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) { + t.Log("called child") + capturedSenderAddr = info.Sender + var err error + capturedCodeInfo, err = querier.Query(wasmvmtypes.QueryRequest{ + Wasm: &wasmvmtypes.WasmQuery{ + ContractInfo: &wasmvmtypes.ContractInfoQuery{ContractAddr: info.Sender}, + }, + }, gasLimit) + require.NoError(t, err) + return &wasmvmtypes.Response{Data: []byte("child")}, 0, nil + } + + // when + parentAddr, data, err := keepers.ContractKeeper.Instantiate(ctx, example.CodeID, example.CreatorAddr, nil, nil, "test", nil) + + // then + require.NoError(t, err) + assert.Equal(t, []byte("parent"), data) + require.Equal(t, parentAddr.String(), capturedSenderAddr) + expCodeInfo := fmt.Sprintf(`{"code_id":%d,"creator":%q,"pinned":false}`, example.CodeID, example.CreatorAddr.String()) + assert.JSONEq(t, expCodeInfo, string(capturedCodeInfo)) +} + func TestExecute(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) + bob := RandomAccountAddress(t) - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) - _, _, bob := keyPubAddr() initMsg := HackatomExampleInitMsg{ Verifier: fred, Beneficiary: bob, @@ -623,7 +846,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(0x17cd2), gasAfter-gasBefore) + require.Equal(t, uint64(0x1a258), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) @@ -702,7 +925,7 @@ func TestExecuteWithDeposit(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper if spec.newBankParams != nil { bankKeeper.SetParams(ctx, *spec.newBankParams) @@ -710,7 +933,7 @@ func TestExecuteWithDeposit(t *testing.T) { if spec.fundAddr { fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, sdk.NewCoins(sdk.NewInt64Coin("denom", 200))) } - codeID, err := keeper.Create(ctx, spec.srcActor, hackatomWasm, nil) + codeID, _, err := keeper.Create(ctx, spec.srcActor, hackatomWasm, nil) require.NoError(t, err) initMsg := HackatomExampleInitMsg{Verifier: spec.srcActor, Beneficiary: spec.beneficiary} @@ -736,11 +959,12 @@ func TestExecuteWithDeposit(t *testing.T) { } func TestExecuteWithNonExistingAddress(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) // unauthorized - trialCtx so we don't change state nonExistingAddress := RandomAccountAddress(t) @@ -749,15 +973,16 @@ func TestExecuteWithNonExistingAddress(t *testing.T) { } func TestExecuteWithPanic(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -780,15 +1005,16 @@ func TestExecuteWithPanic(t *testing.T) { } func TestExecuteWithCpuLoop(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -821,15 +1047,16 @@ func TestExecuteWithCpuLoop(t *testing.T) { } func TestExecuteWithStorageLoop(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -862,19 +1089,25 @@ func TestExecuteWithStorageLoop(t *testing.T) { } func TestMigrate(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) - - originalCodeID := StoreHackatomExampleContract(t, ctx, keepers).CodeID - newCodeID := StoreHackatomExampleContract(t, ctx, keepers).CodeID - ibcCodeID := StoreIBCReflectContract(t, ctx, keepers).CodeID + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(parentCtx, creator, deposit.Add(deposit...)...) + fred := DeterministicAccountAddress(t, 2) + keepers.Faucet.Fund(parentCtx, fred, topUp...) + + originalCodeID := StoreHackatomExampleContract(t, parentCtx, keepers).CodeID + newCodeID := StoreHackatomExampleContract(t, parentCtx, keepers).CodeID + ibcCodeID := StoreIBCReflectContract(t, parentCtx, keepers).CodeID require.NotEqual(t, originalCodeID, newCodeID) + restrictedCodeExample := StoreHackatomExampleContract(t, parentCtx, keepers) + require.NoError(t, keeper.SetAccessConfig(parentCtx, restrictedCodeExample.CodeID, restrictedCodeExample.CreatorAddr, types.AllowNobody)) + require.NotEqual(t, originalCodeID, restrictedCodeExample.CodeID) + anyAddr := RandomAccountAddress(t) newVerifierAddr := RandomAccountAddress(t) initMsgBz := HackatomExampleInitMsg{ @@ -952,6 +1185,15 @@ func TestMigrate(t *testing.T) { toCodeID: originalCodeID, expErr: sdkerrors.ErrUnauthorized, }, + "prevent migration when new code is restricted": { + admin: creator, + caller: creator, + initMsg: initMsgBz, + fromCodeID: originalCodeID, + toCodeID: restrictedCodeExample.CodeID, + migrateMsg: migMsgBz, + expErr: sdkerrors.ErrUnauthorized, + }, "fail with non existing code id": { admin: creator, caller: creator, @@ -989,7 +1231,7 @@ func TestMigrate(t *testing.T) { "fail when no IBC callbacks": { admin: fred, caller: fred, - initMsg: IBCReflectInitMsg{ReflectCodeID: StoreReflectContract(t, ctx, keepers)}.GetBytes(t), + initMsg: IBCReflectInitMsg{ReflectCodeID: StoreReflectContract(t, parentCtx, keepers).CodeID}.GetBytes(t), fromCodeID: ibcCodeID, toCodeID: newCodeID, migrateMsg: migMsgBz, @@ -997,10 +1239,13 @@ func TestMigrate(t *testing.T) { }, } + blockHeight := parentCtx.BlockHeight() for msg, spec := range specs { t.Run(msg, func(t *testing.T) { // given a contract instance - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + ctx, _ := parentCtx.WithBlockHeight(blockHeight + 1).CacheContext() + blockHeight++ + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, spec.fromCodeID, creator, spec.admin, spec.initMsg, "demo contract", nil) require.NoError(t, err) if spec.overrideContractAddr != nil { @@ -1043,7 +1288,7 @@ func TestMigrate(t *testing.T) { } func TestMigrateReplacesTheSecondIndex(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) example := InstantiateHackatomExampleContract(t, ctx, keepers) // then assert a second index exists @@ -1077,19 +1322,20 @@ func TestMigrateReplacesTheSecondIndex(t *testing.T) { } func TestMigrateWithDispatchedMessage(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, sdk.NewInt64Coin("denom", 5000)) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewInt64Coin("denom", 5000)) - burnerCode, err := ioutil.ReadFile("./testdata/burner.wasm") + burnerCode, err := os.ReadFile("./testdata/burner.wasm") require.NoError(t, err) - originalContractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + originalContractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) - burnerContractID, err := keeper.Create(ctx, creator, burnerCode, nil) + burnerContractID, _, err := keeper.Create(ctx, creator, burnerCode, nil) require.NoError(t, err) require.NotEqual(t, originalContractID, burnerContractID) @@ -1162,7 +1408,7 @@ func TestMigrateWithDispatchedMessage(t *testing.T) { } func TestIterateContractsByCode(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k, c := keepers.WasmKeeper, keepers.ContractKeeper example1 := InstantiateHackatomExampleContract(t, ctx, keepers) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) @@ -1208,7 +1454,7 @@ func TestIterateContractsByCodeWithMigration(t *testing.T) { return &wasmvmtypes.Response{}, 1, nil }} wasmtesting.MakeInstantiable(&mockWasmVM) - ctx, keepers := CreateTestInput(t, false, SupportedFeatures, WithWasmEngine(&mockWasmVM)) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithWasmEngine(&mockWasmVM)) k, c := keepers.WasmKeeper, keepers.ContractKeeper example1 := InstantiateHackatomExampleContract(t, ctx, keepers) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) @@ -1247,13 +1493,14 @@ type stealFundsMsg struct { } func TestSudo(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(ctx, creator, deposit.Add(deposit...)...) - contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -1330,15 +1577,16 @@ func mustMarshal(t *testing.T, r interface{}) []byte { } func TestUpdateContractAdmin(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(parentCtx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) - originalContractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, anyAddr := keyPubAddr() @@ -1381,6 +1629,7 @@ func TestUpdateContractAdmin(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() addr, _, err := keepers.ContractKeeper.Instantiate(ctx, originalContractID, creator, spec.instAdmin, initMsgBz, "demo contract", nil) require.NoError(t, err) if spec.overrideContractAddr != nil { @@ -1398,15 +1647,16 @@ func TestUpdateContractAdmin(t *testing.T) { } func TestClearContractAdmin(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.ContractKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(parentCtx, creator, deposit.Add(deposit...)...) + fred := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) - originalContractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) + originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) require.NoError(t, err) _, _, anyAddr := keyPubAddr() @@ -1444,6 +1694,7 @@ func TestClearContractAdmin(t *testing.T) { } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() addr, _, err := keepers.ContractKeeper.Instantiate(ctx, originalContractID, creator, spec.instAdmin, initMsgBz, "demo contract", nil) require.NoError(t, err) if spec.overrideContractAddr != nil { @@ -1461,7 +1712,7 @@ func TestClearContractAdmin(t *testing.T) { } func TestPinCode(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k := keepers.WasmKeeper var capturedChecksums []wasmvm.Checksum @@ -1488,7 +1739,7 @@ func TestPinCode(t *testing.T) { } func TestUnpinCode(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k := keepers.WasmKeeper var capturedChecksums []wasmvm.Checksum @@ -1522,7 +1773,7 @@ func TestUnpinCode(t *testing.T) { } func TestInitializePinnedCodes(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k := keepers.WasmKeeper var capturedChecksums []wasmvm.Checksum @@ -1562,7 +1813,7 @@ func TestPinnedContractLoops(t *testing.T) { // a pinned contract that calls itself via submessages should terminate with an // error at some point - ctx, keepers := CreateTestInput(t, false, SupportedFeatures, WithWasmEngine(&mock)) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithWasmEngine(&mock)) k := keepers.WasmKeeper example := SeedNewContractInstance(t, ctx, keepers, &mock) @@ -1678,7 +1929,7 @@ func TestNewDefaultWasmVMContractResponseHandler(t *testing.T) { } func TestReply(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k := keepers.WasmKeeper var mock wasmtesting.MockWasmer wasmtesting.MakeInstantiable(&mock) @@ -1747,7 +1998,7 @@ func TestReply(t *testing.T) { } func TestQueryIsolation(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) k := keepers.WasmKeeper var mock wasmtesting.MockWasmer wasmtesting.MakeInstantiable(&mock) @@ -1777,49 +2028,165 @@ func TestQueryIsolation(t *testing.T) { assert.Nil(t, ctx.KVStore(k.storeKey).Get([]byte(`set_in_query`))) } -func TestBuildContractAddress(t *testing.T) { +func TestSetAccessConfig(t *testing.T) { + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) + k := keepers.WasmKeeper + creatorAddr := RandomAccountAddress(t) + nonCreatorAddr := RandomAccountAddress(t) + + specs := map[string]struct { + authz AuthorizationPolicy + chainPermission types.AccessType + newConfig types.AccessConfig + caller sdk.AccAddress + expErr bool + }{ + "user with new permissions == chain permissions": { + authz: DefaultAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowEverybody, + caller: creatorAddr, + }, + "user with new permissions < chain permissions": { + authz: DefaultAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowNobody, + caller: creatorAddr, + }, + "user with new permissions > chain permissions": { + authz: DefaultAuthorizationPolicy{}, + chainPermission: types.AccessTypeNobody, + newConfig: types.AllowEverybody, + caller: creatorAddr, + expErr: true, + }, + "different actor": { + authz: DefaultAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowEverybody, + caller: nonCreatorAddr, + expErr: true, + }, + "gov with new permissions == chain permissions": { + authz: GovAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowEverybody, + caller: creatorAddr, + }, + "gov with new permissions < chain permissions": { + authz: GovAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowNobody, + caller: creatorAddr, + }, + "gov with new permissions > chain permissions": { + authz: GovAuthorizationPolicy{}, + chainPermission: types.AccessTypeNobody, + newConfig: types.AccessTypeOnlyAddress.With(creatorAddr), + caller: creatorAddr, + }, + "gov without actor": { + authz: GovAuthorizationPolicy{}, + chainPermission: types.AccessTypeEverybody, + newConfig: types.AllowEverybody, + }, + } + const codeID = 1 + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() + newParams := types.DefaultParams() + newParams.InstantiateDefaultPermission = spec.chainPermission + k.SetParams(ctx, newParams) + + k.storeCodeInfo(ctx, codeID, types.NewCodeInfo(nil, creatorAddr, types.AllowNobody)) + // when + gotErr := k.setAccessConfig(ctx, codeID, spec.caller, spec.newConfig, spec.authz) + if spec.expErr { + require.Error(t, gotErr) + return + } + require.NoError(t, gotErr) + }) + } +} + +func TestAppendToContractHistory(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + var contractAddr sdk.AccAddress = rand.Bytes(types.ContractAddrLen) + var orderedEntries []types.ContractCodeHistoryEntry + + f := fuzz.New().Funcs(ModelFuzzers...) + for i := 0; i < 10; i++ { + var entry types.ContractCodeHistoryEntry + f.Fuzz(&entry) + keepers.WasmKeeper.appendToContractHistory(ctx, contractAddr, entry) + orderedEntries = append(orderedEntries, entry) + } + // when + gotHistory := keepers.WasmKeeper.GetContractHistory(ctx, contractAddr) + assert.Equal(t, orderedEntries, gotHistory) +} + +func TestCoinBurnerPruneBalances(t *testing.T) { + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) + amts := sdk.NewCoins(sdk.NewInt64Coin("denom", 100)) + senderAddr := keepers.Faucet.NewFundedRandomAccount(parentCtx, amts...) + + // 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) + require.NoError(t, err) + myVestingAccount := keepers.AccountKeeper.GetAccount(parentCtx, vestingAddr) + require.NotNil(t, myVestingAccount) + specs := map[string]struct { - srcCodeID uint64 - srcInstanceID uint64 - expectedAddr string + setupAcc func(t *testing.T, ctx sdk.Context) authtypes.AccountI + expBalances sdk.Coins + expHandled bool + expErr *sdkerrors.Error }{ - "initial contract": { - srcCodeID: 1, - srcInstanceID: 1, - expectedAddr: "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", - }, - "demo value": { - srcCodeID: 1, - srcInstanceID: 100, - expectedAddr: "cosmos1mujpjkwhut9yjw4xueyugc02evfv46y0dtmnz4lh8xxkkdapym9stu5qm8", - }, - "both below max": { - srcCodeID: math.MaxUint32 - 1, - srcInstanceID: math.MaxUint32 - 1, - }, - "both at max": { - srcCodeID: math.MaxUint32, - srcInstanceID: math.MaxUint32, - }, - "codeID > max u32": { - srcCodeID: math.MaxUint32 + 1, - srcInstanceID: 17, - expectedAddr: "cosmos1673hrexz4h6s0ft04l96ygq667djzh2nsr335kstjp49x5dk6rpsf5t0le", - }, - "instanceID > max u32": { - srcCodeID: 22, - srcInstanceID: math.MaxUint32 + 1, - expectedAddr: "cosmos10q3pgfvmeyy0veekgtqhxujxkhz0vm9zmalqgc7evrhj68q3l62qrdfg4m", + "vesting account - all removed": { + setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.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 { + keepers.Faucet.Fund(ctx, vestingAddr, sdk.NewCoin("other", sdk.NewInt(2))) + return myVestingAccount + }, + expBalances: sdk.NewCoins(sdk.NewCoin("other", sdk.NewInt(2))), + expHandled: true, + }, + "non vesting account - not handled": { + setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.AccountI { + return &authtypes.BaseAccount{Address: myVestingAccount.GetAddress().String()} + }, + expBalances: sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(100))), + expHandled: false, }, } for name, spec := range specs { t.Run(name, func(t *testing.T) { - gotAddr := BuildContractAddress(spec.srcCodeID, spec.srcInstanceID) - require.NotNil(t, gotAddr) - assert.Nil(t, sdk.VerifyAddressFormat(gotAddr)) - if len(spec.expectedAddr) > 0 { - require.Equal(t, spec.expectedAddr, gotAddr.String()) + ctx, _ := parentCtx.CacheContext() + existingAccount := spec.setupAcc(t, ctx) + // overwrite account in store as in keeper before calling prune + keepers.AccountKeeper.SetAccount(ctx, keepers.AccountKeeper.NewAccountWithAddress(ctx, vestingAddr)) + + // when + noGasCtx := ctx.WithGasMeter(sdk.NewGasMeter(0)) // should not use callers gas + gotHandled, gotErr := NewVestingCoinBurner(keepers.BankKeeper).CleanupExistingAccount(noGasCtx, existingAccount) + // then + if spec.expErr != nil { + require.ErrorIs(t, gotErr, spec.expErr) + return } + require.NoError(t, gotErr) + assert.Equal(t, spec.expBalances, keepers.BankKeeper.GetAllBalances(ctx, vestingAddr)) + assert.Equal(t, spec.expHandled, gotHandled) + // and no out of gas panic }) } } diff --git a/x/wasm/keeper/legacy_querier_test.go b/x/wasm/keeper/legacy_querier_test.go index e21dd2353..1b6006fa3 100644 --- a/x/wasm/keeper/legacy_querier_test.go +++ b/x/wasm/keeper/legacy_querier_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,17 +17,17 @@ import ( ) func TestLegacyQueryContractState(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - anyAddr := keepers.Faucet.NewFundedAccount(ctx, sdk.NewInt64Coin("denom", 5000)) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit.Add(deposit...)...) + anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewInt64Coin("denom", 5000)) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - contractID, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) + contractID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -154,18 +154,18 @@ func TestLegacyQueryContractState(t *testing.T) { } func TestLegacyQueryContractListByCodeOrdering(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - anyAddr := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit.Add(deposit...)...) + anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - codeID, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -218,7 +218,7 @@ func TestLegacyQueryContractListByCodeOrdering(t *testing.T) { } func TestLegacyQueryContractHistory(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper var otherAddr sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen) @@ -312,7 +312,7 @@ func TestLegacyQueryContractHistory(t *testing.T) { } func TestLegacyQueryCodeList(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) specs := map[string]struct { @@ -329,7 +329,7 @@ func TestLegacyQueryCodeList(t *testing.T) { for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper for _, codeID := range spec.codeIDs { diff --git a/x/wasm/keeper/msg_dispatcher.go b/x/wasm/keeper/msg_dispatcher.go index a3e7e3a14..59a836fa5 100644 --- a/x/wasm/keeper/msg_dispatcher.go +++ b/x/wasm/keeper/msg_dispatcher.go @@ -1,7 +1,9 @@ package keeper import ( + "bytes" "fmt" + "sort" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -107,6 +109,16 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk commit() filteredEvents = filterEvents(append(em.Events(), events...)) ctx.EventManager().EmitEvents(filteredEvents) + if msg.Msg.Wasm == nil { + filteredEvents = []sdk.Event{} + } else { + for _, e := range filteredEvents { + attributes := e.Attributes + sort.SliceStable(attributes, func(i, j int) bool { + return bytes.Compare(attributes[i].Key, attributes[j].Key) < 0 + }) + } + } } // on failure, revert state from sandbox, and ignore events (just skip doing the above) // we only callback if requested. Short-circuit here the cases we don't want to diff --git a/x/wasm/keeper/msg_dispatcher_test.go b/x/wasm/keeper/msg_dispatcher_test.go index 529a208ff..e514ae411 100644 --- a/x/wasm/keeper/msg_dispatcher_test.go +++ b/x/wasm/keeper/msg_dispatcher_test.go @@ -296,8 +296,9 @@ func TestDispatchSubmessages(t *testing.T) { expCommits: []bool{true}, expEvents: []sdk.Event{sdk.NewEvent("execute", sdk.NewAttribute("foo", "bar"))}, }, - "reply gets proper events": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways}}, + "wasm reply gets proper events": { + // put fake wasmmsg in here to show where it comes from + msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, 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 != "" { @@ -343,6 +344,48 @@ func TestDispatchSubmessages(t *testing.T) { sdk.NewEvent("wasm-reply"), }, }, + "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{}}}}, + 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) + } + res := reply.Result.Ok + + // ensure the input events are what we expect + // I didn't use require.Equal() to act more like a contract... but maybe that would be better + if len(res.Events) != 0 { + return nil, errors.New("events not filtered out") + } + + // let's add a custom event here and see if it makes it out + ctx.EventManager().EmitEvent(sdk.NewEvent("stargate-reply")) + + // update data from what we got in + return res.Data, nil + }, + }, + msgHandler: &wasmtesting.MockMessageHandler{ + DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + events = []sdk.Event{ + // this is filtered out + sdk.NewEvent("message", sdk.NewAttribute("stargate", "something-something")), + // we still emit this to the client, but not the contract + sdk.NewEvent("non-determinstic"), + } + return events, [][]byte{[]byte("subData")}, nil + }, + }, + expData: []byte("subData"), + expCommits: []bool{true}, + expEvents: []sdk.Event{ + sdk.NewEvent("non-determinstic"), + // the event from reply is also exposed + sdk.NewEvent("stargate-reply"), + }, + }, } for name, spec := range specs { t.Run(name, func(t *testing.T) { diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index 1c45ff52e..d3051f430 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -32,16 +32,18 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), )) - codeID, err := m.keeper.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission) + codeID, checksum, err := m.keeper.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission) if err != nil { return nil, err } return &types.MsgStoreCodeResponse{ - CodeID: codeID, + CodeID: codeID, + Checksum: checksum, }, nil } +// InstantiateContract instantiate a new contract with classic sequence based address generation func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInstantiateContract) (*types.MsgInstantiateContractResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -73,6 +75,37 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst }, nil } +// InstantiateContract2 instantiate a new contract with predicatable address generated +func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgInstantiateContract2) (*types.MsgInstantiateContract2Response, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + var adminAddr sdk.AccAddress + if msg.Admin != "" { + if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil { + return nil, sdkerrors.Wrap(err, "admin") + } + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + )) + contractAddr, data, err := m.keeper.Instantiate2(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, msg.Salt, msg.FixMsg) + if err != nil { + return nil, err + } + + return &types.MsgInstantiateContract2Response{ + Address: contractAddr.String(), + Data: data, + }, nil +} + func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go new file mode 100644 index 000000000..c4a75dcf9 --- /dev/null +++ b/x/wasm/keeper/msg_server_integration_test.go @@ -0,0 +1,69 @@ +package keeper_test + +import ( + "crypto/sha256" + _ "embed" + "testing" + + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + 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" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +//go:embed testdata/reflect.wasm +var wasmContract []byte + +func TestStoreCode(t *testing.T) { + senderPrivKey := ed25519.GenPrivKey() + pubKey, err := cryptocodec.ToTmPubKeyInterface(senderPrivKey.PubKey()) + require.NoError(t, err) + + senderAddr := senderPrivKey.PubKey().Address().Bytes() + acc := authtypes.NewBaseAccount(senderAddr, senderPrivKey.PubKey(), 0, 0) + amount, ok := sdk.NewIntFromString("10000000000000000000") + require.True(t, ok) + + balance := banktypes.Balance{ + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amount)), + } + validator := tmtypes.NewValidator(pubKey, 1) + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + + wasmApp := app.SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, nil, balance) + + ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{}) + _, _, sender := testdata.KeyTestPubAddr() + msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) { + m.WASMByteCode = wasmContract + m.Sender = sender.String() + }) + + // when + rsp, err := wasmApp.MsgServiceRouter().Handler(msg)(ctx, msg) + + // then + require.NoError(t, err) + var result types.MsgStoreCodeResponse + require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result)) + assert.Equal(t, uint64(1), result.CodeID) + expHash := sha256.Sum256(wasmContract) + assert.Equal(t, expHash[:], result.Checksum) + // and + info := wasmApp.WasmKeeper.GetCodeInfo(ctx, 1) + assert.NotNil(t, info) + assert.Equal(t, expHash[:], info.CodeHash) + assert.Equal(t, sender.String(), info.Creator) + assert.Equal(t, types.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig) +} diff --git a/x/wasm/keeper/options.go b/x/wasm/keeper/options.go index c3d9d1248..cc5547f22 100644 --- a/x/wasm/keeper/options.go +++ b/x/wasm/keeper/options.go @@ -2,7 +2,9 @@ package keeper import ( "fmt" + "reflect" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/prometheus/client_golang/prometheus" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -89,11 +91,25 @@ func WithMessageEncoders(x *MessageEncoders) Option { // WithCoinTransferrer is an optional constructor parameter to set a custom coin transferrer func WithCoinTransferrer(x CoinTransferrer) Option { + if x == nil { + panic("must not be nil") + } return optsFn(func(k *Keeper) { k.bank = x }) } +// WithAccountPruner is an optional constructor parameter to set a custom type that handles balances and data cleanup +// for accounts pruned on contract instantiate +func WithAccountPruner(x AccountPruner) Option { + if x == nil { + panic("must not be nil") + } + return optsFn(func(k *Keeper) { + k.accountPruner = x + }) +} + func WithVMCacheMetrics(r prometheus.Registerer) Option { return optsFn(func(k *Keeper) { NewWasmVMMetricsCollector(k.wasmVM).Register(r) @@ -104,6 +120,9 @@ func WithVMCacheMetrics(r prometheus.Registerer) Option { // When the "gas multiplier" for wasmvm gas conversion is modified inside the new register, // make sure to also use `WithApiCosts` option for non default values func WithGasRegister(x GasRegister) Option { + if x == nil { + panic("must not be nil") + } return optsFn(func(k *Keeper) { k.gasRegister = x }) @@ -123,3 +142,29 @@ func WithMaxQueryStackSize(m uint32) Option { k.maxQueryStackSize = m }) } + +// WithAcceptedAccountTypesOnContractInstantiation sets the accepted account types. Account types of this list won't be overwritten or cause a failure +// 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 { + m := asTypeMap(accts) + return optsFn(func(k *Keeper) { + k.acceptedAccountTypes = m + }) +} + +func asTypeMap(accts []authtypes.AccountI) map[reflect.Type]struct{} { + m := make(map[reflect.Type]struct{}, len(accts)) + for _, a := range accts { + if a == nil { + panic(types.ErrEmpty.Wrap("address")) + } + at := reflect.TypeOf(a) + if _, exists := m[at]; exists { + panic(types.ErrDuplicate.Wrapf("%T", a)) + } + m[at] = struct{}{} + } + return m +} diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go index 6e50c7ba9..29d2f9bd2 100644 --- a/x/wasm/keeper/options_test.go +++ b/x/wasm/keeper/options_test.go @@ -1,9 +1,13 @@ package keeper import ( + "reflect" "testing" 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" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -81,10 +85,26 @@ func TestConstructorOptions(t *testing.T) { assert.IsType(t, uint32(1), k.maxQueryStackSize) }, }, + "accepted account types": { + srcOpt: WithAcceptedAccountTypesOnContractInstantiation(&authtypes.BaseAccount{}, &vestingtypes.ContinuousVestingAccount{}), + verify: func(t *testing.T, k Keeper) { + exp := map[reflect.Type]struct{}{ + reflect.TypeOf(&authtypes.BaseAccount{}): {}, + reflect.TypeOf(&vestingtypes.ContinuousVestingAccount{}): {}, + } + assert.Equal(t, exp, k.acceptedAccountTypes) + }, + }, + "account pruner": { + srcOpt: WithAccountPruner(VestingCoinBurner{}), + verify: func(t *testing.T, k Keeper) { + assert.Equal(t, VestingCoinBurner{}, k.accountPruner) + }, + }, } for name, spec := range specs { t.Run(name, func(t *testing.T) { - k := NewKeeper(nil, nil, paramtypes.NewSubspace(nil, nil, nil, nil, ""), authkeeper.AccountKeeper{}, nil, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), SupportedFeatures, spec.srcOpt) + k := NewKeeper(nil, nil, paramtypes.NewSubspace(nil, nil, nil, nil, ""), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, spec.srcOpt) spec.verify(t, k) }) } diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go index 9da330ce0..f0a3aa857 100644 --- a/x/wasm/keeper/proposal_handler.go +++ b/x/wasm/keeper/proposal_handler.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -64,10 +64,15 @@ func handleStoreCodeProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types if err != nil { return sdkerrors.Wrap(err, "run as address") } - codeID, err := k.Create(ctx, runAsAddr, p.WASMByteCode, p.InstantiatePermission) + codeID, _, err := k.Create(ctx, runAsAddr, p.WASMByteCode, p.InstantiatePermission) if err != nil { return err } + + // if code should not be pinned return earlier + if p.UnpinCode { + return nil + } return k.PinCode(ctx, codeID) } @@ -107,9 +112,7 @@ func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.M if err != nil { return sdkerrors.Wrap(err, "contract") } - if err != nil { - return sdkerrors.Wrap(err, "run as address") - } + // runAs is not used if this is permissioned, so just put any valid address there (second contractAddr) data, err := k.Migrate(ctx, contractAddr, contractAddr, p.CodeID, p.Msg) if err != nil { @@ -229,8 +232,9 @@ func handleUpdateInstantiateConfigProposal(ctx sdk.Context, k types.ContractOpsK return err } + var emptyCaller sdk.AccAddress for _, accessConfigUpdate := range p.AccessConfigUpdates { - if err := k.SetAccessConfig(ctx, accessConfigUpdate.CodeID, accessConfigUpdate.InstantiatePermission); err != nil { + if err := k.SetAccessConfig(ctx, accessConfigUpdate.CodeID, emptyCaller, accessConfigUpdate.InstantiatePermission); err != nil { return sdkerrors.Wrapf(err, "code id: %d", accessConfigUpdate.CodeID) } } diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go index 3d5097b50..04821ac23 100644 --- a/x/wasm/keeper/proposal_integration_test.go +++ b/x/wasm/keeper/proposal_integration_test.go @@ -5,59 +5,80 @@ import ( "encoding/hex" "encoding/json" "errors" - "io/ioutil" + "os" "testing" - "github.com/cosmos/cosmos-sdk/x/params/client/utils" - wasmvm "github.com/CosmWasm/wasmvm" - - "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/params/client/utils" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func TestStoreCodeProposal(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, "staking") + parentCtx, keepers := CreateTestInput(t, false, "staking") govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper - wasmKeeper.SetParams(ctx, types.Params{ + wasmKeeper.SetParams(parentCtx, types.Params{ CodeUploadAccess: types.AllowNobody, InstantiateDefaultPermission: types.AccessTypeNobody, }) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - myActorAddress := RandomBech32AccountAddress(t) + specs := map[string]struct { + codeID int64 + unpinCode bool + }{ + "upload with pinning (default)": { + unpinCode: false, + }, + "upload with code unpin": { + unpinCode: true, + }, + } - src := types.StoreCodeProposalFixture(func(p *types.StoreCodeProposal) { - p.RunAs = myActorAddress - p.WASMByteCode = wasmCode - }) + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + ctx, _ := parentCtx.CacheContext() + myActorAddress := RandomBech32AccountAddress(t) + govAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + src := types.StoreCodeProposalFixture(func(p *types.StoreCodeProposal) { + p.RunAs = myActorAddress + p.WASMByteCode = wasmCode + p.UnpinCode = spec.unpinCode + }) - // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, src) - require.NoError(t, err) + msgContent, err := govv1.NewLegacyContent(src, govAddress) + require.NoError(t, err) - // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx, storedProposal.GetContent()) - require.NoError(t, err) + em := sdk.NewEventManager() - // then - cInfo := wasmKeeper.GetCodeInfo(ctx, 1) - require.NotNil(t, cInfo) - assert.Equal(t, myActorAddress, cInfo.Creator) - assert.True(t, wasmKeeper.IsPinnedCode(ctx, 1)) + // when stored + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing123") + require.NoError(t, err) - storedCode, err := wasmKeeper.GetByteCode(ctx, 1) - require.NoError(t, err) - assert.Equal(t, wasmCode, storedCode) + // and proposal execute + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx.WithEventManager(em), src) + require.NoError(t, err) + + // then + cInfo := wasmKeeper.GetCodeInfo(ctx, 1) + require.NotNil(t, cInfo) + assert.Equal(t, myActorAddress, cInfo.Creator) + assert.Equal(t, !spec.unpinCode, wasmKeeper.IsPinnedCode(ctx, 1)) + + storedCode, err := wasmKeeper.GetByteCode(ctx, 1) + require.NoError(t, err) + assert.Equal(t, wasmCode, storedCode) + }) + } } func TestInstantiateProposal(t *testing.T) { @@ -68,7 +89,7 @@ func TestInstantiateProposal(t *testing.T) { InstantiateDefaultPermission: types.AccessTypeNobody, }) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) require.NoError(t, wasmKeeper.importCode(ctx, 1, @@ -88,13 +109,16 @@ func TestInstantiateProposal(t *testing.T) { }) em := sdk.NewEventManager() + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(src, myActorAddress) + // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, src) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx.WithEventManager(em), storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx.WithEventManager(em), src) require.NoError(t, err) // then @@ -131,7 +155,7 @@ func TestInstantiateProposal_NoAdmin(t *testing.T) { InstantiateDefaultPermission: types.AccessTypeNobody, }) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) require.NoError(t, wasmKeeper.importCode(ctx, 1, @@ -148,7 +172,11 @@ func TestInstantiateProposal_NoAdmin(t *testing.T) { p.Admin = "invalid" p.Label = "testing" }) - _, err = govKeeper.SubmitProposal(ctx, src) + msgContent, err := govv1.NewLegacyContent(src, oneAddress.String()) + require.NoError(t, err) + + // when stored + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.Error(t, err) // test with no admin @@ -159,14 +187,16 @@ func TestInstantiateProposal_NoAdmin(t *testing.T) { p.Label = "testing" }) em := sdk.NewEventManager() + msgContent, err = govv1.NewLegacyContent(src, oneAddress.String()) + require.NoError(t, err) // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, src) - require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") + require.Error(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx.WithEventManager(em), storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx.WithEventManager(em), src) require.NoError(t, err) // then @@ -203,7 +233,7 @@ func TestMigrateProposal(t *testing.T) { InstantiateDefaultPermission: types.AccessTypeNobody, }) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) codeInfoFixture := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)) @@ -211,9 +241,9 @@ func TestMigrateProposal(t *testing.T) { require.NoError(t, wasmKeeper.importCode(ctx, 2, codeInfoFixture, wasmCode)) var ( - anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, types.ContractAddrLen) - otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen) - contractAddr = BuildContractAddress(1, 1) + anyAddress = DeterministicAccountAddress(t, 1) + otherAddress = DeterministicAccountAddress(t, 2) + contractAddr = BuildContractAddressClassic(1, 1) ) contractInfoFixture := types.ContractInfoFixture(func(c *types.ContractInfo) { @@ -241,13 +271,16 @@ func TestMigrateProposal(t *testing.T) { em := sdk.NewEventManager() + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&src, myActorAddress) + // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, &src) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx.WithEventManager(em), storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx.WithEventManager(em), &src) require.NoError(t, err) // then @@ -302,10 +335,11 @@ func TestExecuteProposal(t *testing.T) { RunAs: exampleContract.BeneficiaryAddr.String(), } - em := sdk.NewEventManager() + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&badSrc, myActorAddress) // fails on store - this doesn't have permission - storedProposal, err := govKeeper.SubmitProposal(ctx, &badSrc) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.Error(t, err) // balance should not change bal = bankKeeper.GetBalance(ctx, contractAddr, "denom") @@ -320,15 +354,16 @@ func TestExecuteProposal(t *testing.T) { RunAs: exampleContract.VerifierAddr.String(), } - em = sdk.NewEventManager() + myActorAddress = govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err = govv1.NewLegacyContent(&src, myActorAddress) // when stored - storedProposal, err = govKeeper.SubmitProposal(ctx, &src) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx.WithEventManager(em), storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx, &src) require.NoError(t, err) // balance should be empty (proper release) @@ -371,15 +406,16 @@ func TestSudoProposal(t *testing.T) { Msg: stealMsgBz, } - em := sdk.NewEventManager() + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&src, myActorAddress) // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, &src) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx.WithEventManager(em), storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(src.ProposalRoute()) + err = handler(ctx, &src) require.NoError(t, err) // balance should be empty (and verifier richer) @@ -392,14 +428,14 @@ func TestSudoProposal(t *testing.T) { func TestAdminProposals(t *testing.T) { var ( otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen) - contractAddr = BuildContractAddress(1, 1) + contractAddr = BuildContractAddressClassic(1, 1) ) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) specs := map[string]struct { state types.ContractInfo - srcProposal govtypes.Content + srcProposal govv1beta1.Content expAdmin sdk.AccAddress }{ "update with different admin": { @@ -459,12 +495,15 @@ func TestAdminProposals(t *testing.T) { require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{})) // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, spec.srcProposal) + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(spec.srcProposal, myActorAddress) + + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and execute proposal - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx, storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(spec.srcProposal.ProposalRoute()) + err = handler(ctx, spec.srcProposal) require.NoError(t, err) // then @@ -550,18 +589,21 @@ func TestUpdateParamsProposal(t *testing.T) { var jsonProposal utils.ParamChangeProposalJSON require.NoError(t, legacyAmino.UnmarshalJSON(bz, &jsonProposal)) - proposal := proposal.ParameterChangeProposal{ + prop := proposal.ParameterChangeProposal{ Title: jsonProposal.Title, Description: jsonProposal.Description, Changes: jsonProposal.Changes.ToParamChanges(), } // when stored - storedProposal, err := govKeeper.SubmitProposal(ctx, &proposal) + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&prop, myActorAddress) + + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") require.NoError(t, err) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - err = handler(ctx, storedProposal.GetContent()) + handler := govKeeper.LegacyRouter().GetRoute(prop.ProposalRoute()) + err = handler(ctx, &prop) require.NoError(t, err) // then @@ -632,24 +674,26 @@ func TestPinCodesProposal(t *testing.T) { gotPinnedChecksums = nil ctx, _ := parentCtx.CacheContext() mock.PinFn = spec.mockFn - proposal := types.PinCodesProposal{ + prop := types.PinCodesProposal{ Title: "Foo", Description: "Bar", CodeIDs: spec.srcCodeIDs, } // when stored - storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal) + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&prop, myActorAddress) + + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") if spec.expErr { - require.Error(t, gotErr) + require.Error(t, err) return } - require.NoError(t, gotErr) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - gotErr = handler(ctx, storedProposal.GetContent()) - require.NoError(t, gotErr) + handler := govKeeper.LegacyRouter().GetRoute(prop.ProposalRoute()) + err = handler(ctx, &prop) + require.NoError(t, err) // then for i := range spec.srcCodeIDs { @@ -720,24 +764,26 @@ func TestUnpinCodesProposal(t *testing.T) { gotUnpinnedChecksums = nil ctx, _ := parentCtx.CacheContext() mock.UnpinFn = spec.mockFn - proposal := types.UnpinCodesProposal{ + prop := types.UnpinCodesProposal{ Title: "Foo", Description: "Bar", CodeIDs: spec.srcCodeIDs, } // when stored - storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal) + myActorAddress := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + msgContent, err := govv1.NewLegacyContent(&prop, myActorAddress) + + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "testing 123") if spec.expErr { - require.Error(t, gotErr) + require.Error(t, err) return } - require.NoError(t, gotErr) // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - gotErr = handler(ctx, storedProposal.GetContent()) - require.NoError(t, gotErr) + handler := govKeeper.LegacyRouter().GetRoute(prop.ProposalRoute()) + err = handler(ctx, &prop) + require.NoError(t, err) // then for i := range spec.srcCodeIDs { @@ -747,97 +793,3 @@ func TestUnpinCodesProposal(t *testing.T) { }) } } - -func TestUpdateInstantiateConfigProposal(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, "staking") - govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper - - mock := wasmtesting.MockWasmer{ - CreateFn: wasmtesting.NoOpCreateFn, - AnalyzeCodeFn: wasmtesting.WithoutIBCAnalyzeFn, - } - anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz") - require.NoError(t, err) - - withAddressAccessConfig := types.AccessTypeOnlyAddress.With(anyAddress) - var ( - nobody = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &types.AllowNobody) - everybody = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &types.AllowEverybody) - withAddress = StoreRandomContractWithAccessConfig(t, ctx, keepers, &mock, &withAddressAccessConfig) - ) - - specs := map[string]struct { - accessConfigUpdates []types.AccessConfigUpdate - expErr bool - }{ - "update one": { - accessConfigUpdates: []types.AccessConfigUpdate{ - {CodeID: nobody.CodeID, InstantiatePermission: types.AllowEverybody}, - }, - }, - "update multiple": { - accessConfigUpdates: []types.AccessConfigUpdate{ - {CodeID: everybody.CodeID, InstantiatePermission: types.AllowNobody}, - {CodeID: nobody.CodeID, InstantiatePermission: withAddressAccessConfig}, - {CodeID: withAddress.CodeID, InstantiatePermission: types.AllowEverybody}, - }, - }, - "update same code id": { - accessConfigUpdates: []types.AccessConfigUpdate{ - {CodeID: everybody.CodeID, InstantiatePermission: types.AllowNobody}, - {CodeID: everybody.CodeID, InstantiatePermission: types.AllowEverybody}, - }, - expErr: true, - }, - "update non existing code id": { - accessConfigUpdates: []types.AccessConfigUpdate{ - {CodeID: 100, InstantiatePermission: types.AllowNobody}, - {CodeID: everybody.CodeID, InstantiatePermission: types.AllowEverybody}, - }, - expErr: true, - }, - "update empty list": { - accessConfigUpdates: make([]types.AccessConfigUpdate, 0), - expErr: true, - }, - } - parentCtx := ctx - for msg, spec := range specs { - t.Run(msg, func(t *testing.T) { - ctx, _ := parentCtx.CacheContext() - - updates := make([]types.AccessConfigUpdate, 0) - for _, cu := range spec.accessConfigUpdates { - updates = append(updates, types.AccessConfigUpdate{ - CodeID: cu.CodeID, - InstantiatePermission: cu.InstantiatePermission, - }) - } - - proposal := types.UpdateInstantiateConfigProposal{ - Title: "Foo", - Description: "Bar", - AccessConfigUpdates: updates, - } - - // when stored - storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal) - if spec.expErr { - require.Error(t, gotErr) - return - } - require.NoError(t, gotErr) - - // and proposal execute - handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute()) - gotErr = handler(ctx, storedProposal.GetContent()) - require.NoError(t, gotErr) - - // then - for i := range spec.accessConfigUpdates { - c := wasmKeeper.GetCodeInfo(ctx, spec.accessConfigUpdates[i].CodeID) - require.Equal(t, spec.accessConfigUpdates[i].InstantiatePermission, c.InstantiateConfig) - } - }) - } -} diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 6c4e45430..ac59db6e7 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -10,6 +10,7 @@ import ( "google.golang.org/grpc/status" "github.com/cosmos/cosmos-sdk/store/prefix" + 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/types/query" @@ -21,13 +22,13 @@ var _ types.QueryServer = &grpcQuerier{} type grpcQuerier struct { cdc codec.Codec - storeKey sdk.StoreKey + storeKey storetypes.StoreKey keeper types.ViewKeeper queryGasLimit sdk.Gas } // NewGrpcQuerier constructor -func NewGrpcQuerier(cdc codec.Codec, storeKey sdk.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *grpcQuerier { //nolint:revive +func NewGrpcQuerier(cdc codec.Codec, storeKey storetypes.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *grpcQuerier { //nolint:revive return &grpcQuerier{cdc: cdc, storeKey: storeKey, keeper: keeper, queryGasLimit: queryGasLimit} } @@ -311,3 +312,10 @@ func (q grpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesR Pagination: pageRes, }, nil } + +// Params returns params of the module. +func (q grpcQuerier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index f473f52fa..4c1fba6e6 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -5,10 +5,11 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "os" "testing" "time" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -17,7 +18,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkErrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" @@ -27,7 +27,7 @@ import ( ) func TestQueryAllContractState(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers) @@ -114,7 +114,7 @@ func TestQueryAllContractState(t *testing.T) { } func TestQuerySmartContractState(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers) @@ -157,8 +157,8 @@ func TestQuerySmartContractState(t *testing.T) { } func TestQuerySmartContractPanics(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) - contractAddr := BuildContractAddress(1, 1) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + contractAddr := BuildContractAddressClassic(1, 1) keepers.WasmKeeper.storeCodeInfo(ctx, 1, types.CodeInfo{}) keepers.WasmKeeper.storeContractInfo(ctx, contractAddr, &types.ContractInfo{ CodeID: 1, @@ -202,7 +202,7 @@ func TestQuerySmartContractPanics(t *testing.T) { } func TestQueryRawContractState(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers) @@ -257,18 +257,18 @@ func TestQueryRawContractState(t *testing.T) { } func TestQueryContractListByCodeOrdering(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) - anyAddr := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - codeID, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) require.NoError(t, err) _, _, bob := keyPubAddr() @@ -313,7 +313,7 @@ func TestQueryContractListByCodeOrdering(t *testing.T) { } func TestQueryContractHistory(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper var ( @@ -454,10 +454,10 @@ func TestQueryContractHistory(t *testing.T) { } func TestQueryCodeList(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper specs := map[string]struct { @@ -533,7 +533,7 @@ func TestQueryContractInfo(t *testing.T) { contractAddr = RandomAccountAddress(t) anyDate = time.Now().UTC() ) - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) // register an example extension. must be protobuf keepers.EncodingConfig.InterfaceRegistry.RegisterImplementations( (*types.ContractInfoExtension)(nil), @@ -599,7 +599,7 @@ func TestQueryContractInfo(t *testing.T) { } func TestQueryPinnedCodes(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper exampleContract1 := InstantiateHackatomExampleContract(t, ctx, keepers) @@ -655,11 +655,39 @@ func TestQueryPinnedCodes(t *testing.T) { } } +func TestQueryParams(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + keeper := keepers.WasmKeeper + + q := Querier(keeper) + + paramsResponse, err := q.Params(sdk.WrapSDKContext(ctx), &types.QueryParamsRequest{}) + require.NoError(t, err) + require.NotNil(t, paramsResponse) + + defaultParams := types.DefaultParams() + + require.Equal(t, paramsResponse.Params.CodeUploadAccess, defaultParams.CodeUploadAccess) + require.Equal(t, paramsResponse.Params.InstantiateDefaultPermission, defaultParams.InstantiateDefaultPermission) + + keeper.SetParams(ctx, types.Params{ + CodeUploadAccess: types.AllowNobody, + InstantiateDefaultPermission: types.AccessTypeNobody, + }) + + paramsResponse, err = q.Params(sdk.WrapSDKContext(ctx), &types.QueryParamsRequest{}) + require.NoError(t, err) + require.NotNil(t, paramsResponse) + + require.Equal(t, paramsResponse.Params.CodeUploadAccess, types.AllowNobody) + require.Equal(t, paramsResponse.Params.InstantiateDefaultPermission, types.AccessTypeNobody) +} + func TestQueryCodeInfo(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz") @@ -711,10 +739,10 @@ func TestQueryCodeInfo(t *testing.T) { } func TestQueryCodeInfoList(t *testing.T) { - wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - ctx, keepers := CreateTestInput(t, false, SupportedFeatures) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) keeper := keepers.WasmKeeper anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz") diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index b0e095b12..7a0a7528b 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -189,6 +189,16 @@ func BankQuerier(bankKeeper types.BankViewKeeper) func(ctx sdk.Context, request } return json.Marshal(res) } + if request.Supply != nil { + coin := bankKeeper.GetSupply(ctx, request.Supply.Denom) + res := wasmvmtypes.SupplyResponse{ + Amount: wasmvmtypes.Coin{ + Denom: coin.Denom, + Amount: coin.Amount.String(), + }, + } + return json.Marshal(res) + } return nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown BankQuery variant"} } } diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index c58932d67..07de2f345 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -10,7 +10,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -511,10 +511,18 @@ func (m mockWasmQueryKeeper) IsPinnedCode(ctx sdk.Context, codeID uint64) bool { } 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 } +func (m bankKeeperMock) GetSupply(ctx sdk.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 { if m.GetBalanceFn == nil { panic("not expected to be called") diff --git a/x/wasm/keeper/recurse_test.go b/x/wasm/keeper/recurse_test.go index cfb49e0ac..5a16da787 100644 --- a/x/wasm/keeper/recurse_test.go +++ b/x/wasm/keeper/recurse_test.go @@ -45,7 +45,7 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc return realWasmQuerier.HandleQuery(ctx, caller, request) }) } - ctx, keepers := CreateTestInput(t, false, SupportedFeatures, WithQueryHandlerDecorator(countingQuerierDec)) + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithQueryHandlerDecorator(countingQuerierDec)) keeper = keepers.WasmKeeper exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers) return exampleContract.Contract, exampleContract.CreatorAddr, ctx, keeper @@ -91,7 +91,7 @@ func TestGasCostOnQuery(t *testing.T) { Depth: 1, Work: 50, }, - expectedGas: 2*GasWork50 + GasReturnHashed, + expectedGas: 2*GasWork50 + GasReturnHashed + 1, // +1 for rounding }, "recursion 4, some work": { gasLimit: 400_000, @@ -99,7 +99,7 @@ func TestGasCostOnQuery(t *testing.T) { Depth: 4, Work: 50, }, - expectedGas: 5*GasWork50 + 4*GasReturnHashed, + expectedGas: 5*GasWork50 + 4*GasReturnHashed + 1, }, } diff --git a/x/wasm/keeper/reflect_test.go b/x/wasm/keeper/reflect_test.go index 2f89a265c..d6e4f6531 100644 --- a/x/wasm/keeper/reflect_test.go +++ b/x/wasm/keeper/reflect_test.go @@ -2,7 +2,7 @@ package keeper import ( "encoding/json" - "io/ioutil" + "os" "strings" "testing" @@ -35,7 +35,7 @@ func mustParse(t *testing.T, data []byte, res interface{}) { require.NoError(t, err) } -const ReflectFeatures = "staking,mask,stargate" +const ReflectFeatures = "staking,mask,stargate,cosmwasm_1_1" func TestReflectContractSend(t *testing.T) { cdc := MakeEncodingConfig(t).Marshaler @@ -43,18 +43,18 @@ func TestReflectContractSend(t *testing.T) { accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) _, _, bob := keyPubAddr() // upload reflect code - reflectID, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + reflectID, _, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), reflectID) // upload hackatom escrow code - escrowCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + escrowCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - escrowID, err := keeper.Create(ctx, creator, escrowCode, nil) + escrowID, _, err := keeper.Create(ctx, creator, escrowCode, nil) require.NoError(t, err) require.Equal(t, uint64(2), escrowID) @@ -122,12 +122,12 @@ func TestReflectCustomMsg(t *testing.T) { accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) - bob := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + bob := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) _, _, fred := keyPubAddr() // upload code - codeID, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), codeID) @@ -213,10 +213,10 @@ func TestMaskReflectCustomQuery(t *testing.T) { keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), codeID) @@ -262,11 +262,11 @@ func TestReflectStargateQuery(t *testing.T) { funds := sdk.NewCoins(sdk.NewInt64Coin("denom", 320000)) contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000)) - expectedBalance := funds.Sub(contractStart) - creator := keepers.Faucet.NewFundedAccount(ctx, funds...) + expectedBalance := funds.Sub(contractStart...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, funds...) // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), codeID) @@ -298,6 +298,57 @@ func TestReflectStargateQuery(t *testing.T) { assert.Equal(t, simpleBalance.Amount[0].Denom, expectedBalance[0].Denom) } +func TestReflectTotalSupplyQuery(t *testing.T) { + cdc := MakeEncodingConfig(t).Marshaler + ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) + keeper := keepers.WasmKeeper + // upload code + codeID := StoreReflectContract(t, ctx, keepers).CodeID + // creator instantiates a contract and gives it tokens + creator := RandomAccountAddress(t) + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, []byte("{}"), "testing", nil) + require.NoError(t, err) + + currentStakeSupply := keepers.BankKeeper.GetSupply(ctx, "stake") + require.NotEmpty(t, currentStakeSupply.Amount) // ensure we have real data + specs := map[string]struct { + denom string + expAmount wasmvmtypes.Coin + }{ + "known denom": { + denom: "stake", + expAmount: ConvertSdkCoinToWasmCoin(currentStakeSupply), + }, + "unknown denom": { + denom: "unknown", + expAmount: wasmvmtypes.Coin{Denom: "unknown", Amount: "0"}, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + // when + queryBz := mustMarshal(t, testdata.ReflectQueryMsg{ + Chain: &testdata.ChainQuery{ + Request: &wasmvmtypes.QueryRequest{ + Bank: &wasmvmtypes.BankQuery{ + Supply: &wasmvmtypes.SupplyQuery{Denom: spec.denom}, + }, + }, + }, + }) + simpleRes, err := keeper.QuerySmart(ctx, contractAddr, queryBz) + + // then + require.NoError(t, err) + var rsp testdata.ChainResponse + mustParse(t, simpleRes, &rsp) + var supplyRsp wasmvmtypes.SupplyResponse + mustParse(t, rsp.Data, &supplyRsp) + assert.Equal(t, spec.expAmount, supplyRsp.Amount, spec.expAmount) + }) + } +} + func TestReflectInvalidStargateQuery(t *testing.T) { cdc := MakeEncodingConfig(t).Marshaler ctx, keepers := CreateTestInput(t, false, ReflectFeatures, WithMessageEncoders(reflectEncoders(cdc)), WithQueryPlugins(reflectPlugins())) @@ -305,10 +356,10 @@ func TestReflectInvalidStargateQuery(t *testing.T) { funds := sdk.NewCoins(sdk.NewInt64Coin("denom", 320000)) contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000)) - creator := keepers.Faucet.NewFundedAccount(ctx, funds...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, funds...) // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), codeID) @@ -383,10 +434,10 @@ func TestMaskReflectWasmQueries(t *testing.T) { keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) // upload reflect code - reflectID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + reflectID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), reflectID) @@ -453,10 +504,10 @@ func TestWasmRawQueryWithNil(t *testing.T) { keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) // upload reflect code - reflectID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + reflectID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), reflectID) diff --git a/x/wasm/keeper/relay_test.go b/x/wasm/keeper/relay_test.go index dd9c3da23..a1d2819e5 100644 --- a/x/wasm/keeper/relay_test.go +++ b/x/wasm/keeper/relay_test.go @@ -20,7 +20,7 @@ func TestOnOpenChannel(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 @@ -90,7 +90,7 @@ func TestOnConnectChannel(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 @@ -201,7 +201,7 @@ func TestOnCloseChannel(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 @@ -311,7 +311,7 @@ func TestOnRecvPacket(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 const storageCosts = sdk.Gas(2903) @@ -473,7 +473,7 @@ func TestOnAckPacket(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 @@ -578,7 +578,7 @@ func TestOnTimeoutPacket(t *testing.T) { var m wasmtesting.MockWasmer wasmtesting.MakeIBCInstantiable(&m) messenger := &wasmtesting.MockMessageHandler{} - parentCtx, keepers := CreateTestInput(t, false, SupportedFeatures, WithMessageHandler(messenger)) + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithMessageHandler(messenger)) example := SeedNewContractInstance(t, parentCtx, keepers, &m) const myContractGas = 40 diff --git a/x/wasm/keeper/snapshotter.go b/x/wasm/keeper/snapshotter.go index a781cb07a..710112730 100644 --- a/x/wasm/keeper/snapshotter.go +++ b/x/wasm/keeper/snapshotter.go @@ -98,7 +98,18 @@ func (ws *WasmSnapshotter) Restore( return snapshot.SnapshotItem{}, snapshot.ErrUnknownFormat } +func (ws *WasmSnapshotter) PruneSnapshotHeight(height int64) { + // nothing to do +} + +func (ws *WasmSnapshotter) SetSnapshotInterval(snapshotInterval uint64) { + // +} + func restoreV1(ctx sdk.Context, k *Keeper, compressedCode []byte) error { + if !ioutils.IsGzip(compressedCode) { + return types.ErrInvalid.Wrap("not a gzip") + } wasmCode, err := ioutils.Uncompress(compressedCode, uint64(types.MaxWasmSize)) if err != nil { return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) diff --git a/x/wasm/keeper/snapshotter_integration_test.go b/x/wasm/keeper/snapshotter_integration_test.go index 49f2ca6ba..f100a1698 100644 --- a/x/wasm/keeper/snapshotter_integration_test.go +++ b/x/wasm/keeper/snapshotter_integration_test.go @@ -2,7 +2,7 @@ package keeper_test import ( "crypto/sha256" - "io/ioutil" + "os" "testing" "time" @@ -53,13 +53,12 @@ func TestSnapshotter(t *testing.T) { srcCodeIDToChecksum := make(map[uint64][]byte, len(spec.wasmFiles)) for i, v := range spec.wasmFiles { - wasmCode, err := ioutil.ReadFile(v) + wasmCode, err := os.ReadFile(v) require.NoError(t, err) - codeID, err := contractKeeper.Create(ctx, genesisAddr, wasmCode, nil) + codeID, checksum, err := contractKeeper.Create(ctx, genesisAddr, wasmCode, nil) require.NoError(t, err) require.Equal(t, uint64(i+1), codeID) - hash := sha256.Sum256(wasmCode) - srcCodeIDToChecksum[codeID] = hash[:] + srcCodeIDToChecksum[codeID] = checksum } // create snapshot srcWasmApp.Commit() diff --git a/x/wasm/keeper/staking_test.go b/x/wasm/keeper/staking_test.go index b6d719f13..b889a5697 100644 --- a/x/wasm/keeper/staking_test.go +++ b/x/wasm/keeper/staking_test.go @@ -2,7 +2,7 @@ package keeper import ( "encoding/json" - "io/ioutil" + "os" "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" @@ -93,7 +93,7 @@ type InvestmentResponse struct { } func TestInitializeStaking(t *testing.T) { - ctx, k := CreateTestInput(t, false, SupportedFeatures) + ctx, k := CreateTestInput(t, false, AvailableCapabilities) accKeeper, stakingKeeper, keeper, bankKeeper := k.AccountKeeper, k.StakingKeeper, k.ContractKeeper, k.BankKeeper valAddr := addValidator(t, ctx, stakingKeeper, k.Faucet, sdk.NewInt64Coin("stake", 1234567)) @@ -103,12 +103,12 @@ func TestInitializeStaking(t *testing.T) { assert.Equal(t, v.GetDelegatorShares(), sdk.NewDec(1234567)) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000), sdk.NewInt64Coin("stake", 500000)) - creator := k.Faucet.NewFundedAccount(ctx, deposit...) + creator := k.Faucet.NewFundedRandomAccount(ctx, deposit...) // upload staking derivates code - stakingCode, err := ioutil.ReadFile("./testdata/staking.wasm") + stakingCode, err := os.ReadFile("./testdata/staking.wasm") require.NoError(t, err) - stakingID, err := keeper.Create(ctx, creator, stakingCode, nil) + stakingID, _, err := keeper.Create(ctx, creator, stakingCode, nil) require.NoError(t, err) require.Equal(t, uint64(1), stakingID) @@ -168,7 +168,7 @@ type initInfo struct { } func initializeStaking(t *testing.T) initInfo { - ctx, k := CreateTestInput(t, false, SupportedFeatures) + 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)) @@ -186,12 +186,12 @@ func initializeStaking(t *testing.T) initInfo { assert.Equal(t, v.Status, stakingtypes.Bonded) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000), sdk.NewInt64Coin("stake", 500000)) - creator := k.Faucet.NewFundedAccount(ctx, deposit...) + creator := k.Faucet.NewFundedRandomAccount(ctx, deposit...) // upload staking derivates code - stakingCode, err := ioutil.ReadFile("./testdata/staking.wasm") + stakingCode, err := os.ReadFile("./testdata/staking.wasm") require.NoError(t, err) - stakingID, err := k.ContractKeeper.Create(ctx, creator, stakingCode, nil) + stakingID, _, err := k.ContractKeeper.Create(ctx, creator, stakingCode, nil) require.NoError(t, err) require.Equal(t, uint64(1), stakingID) @@ -239,7 +239,7 @@ func TestBonding(t *testing.T) { // bob has 160k, putting 80k into the contract full := sdk.NewCoins(sdk.NewInt64Coin("stake", 160000)) funds := sdk.NewCoins(sdk.NewInt64Coin("stake", 80000)) - bob := initInfo.faucet.NewFundedAccount(ctx, full...) + bob := initInfo.faucet.NewFundedRandomAccount(ctx, full...) // check contract state before assertBalance(t, ctx, keeper, contractAddr, bob, "0") @@ -287,7 +287,7 @@ func TestUnbonding(t *testing.T) { // bob has 160k, putting 80k into the contract full := sdk.NewCoins(sdk.NewInt64Coin("stake", 160000)) funds := sdk.NewCoins(sdk.NewInt64Coin("stake", 80000)) - bob := initInfo.faucet.NewFundedAccount(ctx, full...) + bob := initInfo.faucet.NewFundedRandomAccount(ctx, full...) bond := StakingHandleMsg{ Bond: &struct{}{}, @@ -354,7 +354,7 @@ func TestReinvest(t *testing.T) { // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) funds := sdk.NewCoins(sdk.NewInt64Coin("stake", 200000)) - bob := initInfo.faucet.NewFundedAccount(ctx, full...) + bob := initInfo.faucet.NewFundedRandomAccount(ctx, full...) // we will stake 200k to a validator with 1M self-bond // this means we should get 1/6 of the rewards @@ -422,7 +422,7 @@ func TestQueryStakingInfo(t *testing.T) { // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) funds := sdk.NewCoins(sdk.NewInt64Coin("stake", 200000)) - bob := initInfo.faucet.NewFundedAccount(ctx, full...) + bob := initInfo.faucet.NewFundedRandomAccount(ctx, full...) // we will stake 200k to a validator with 1M self-bond // this means we should get 1/6 of the rewards @@ -444,10 +444,10 @@ func TestQueryStakingInfo(t *testing.T) { // STEP 2: Prepare the mask contract deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) - creator := initInfo.faucet.NewFundedAccount(ctx, deposit...) + creator := initInfo.faucet.NewFundedRandomAccount(ctx, deposit...) // upload mask code - maskID, err := initInfo.contractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + maskID, _, err := initInfo.contractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(2), maskID) @@ -599,7 +599,7 @@ func TestQueryStakingPlugin(t *testing.T) { // full is 2x funds, 1x goes to the contract, other stays on his wallet full := sdk.NewCoins(sdk.NewInt64Coin("stake", 400000)) funds := sdk.NewCoins(sdk.NewInt64Coin("stake", 200000)) - bob := initInfo.faucet.NewFundedAccount(ctx, full...) + bob := initInfo.faucet.NewFundedRandomAccount(ctx, full...) // we will stake 200k to a validator with 1M self-bond // this means we should get 1/6 of the rewards @@ -652,7 +652,7 @@ func TestQueryStakingPlugin(t *testing.T) { // 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 { - owner := faucet.NewFundedAccount(ctx, value) + owner := faucet.NewFundedRandomAccount(ctx, value) privKey := secp256k1.GenPrivKey() pubKey := privKey.PubKey() @@ -676,8 +676,8 @@ func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper stakingkeeper.Kee Value: value, } - h := staking.NewHandler(stakingKeeper) - _, err = h(ctx, &msg) + h := stakingkeeper.NewMsgServerImpl(stakingKeeper) + _, err = h.CreateValidator(ctx, &msg) require.NoError(t, err) return addr } diff --git a/x/wasm/keeper/submsg_test.go b/x/wasm/keeper/submsg_test.go index 9d1904fa7..9f91190af 100644 --- a/x/wasm/keeper/submsg_test.go +++ b/x/wasm/keeper/submsg_test.go @@ -3,7 +3,7 @@ package keeper import ( "encoding/json" "fmt" - "io/ioutil" + "os" "strconv" "testing" @@ -26,12 +26,12 @@ func TestDispatchSubMsgSuccessCase(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) - creatorBalance := deposit.Sub(contractStart) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + creatorBalance := deposit.Sub(contractStart...) _, _, fred := keyPubAddr() // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) require.Equal(t, uint64(1), codeID) @@ -94,15 +94,8 @@ func TestDispatchSubMsgSuccessCase(t *testing.T) { require.NotNil(t, res.Result.Ok) sub := res.Result.Ok assert.Empty(t, sub.Data) - require.Len(t, sub.Events, 3) - assert.Equal(t, "coin_spent", sub.Events[0].Type) - assert.Equal(t, "coin_received", sub.Events[1].Type) - transfer := sub.Events[2] - assert.Equal(t, "transfer", transfer.Type) - assert.Equal(t, wasmvmtypes.EventAttribute{ - Key: "recipient", - Value: fred.String(), - }, transfer.Attributes[0]) + // as of v0.28.0 we strip out all events that don't come from wasm contracts. can't trust the sdk. + require.Len(t, sub.Events, 0) } func TestDispatchSubMsgErrorHandling(t *testing.T) { @@ -117,16 +110,16 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { ctx = ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter()) keeper := keepers.WasmKeeper contractStart := sdk.NewCoins(sdk.NewInt64Coin(fundedDenom, int64(fundedAmount))) - uploader := keepers.Faucet.NewFundedAccount(ctx, contractStart.Add(contractStart...)...) + uploader := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart.Add(contractStart...)...) // upload code - reflectID, err := keepers.ContractKeeper.Create(ctx, uploader, testdata.ReflectContractWasm(), nil) + reflectID, _, err := keepers.ContractKeeper.Create(ctx, uploader, testdata.ReflectContractWasm(), nil) require.NoError(t, err) // create hackatom contract for testing (for infinite loop) - hackatomCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") + hackatomCode, err := os.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) - hackatomID, err := keepers.ContractKeeper.Create(ctx, uploader, hackatomCode, nil) + hackatomID, _, err := keepers.ContractKeeper.Create(ctx, uploader, hackatomCode, nil) require.NoError(t, err) _, _, bob := keyPubAddr() _, _, fred := keyPubAddr() @@ -243,7 +236,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { "send tokens": { submsgID: 5, msg: validBankSend, - resultAssertions: []assertion{assertReturnedEvents(3), assertGasUsed(112000, 112900)}, + resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(95000, 104000)}, }, "not enough tokens": { submsgID: 6, @@ -263,7 +256,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(3), assertGasUsed(112000, 113000)}, + resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(95000, 104000)}, }, "not enough tokens with limit": { submsgID: 16, @@ -289,7 +282,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) { } for name, tc := range cases { t.Run(name, func(t *testing.T) { - creator := keepers.Faucet.NewFundedAccount(ctx, contractStart...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...) _, _, empty := keyPubAddr() contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), fmt.Sprintf("contract %s", name), contractStart) @@ -373,11 +366,11 @@ func TestDispatchSubMsgEncodeToNoSdkMsg(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) _, _, fred := keyPubAddr() // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) // creator instantiates a contract and gives it tokens @@ -439,11 +432,11 @@ func TestDispatchSubMsgConditionalReplyOn(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit...) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) _, _, fred := keyPubAddr() // upload code - codeID, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil) require.NoError(t, err) // creator instantiates a contract and gives it tokens diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 717228962..86c04141b 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -1,25 +1,27 @@ package keeper import ( + "bytes" "encoding/binary" "encoding/json" "fmt" - "io/ioutil" + "os" "testing" "time" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "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" 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" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -37,8 +39,11 @@ import ( 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" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/mint" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/params" @@ -55,11 +60,11 @@ import ( 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/cosmos/ibc-go/v3/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/cosmos/ibc-go/v5/modules/apps/transfer" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v5/modules/core" + ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" @@ -69,7 +74,6 @@ import ( dbm "github.com/tendermint/tm-db" wasmappparams "github.com/CosmWasm/wasmd/app/params" - "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -81,9 +85,9 @@ var moduleBasics = module.NewBasicManager( staking.AppModuleBasic{}, mint.AppModuleBasic{}, distribution.AppModuleBasic{}, - gov.NewAppModuleBasic( - paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, - ), + gov.NewAppModuleBasic([]govclient.ProposalHandler{ + paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, + }), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, @@ -91,6 +95,7 @@ var moduleBasics = module.NewBasicManager( upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, + vesting.AppModuleBasic{}, ) func MakeTestCodec(t testing.TB) codec.Codec { @@ -120,6 +125,7 @@ var TestingStakeParams = stakingtypes.Params{ MaxEntries: 10, HistoricalEntries: 10, BondDenom: "stake", + MinCommissionRate: sdk.NewDecWithPrec(10, 2), } type TestFaucet struct { @@ -159,10 +165,10 @@ func (f *TestFaucet) Fund(parentCtx sdk.Context, receiver sdk.AccAddress, amount ctx := parentCtx.WithEventManager(sdk.NewEventManager()) // discard all faucet related events err := f.bankKeeper.SendCoins(ctx, f.sender, receiver, amounts) require.NoError(f.t, err) - f.balance = f.balance.Sub(amounts) + f.balance = f.balance.Sub(amounts...) } -func (f *TestFaucet) NewFundedAccount(ctx sdk.Context, amounts ...sdk.Coin) sdk.AccAddress { +func (f *TestFaucet) NewFundedRandomAccount(ctx sdk.Context, amounts ...sdk.Coin) sdk.AccAddress { _, _, addr := keyPubAddr() f.Fund(ctx, addr, amounts...) return addr @@ -177,7 +183,7 @@ type TestKeepers struct { ContractKeeper types.ContractOpsKeeper WasmKeeper *Keeper IBCKeeper *ibckeeper.Keeper - Router *baseapp.Router + Router *baseapp.MsgServiceRouter EncodingConfig wasmappparams.EncodingConfig Faucet *TestFaucet MultiStore sdk.CommitMultiStore @@ -189,16 +195,16 @@ func CreateDefaultTestInput(t testing.TB) (sdk.Context, TestKeepers) { } // CreateTestInput encoders can be nil to accept the defaults, or set it to override some of the message handlers (like default) -func CreateTestInput(t testing.TB, isCheckTx bool, supportedFeatures string, opts ...Option) (sdk.Context, TestKeepers) { +func CreateTestInput(t testing.TB, isCheckTx bool, availableCapabilities string, opts ...Option) (sdk.Context, TestKeepers) { // Load default wasm config - return createTestInput(t, isCheckTx, supportedFeatures, 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( t testing.TB, isCheckTx bool, - supportedFeatures string, + availableCapabilities string, wasmConfig types.WasmConfig, db dbm.DB, opts ...Option, @@ -215,16 +221,16 @@ func createTestInput( ) ms := store.NewCommitMultiStore(db) for _, v := range keys { - ms.MountStoreWithDB(v, sdk.StoreTypeIAVL, db) + ms.MountStoreWithDB(v, storetypes.StoreTypeIAVL, db) } tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) for _, v := range tkeys { - ms.MountStoreWithDB(v, sdk.StoreTypeTransient, db) + ms.MountStoreWithDB(v, storetypes.StoreTypeTransient, db) } memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) for _, v := range memKeys { - ms.MountStoreWithDB(v, sdk.StoreTypeMemory, db) + ms.MountStoreWithDB(v, storetypes.StoreTypeMemory, db) } require.NoError(t, ms.LoadLatestVersion()) @@ -281,6 +287,7 @@ func createTestInput( subspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, // prototype maccPerms, + sdk.GetConfig().GetBech32AccountAddrPrefix(), ) blockedAddrs := make(map[string]bool) for acc := range maccPerms { @@ -313,7 +320,6 @@ func createTestInput( bankKeeper, stakingKeeper, authtypes.FeeCollectorName, - nil, ) distKeeper.SetParams(ctx, distributiontypes.DefaultParams()) stakingKeeper.SetHooks(distKeeper.Hooks()) @@ -327,6 +333,7 @@ func createTestInput( appCodec, tempDir, nil, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) faucet := NewTestFaucet(t, ctx, bankKeeper, minttypes.ModuleName, sdk.NewCoin("stake", sdk.NewInt(100_000_000_000))) @@ -354,13 +361,12 @@ func createTestInput( scopedIBCKeeper, ) - router := baseapp.NewRouter() - bh := bank.NewHandler(bankKeeper) - router.AddRoute(sdk.NewRoute(banktypes.RouterKey, bh)) - sh := staking.NewHandler(stakingKeeper) - router.AddRoute(sdk.NewRoute(stakingtypes.RouterKey, sh)) - dh := distribution.NewHandler(distKeeper) - router.AddRoute(sdk.NewRoute(distributiontypes.RouterKey, dh)) + router := baseapp.NewMsgServiceRouter() + router.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) + + banktypes.RegisterMsgServer(router, bankkeeper.NewMsgServerImpl(bankKeeper)) + stakingtypes.RegisterMsgServer(router, stakingkeeper.NewMsgServerImpl(stakingKeeper)) + distributiontypes.RegisterMsgServer(router, distributionkeeper.NewMsgServerImpl(distKeeper)) querier := baseapp.NewGRPCQueryRouter() querier.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) @@ -386,13 +392,13 @@ func createTestInput( querier, tempDir, wasmConfig, - supportedFeatures, + availableCapabilities, opts..., ) keeper.SetParams(ctx, types.DefaultParams()) // add wasm handler so we can loop-back (contracts calling contracts) contractKeeper := NewDefaultPermissionKeeper(&keeper) - router.AddRoute(sdk.NewRoute(types.RouterKey, TestHandler(contractKeeper))) + types.RegisterMsgServer(router, NewMsgServerImpl(contractKeeper)) am := module.NewManager( // minimal module set that we use for message/ query tests bank.NewAppModule(appCodec, bankKeeper, accountKeeper), @@ -403,26 +409,36 @@ func createTestInput( types.RegisterMsgServer(msgRouter, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper))) types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit)) - govRouter := govtypes.NewRouter(). - AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). + govRouter := govv1beta1.NewRouter(). + AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(paramsKeeper)). AddRoute(distributiontypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(distKeeper)). AddRoute(types.RouterKey, NewWasmProposalHandler(&keeper, types.EnableAllProposals)) + govConfig := govtypes.DefaultConfig() + /* + Example of setting gov params: + govConfig.MaxMetadataLen = 10000 + */ govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], - subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()), + subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()), accountKeeper, bankKeeper, stakingKeeper, govRouter, + router, + govConfig, ) - govKeeper.SetProposalID(ctx, govtypes.DefaultStartingProposalID) - govKeeper.SetDepositParams(ctx, govtypes.DefaultDepositParams()) - govKeeper.SetVotingParams(ctx, govtypes.DefaultVotingParams()) - govKeeper.SetTallyParams(ctx, govtypes.DefaultTallyParams()) + govv1.RegisterMsgServer(router, govkeeper.NewMsgServerImpl(govKeeper)) + govv1beta1.RegisterQueryServer(querier, govkeeper.NewLegacyQueryServer(govKeeper)) + + govKeeper.SetProposalID(ctx, govv1beta1.DefaultStartingProposalID) + govKeeper.SetDepositParams(ctx, govv1.DefaultDepositParams()) + govKeeper.SetVotingParams(ctx, govv1.DefaultVotingParams()) + govKeeper.SetTallyParams(ctx, govv1.DefaultTallyParams()) keepers := TestKeepers{ AccountKeeper: accountKeeper, @@ -464,7 +480,7 @@ func handleStoreCode(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgS if err != nil { return nil, sdkerrors.Wrap(err, "sender") } - codeID, err := k.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission) + codeID, _, err := k.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission) if err != nil { return nil, err } @@ -523,6 +539,11 @@ func RandomAccountAddress(_ testing.TB) sdk.AccAddress { return addr } +// DeterministicAccountAddress creates a test address with v repeated to valid address size +func DeterministicAccountAddress(_ testing.TB, v byte) sdk.AccAddress { + return bytes.Repeat([]byte{v}, address.Len) +} + func RandomBech32AccountAddress(t testing.TB) string { return RandomAccountAddress(t).String() } @@ -532,6 +553,7 @@ type ExampleContract struct { Creator crypto.PrivKey CreatorAddr sdk.AccAddress CodeID uint64 + Checksum []byte } func StoreHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { @@ -546,11 +568,8 @@ func StoreIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) return StoreExampleContract(t, ctx, keepers, "./testdata/ibc_reflect.wasm") } -func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) uint64 { - _, _, creatorAddr := keyPubAddr() - codeID, err := keepers.ContractKeeper.Create(ctx, creatorAddr, testdata.ReflectContractWasm(), nil) - require.NoError(t, err) - return codeID +func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract { + return StoreExampleContract(t, ctx, keepers, "./testdata/reflect.wasm") } func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract { @@ -558,12 +577,13 @@ func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wa creator, _, creatorAddr := keyPubAddr() fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) - wasmCode, err := ioutil.ReadFile(wasmFile) + wasmCode, err := os.ReadFile(wasmFile) require.NoError(t, err) - codeID, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil) + codeID, _, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil) require.NoError(t, err) - return ExampleContract{anyAmount, creator, creatorAddr, codeID} + hash := keepers.WasmKeeper.GetCodeInfo(ctx, codeID).CodeHash + return ExampleContract{anyAmount, creator, creatorAddr, codeID, hash} } var wasmIdent = []byte("\x00\x61\x73\x6D") @@ -602,9 +622,9 @@ func StoreRandomContractWithAccessConfig( fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount) keepers.WasmKeeper.wasmVM = mock wasmCode := append(wasmIdent, rand.Bytes(10)...) //nolint:gocritic - codeID, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, cfg) + codeID, checksum, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, cfg) require.NoError(t, err) - exampleContract := ExampleContract{InitialAmount: anyAmount, Creator: creator, CreatorAddr: creatorAddr, CodeID: codeID} + exampleContract := ExampleContract{InitialAmount: anyAmount, Creator: creator, CreatorAddr: creatorAddr, CodeID: codeID, Checksum: checksum} return exampleContract } @@ -615,6 +635,8 @@ type HackatomExampleInstance struct { VerifierAddr sdk.AccAddress Beneficiary crypto.PrivKey BeneficiaryAddr sdk.AccAddress + Label string + Deposit sdk.Coins } // InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract @@ -632,7 +654,8 @@ func InstantiateHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers T initialAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 100)) adminAddr := contract.CreatorAddr - contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, contract.CodeID, contract.CreatorAddr, adminAddr, initMsgBz, "demo contract to query", initialAmount) + label := "demo contract to query" + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, contract.CodeID, contract.CreatorAddr, adminAddr, initMsgBz, label, initialAmount) require.NoError(t, err) return HackatomExampleInstance{ ExampleContract: contract, @@ -641,6 +664,31 @@ func InstantiateHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers T VerifierAddr: verifierAddr, Beneficiary: beneficiary, BeneficiaryAddr: beneficiaryAddr, + Label: label, + Deposit: initialAmount, + } +} + +type ExampleInstance struct { + ExampleContract + Contract sdk.AccAddress + Label string + Deposit sdk.Coins +} + +// InstantiateReflectExampleContract load and instantiate the "./testdata/reflect.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, nil, []byte("{}"), label, initialAmount) + + require.NoError(t, err) + return ExampleInstance{ + ExampleContract: example, + Contract: contractAddr, + Label: label, + Deposit: initialAmount, } } @@ -664,7 +712,7 @@ type IBCReflectExampleInstance struct { // 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) + reflectID := StoreReflectContract(t, ctx, keepers).CodeID ibcReflectID := StoreIBCReflectContract(t, ctx, keepers).CodeID initMsgBz := IBCReflectInitMsg{ diff --git a/x/wasm/keeper/testdata/broken_crc.gzip b/x/wasm/keeper/testdata/broken_crc.gzip new file mode 100644 index 000000000..378713e2f Binary files /dev/null and b/x/wasm/keeper/testdata/broken_crc.gzip differ diff --git a/x/wasm/keeper/testdata/reflect.wasm b/x/wasm/keeper/testdata/reflect.wasm index 312f45768..412241177 100644 Binary files a/x/wasm/keeper/testdata/reflect.wasm and b/x/wasm/keeper/testdata/reflect.wasm differ diff --git a/x/wasm/keeper/testdata/reflect.wasm.v1_0 b/x/wasm/keeper/testdata/reflect.wasm.v1_0 new file mode 100644 index 000000000..312f45768 Binary files /dev/null and b/x/wasm/keeper/testdata/reflect.wasm.v1_0 differ diff --git a/x/wasm/keeper/wasmtesting/coin_transferrer.go b/x/wasm/keeper/wasmtesting/coin_transferrer.go deleted file mode 100644 index 497ecc747..000000000 --- a/x/wasm/keeper/wasmtesting/coin_transferrer.go +++ /dev/null @@ -1,14 +0,0 @@ -package wasmtesting - -import sdk "github.com/cosmos/cosmos-sdk/types" - -type MockCoinTransferrer struct { - TransferCoinsFn func(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error -} - -func (m *MockCoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error { - if m.TransferCoinsFn == nil { - panic("not expected to be called") - } - return m.TransferCoinsFn(ctx, fromAddr, toAddr, amt) -} diff --git a/x/wasm/keeper/wasmtesting/extension_mocks.go b/x/wasm/keeper/wasmtesting/extension_mocks.go new file mode 100644 index 000000000..562d9e74b --- /dev/null +++ b/x/wasm/keeper/wasmtesting/extension_mocks.go @@ -0,0 +1,28 @@ +package wasmtesting + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +type MockCoinTransferrer struct { + TransferCoinsFn func(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error +} + +func (m *MockCoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error { + if m.TransferCoinsFn == nil { + panic("not expected to be called") + } + return m.TransferCoinsFn(ctx, fromAddr, toAddr, amt) +} + +type AccountPrunerMock struct { + CleanupExistingAccountFn func(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) +} + +func (m AccountPrunerMock) CleanupExistingAccount(ctx sdk.Context, existingAccount authtypes.AccountI) (handled bool, err error) { + if m.CleanupExistingAccountFn == nil { + panic("not expected to be called") + } + return m.CleanupExistingAccountFn(ctx, existingAccount) +} diff --git a/x/wasm/keeper/wasmtesting/gas_register.go b/x/wasm/keeper/wasmtesting/gas_register.go index 1c1a319ba..d1975f763 100644 --- a/x/wasm/keeper/wasmtesting/gas_register.go +++ b/x/wasm/keeper/wasmtesting/gas_register.go @@ -14,6 +14,7 @@ type MockGasRegister struct { 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 } func (m MockGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) sdk.Gas { @@ -30,6 +31,13 @@ func (m MockGasRegister) CompileCosts(byteLength int) sdk.Gas { return m.CompileCostFn(byteLength) } +func (m MockGasRegister) UncompressCosts(byteLength int) sdk.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 { 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 4295b24ef..73eba9c9f 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -3,8 +3,8 @@ package wasmtesting import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/module.go b/x/wasm/module.go index a237a910d..e0fb602b7 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -13,14 +13,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cast" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" "github.com/CosmWasm/wasmd/x/wasm/client/cli" - "github.com/CosmWasm/wasmd/x/wasm/client/rest" "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/simulation" "github.com/CosmWasm/wasmd/x/wasm/types" @@ -75,11 +73,6 @@ func (b AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, config client return ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the wasm module. -func (AppModuleBasic) RegisterRESTRoutes(cliCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(cliCtx, rtr) -} - // GetTxCmd returns the root tx command for the wasm module. func (b AppModuleBasic) GetTxCmd() *cobra.Command { return cli.GetTxCmd() @@ -111,7 +104,7 @@ type AppModule struct { // module. It should be incremented on each consensus-breaking change // introduced by the module. To avoid wrong/empty versions, the initial version // should be set to 1. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // NewAppModule creates a new AppModule object func NewAppModule( diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go index ab52363b7..66591aba2 100644 --- a/x/wasm/module_test.go +++ b/x/wasm/module_test.go @@ -1,14 +1,14 @@ package wasm import ( + "bytes" "encoding/json" "fmt" - "io/ioutil" + "os" "testing" - "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -21,6 +21,7 @@ import ( "github.com/tendermint/tendermint/crypto/ed25519" "github.com/CosmWasm/wasmd/x/wasm/keeper" + "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -35,7 +36,7 @@ type testData struct { } func setupTest(t *testing.T) testData { - ctx, keepers := CreateTestInput(t, false, "iterator,staking,stargate") + ctx, keepers := CreateTestInput(t, false, "iterator,staking,stargate,cosmwasm_1_1") cdc := keeper.MakeTestCodec(t) data := testData{ module: NewAppModule(cdc, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper), @@ -57,7 +58,7 @@ func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) { } func mustLoad(path string) []byte { - bz, err := ioutil.ReadFile(path) + bz, err := os.ReadFile(path) if err != nil { panic(err) } @@ -145,7 +146,7 @@ type state struct { func TestHandleInstantiate(t *testing.T) { data := setupTest(t) - creator := data.faucet.NewFundedAccount(data.ctx, sdk.NewInt64Coin("denom", 100000)) + creator := data.faucet.NewFundedRandomAccount(data.ctx, sdk.NewInt64Coin("denom", 100000)) h := data.module.Route().Handler() q := data.module.LegacyQuerierHandler(nil) @@ -206,8 +207,8 @@ func TestHandleExecute(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := data.faucet.NewFundedAccount(data.ctx, deposit.Add(deposit...)...) - fred := data.faucet.NewFundedAccount(data.ctx, topUp...) + creator := data.faucet.NewFundedRandomAccount(data.ctx, deposit.Add(deposit...)...) + fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...) h := data.module.Route().Handler() q := data.module.LegacyQuerierHandler(nil) @@ -341,8 +342,9 @@ func TestHandleExecuteEscrow(t *testing.T) { deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := data.faucet.NewFundedAccount(data.ctx, deposit.Add(deposit...)...) - fred := data.faucet.NewFundedAccount(data.ctx, topUp...) + creator := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) + data.faucet.Fund(data.ctx, creator, sdk.NewInt64Coin("denom", 100000)) + fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...) h := data.module.Route().Handler() diff --git a/x/wasm/relay_pingpong_test.go b/x/wasm/relay_pingpong_test.go index 46c32497b..a715de7fe 100644 --- a/x/wasm/relay_pingpong_test.go +++ b/x/wasm/relay_pingpong_test.go @@ -5,15 +5,15 @@ import ( "fmt" "testing" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibctesting "github.com/cosmos/ibc-go/v3/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + ibctesting "github.com/cosmos/ibc-go/v5/testing" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -326,7 +326,7 @@ func (p player) incrementCounter(key []byte, store wasmvm.KVStore) uint64 { } func (p player) QueryState(key []byte) uint64 { - raw := p.chain.GetTestSupport().WasmKeeper().QueryRaw(p.chain.GetContext(), p.contractAddr, key) + raw := p.chain.App.WasmKeeper.QueryRaw(p.chain.GetContext(), p.contractAddr, key) return sdk.BigEndianToUint64(raw) } diff --git a/x/wasm/relay_test.go b/x/wasm/relay_test.go index 5edd182d5..7389f1fd8 100644 --- a/x/wasm/relay_test.go +++ b/x/wasm/relay_test.go @@ -6,14 +6,14 @@ import ( "testing" "time" + sdkerrors "cosmossdk.io/errors" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v3/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v5/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -193,7 +193,7 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) { require.Equal(t, 0, len(chainB.PendingSendPackets)) // and dest chain balance contains voucher - bankKeeperB := chainB.GetTestSupport().BankKeeper() + bankKeeperB := chainB.App.BankKeeper expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, coinToSendToB.Denom, coinToSendToB.Amount) gotBalance := chainB.Balance(chainB.SenderAccount.GetAddress(), expBalance.Denom) assert.Equal(t, expBalance, gotBalance, "got total balance: %s", bankKeeperB.GetAllBalances(chainB.GetContext(), chainB.SenderAccount.GetAddress())) @@ -268,7 +268,7 @@ func TestContractCanEmulateIBCTransferMessage(t *testing.T) { require.Equal(t, 0, len(chainB.PendingSendPackets)) // and dest chain balance contains voucher - bankKeeperB := chainB.GetTestSupport().BankKeeper() + bankKeeperB := chainB.App.BankKeeper expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, coinToSendToB.Denom, coinToSendToB.Amount) gotBalance := chainB.Balance(chainB.SenderAccount.GetAddress(), expBalance.Denom) assert.Equal(t, expBalance, gotBalance, "got total balance: %s", bankKeeperB.GetAllBalances(chainB.GetContext(), chainB.SenderAccount.GetAddress())) @@ -535,7 +535,7 @@ func (c *ackReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmv // call original ibctransfer keeper to not copy all code into this ibcPacket := toIBCPacket(packet) ctx := c.chain.GetContext() // HACK: please note that this is not reverted after checkTX - err := c.chain.GetTestSupport().TransferKeeper().OnRecvPacket(ctx, ibcPacket, src) + err := c.chain.App.TransferKeeper.OnRecvPacket(ctx, ibcPacket, src) if err != nil { return nil, 0, sdkerrors.Wrap(err, "within our smart contract") } @@ -560,7 +560,7 @@ func (c *ackReceiverContract) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtyp // call original ibctransfer keeper to not copy all code into this ctx := c.chain.GetContext() // HACK: please note that this is not reverted after checkTX ibcPacket := toIBCPacket(msg.OriginalPacket) - err := c.chain.GetTestSupport().TransferKeeper().OnAcknowledgementPacket(ctx, ibcPacket, data, ack) + err := c.chain.App.TransferKeeper.OnAcknowledgementPacket(ctx, ibcPacket, data, ack) if err != nil { return nil, 0, sdkerrors.Wrap(err, "within our smart contract") } diff --git a/x/wasm/simulation/genesis.go b/x/wasm/simulation/genesis.go index 039a4394c..5271bd236 100644 --- a/x/wasm/simulation/genesis.go +++ b/x/wasm/simulation/genesis.go @@ -15,7 +15,6 @@ func RandomizedGenState(simstate *module.SimulationState) { Contracts: nil, Sequences: []types.Sequence{ {IDKey: types.KeyLastCodeID, Value: simstate.Rand.Uint64()}, - {IDKey: types.KeyLastInstanceID, Value: simstate.Rand.Uint64()}, }, GenMsgs: nil, } diff --git a/x/wasm/simulation/operations.go b/x/wasm/simulation/operations.go index 66635a2b7..13c2f0167 100644 --- a/x/wasm/simulation/operations.go +++ b/x/wasm/simulation/operations.go @@ -2,8 +2,8 @@ package simulation import ( "encoding/json" - "io/ioutil" "math/rand" + "os" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -21,6 +21,7 @@ import ( ) // Simulation operation weights constants +// //nolint:gosec const ( OpWeightMsgStoreCode = "op_weight_msg_store_code" @@ -83,7 +84,7 @@ func WeightedOperations( wasmBz = testdata.ReflectContractWasm() } else { var err error - wasmBz, err = ioutil.ReadFile(wasmContractPath) + wasmBz, err = os.ReadFile(wasmContractPath) if err != nil { panic(err) } @@ -113,7 +114,7 @@ func WeightedOperations( } // SimulateMsgStoreCode generates a MsgStoreCode with random values -func SimulateMsgStoreCode(ak types.AccountKeeper, bk simulation.BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte, gas uint64) simtypes.Operation { +func SimulateMsgStoreCode(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte, gas uint64) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, @@ -135,21 +136,7 @@ func SimulateMsgStoreCode(ak types.AccountKeeper, bk simulation.BankKeeper, wasm WASMByteCode: wasmBz, InstantiatePermission: &config, } - - txCtx := simulation.OperationInput{ - R: r, - App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, - Cdc: nil, - Msg: &msg, - MsgType: msg.Type(), - Context: ctx, - SimAccount: simAccount, - AccountKeeper: ak, - Bankkeeper: bk, - ModuleName: types.ModuleName, - } - + txCtx := BuildOperationInput(r, app, ctx, &msg, simAccount, ak, bk, nil) return GenAndDeliverTxWithRandFees(txCtx, gas) } } @@ -201,22 +188,7 @@ func SimulateMsgInstantiateContract(ak types.AccountKeeper, bk BankKeeper, wasmK Msg: []byte(`{}`), Funds: deposit, } - - txCtx := simulation.OperationInput{ - R: r, - App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, - Cdc: nil, - Msg: &msg, - MsgType: msg.Type(), - Context: ctx, - SimAccount: simAccount, - AccountKeeper: ak, - Bankkeeper: bk, - ModuleName: types.ModuleName, - CoinsSpentInMsg: deposit, - } - + txCtx := BuildOperationInput(r, app, ctx, &msg, simAccount, ak, bk, deposit) return simulation.GenAndDeliverTxWithRandFees(txCtx) } } @@ -274,24 +246,41 @@ func SimulateMsgExecuteContract( return simtypes.NoOpMsg(types.ModuleName, types.MsgExecuteContract{}.Type(), "contract execute payload"), nil, err } - txCtx := simulation.OperationInput{ - R: r, - App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, - Cdc: nil, - Msg: &msg, - MsgType: msg.Type(), - Context: ctx, - SimAccount: simAccount, - AccountKeeper: ak, - Bankkeeper: bk, - ModuleName: types.ModuleName, - CoinsSpentInMsg: deposit, - } + txCtx := BuildOperationInput(r, app, ctx, &msg, simAccount, ak, bk, deposit) return simulation.GenAndDeliverTxWithRandFees(txCtx) } } +// BuildOperationInput helper to build object +func BuildOperationInput( + r *rand.Rand, + app *baseapp.BaseApp, + ctx sdk.Context, + msg interface { + sdk.Msg + Type() string + }, + simAccount simtypes.Account, + ak types.AccountKeeper, + bk BankKeeper, + deposit sdk.Coins, +) simulation.OperationInput { + return simulation.OperationInput{ + R: r, + App: app, + TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + Cdc: nil, + Msg: msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: simAccount, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + CoinsSpentInMsg: deposit, + } +} + // DefaultSimulationExecuteContractSelector picks the first contract address func DefaultSimulationExecuteContractSelector(ctx sdk.Context, wasmKeeper WasmKeeper) sdk.AccAddress { var r sdk.AccAddress diff --git a/x/wasm/simulation/sim_utils.go b/x/wasm/simulation/sim_utils.go index 4f9a00b0b..a915670a1 100644 --- a/x/wasm/simulation/sim_utils.go +++ b/x/wasm/simulation/sim_utils.go @@ -15,7 +15,7 @@ func GenAndDeliverTxWithRandFees(txCtx simulation.OperationInput, gas uint64) (s var fees sdk.Coins var err error - coins, hasNeg := spendable.SafeSub(txCtx.CoinsSpentInMsg) + coins, hasNeg := spendable.SafeSub(txCtx.CoinsSpentInMsg...) if hasNeg { return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "message doesn't leave room for fees"), nil, err } @@ -30,7 +30,8 @@ func GenAndDeliverTxWithRandFees(txCtx simulation.OperationInput, gas uint64) (s // GenAndDeliverTx generates a transactions and delivers it. func GenAndDeliverTx(txCtx simulation.OperationInput, fees sdk.Coins, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address) - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( + txCtx.R, txCtx.TxGen, []sdk.Msg{txCtx.Msg}, fees, @@ -44,7 +45,7 @@ func GenAndDeliverTx(txCtx simulation.OperationInput, fees sdk.Coins, gas uint64 return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate mock tx"), nil, err } - _, _, err = txCtx.App.Deliver(txCtx.TxGen.TxEncoder(), tx) + _, _, err = txCtx.App.SimDeliver(txCtx.TxGen.TxEncoder(), tx) if err != nil { return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to deliver tx"), nil, err } diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go index e7e578b7f..209ce7724 100644 --- a/x/wasm/types/codec.go +++ b/x/wasm/types/codec.go @@ -6,13 +6,14 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers the account types and interface func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck cdc.RegisterConcrete(&MsgStoreCode{}, "wasm/MsgStoreCode", nil) cdc.RegisterConcrete(&MsgInstantiateContract{}, "wasm/MsgInstantiateContract", nil) + cdc.RegisterConcrete(&MsgInstantiateContract2{}, "wasm/MsgInstantiateContract2", nil) cdc.RegisterConcrete(&MsgExecuteContract{}, "wasm/MsgExecuteContract", nil) cdc.RegisterConcrete(&MsgMigrateContract{}, "wasm/MsgMigrateContract", nil) cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/MsgUpdateAdmin", nil) @@ -35,6 +36,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*sdk.Msg)(nil), &MsgStoreCode{}, &MsgInstantiateContract{}, + &MsgInstantiateContract2{}, &MsgExecuteContract{}, &MsgMigrateContract{}, &MsgUpdateAdmin{}, @@ -43,7 +45,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgIBCSend{}, ) registry.RegisterImplementations( - (*govtypes.Content)(nil), + (*govv1beta1.Content)(nil), &StoreCodeProposal{}, &InstantiateContractProposal{}, &MigrateContractProposal{}, diff --git a/x/wasm/types/errors.go b/x/wasm/types/errors.go index 50814f813..7accd72bc 100644 --- a/x/wasm/types/errors.go +++ b/x/wasm/types/errors.go @@ -55,7 +55,7 @@ var ( // ErrMaxIBCChannels error for maximum number of ibc channels reached ErrMaxIBCChannels = sdkErrors.Register(DefaultCodespace, 16, "max transfer channels") - // ErrUnsupportedForContract error when a feature is used that is not supported for/ by this contract + // ErrUnsupportedForContract error when a capability is used that is not supported for/ by this contract ErrUnsupportedForContract = sdkErrors.Register(DefaultCodespace, 17, "unsupported for this contract") // ErrPinContractFailed error for pinning contract failures diff --git a/x/wasm/types/events.go b/x/wasm/types/events.go index 0c32476f5..579024ed0 100644 --- a/x/wasm/types/events.go +++ b/x/wasm/types/events.go @@ -21,8 +21,9 @@ const ( const ( AttributeReservedPrefix = "_" - AttributeKeyContractAddr = "_contract_address" - AttributeKeyCodeID = "code_id" - AttributeKeyResultDataHex = "result" - AttributeKeyFeature = "feature" + AttributeKeyContractAddr = "_contract_address" + AttributeKeyCodeID = "code_id" + AttributeKeyChecksum = "code_checksum" + AttributeKeyResultDataHex = "result" + AttributeKeyRequiredCapability = "required_capability" ) diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index 0cdd4d80e..409e5fabc 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -8,15 +8,16 @@ import ( capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + connectiontypes "github.com/cosmos/ibc-go/v5/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" ) // 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 } // Burner is a subset of the sdk bank keeper methods diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index bb919a318..e68df8ee7 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -20,15 +20,35 @@ type ViewKeeper interface { 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 } // ContractOpsKeeper contains mutable operations on a contract. type ContractOpsKeeper interface { // Create uploads and compiles a WASM contract, returning a short identifier for the contract - Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *AccessConfig) (codeID uint64, err error) + Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *AccessConfig) (codeID uint64, checksum []byte, err error) - // Instantiate creates an instance of a WASM contract - Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error) + // Instantiate creates an instance of a WASM contract using the classic sequence based address generator + Instantiate( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + ) (sdk.AccAddress, []byte, error) + + // Instantiate2 creates an instance of a WASM contract using the predictable address generator + Instantiate2( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + salt []byte, + fixMsg bool, + ) (sdk.AccAddress, []byte, error) // Execute executes the contract instance Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) @@ -55,7 +75,7 @@ type ContractOpsKeeper interface { SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra ContractInfoExtension) error // SetAccessConfig updates the access config of a code id. - SetAccessConfig(ctx sdk.Context, codeID uint64, config AccessConfig) error + SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig AccessConfig) error } // IBCContractKeeper IBC lifecycle event handler diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go index 17970ef90..0c5096e42 100644 --- a/x/wasm/types/genesis.pb.go +++ b/x/wasm/types/genesis.pb.go @@ -5,21 +5,17 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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. @@ -42,11 +38,9 @@ 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) @@ -59,15 +53,12 @@ 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) } @@ -127,11 +118,9 @@ 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) @@ -144,15 +133,12 @@ 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) } @@ -231,11 +217,9 @@ 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) @@ -248,15 +232,12 @@ 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) } @@ -304,11 +285,9 @@ 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) @@ -321,15 +300,12 @@ 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) } @@ -369,11 +345,9 @@ 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) @@ -386,15 +360,12 @@ 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) } @@ -612,7 +583,6 @@ 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]) @@ -634,7 +604,6 @@ 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]) @@ -656,7 +625,6 @@ 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) @@ -812,7 +780,6 @@ 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 @@ -872,7 +839,6 @@ func (m *GenesisState_GenMsgs_StoreCode) Size() (n int) { } return n } - func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { if m == nil { return 0 @@ -885,7 +851,6 @@ func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { } return n } - func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { if m == nil { return 0 @@ -898,7 +863,6 @@ func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { } return n } - func (m *Code) Size() (n int) { if m == nil { return 0 @@ -960,11 +924,9 @@ 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 @@ -1184,7 +1146,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } - func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1340,7 +1301,6 @@ func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { } return nil } - func (m *Code) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1497,7 +1457,6 @@ func (m *Code) Unmarshal(dAtA []byte) error { } return nil } - func (m *Contract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1647,7 +1606,6 @@ func (m *Contract) Unmarshal(dAtA []byte) error { } return nil } - func (m *Sequence) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1751,7 +1709,6 @@ 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/genesis_test.go b/x/wasm/types/genesis_test.go index 3ef424e7e..5fb4c9ecd 100644 --- a/x/wasm/types/genesis_test.go +++ b/x/wasm/types/genesis_test.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/stretchr/testify/assert" "github.com/tendermint/tendermint/libs/rand" diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go index 64d22ee35..ac6c9f006 100644 --- a/x/wasm/types/ibc.pb.go +++ b/x/wasm/types/ibc.pb.go @@ -5,21 +5,17 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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. @@ -48,11 +44,9 @@ 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) @@ -65,15 +59,12 @@ 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) } @@ -91,11 +82,9 @@ func (*MsgIBCCloseChannel) ProtoMessage() {} func (*MsgIBCCloseChannel) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{1} } - 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) @@ -108,15 +97,12 @@ 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) } @@ -241,7 +227,6 @@ 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 @@ -281,11 +266,9 @@ 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 @@ -440,7 +423,6 @@ func (m *MsgIBCSend) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -523,7 +505,6 @@ 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 ea8046cf3..0ee7dcb61 100644 --- a/x/wasm/types/params.go +++ b/x/wasm/types/params.go @@ -20,20 +20,33 @@ var ( var AllAccessTypes = []AccessType{ AccessTypeNobody, AccessTypeOnlyAddress, + AccessTypeAnyOfAddresses, AccessTypeEverybody, } -func (a AccessType) With(addr sdk.AccAddress) AccessConfig { +func (a AccessType) With(addrs ...sdk.AccAddress) AccessConfig { switch a { case AccessTypeNobody: return AllowNobody case AccessTypeOnlyAddress: - if err := sdk.VerifyAddressFormat(addr); err != nil { + if n := len(addrs); n != 1 { + panic(fmt.Sprintf("expected exactly 1 address but got %d", n)) + } + if err := sdk.VerifyAddressFormat(addrs[0]); err != nil { panic(err) } - return AccessConfig{Permission: AccessTypeOnlyAddress, Address: addr.String()} + return AccessConfig{Permission: AccessTypeOnlyAddress, Address: addrs[0].String()} case AccessTypeEverybody: return AllowEverybody + case AccessTypeAnyOfAddresses: + bech32Addrs := make([]string, len(addrs)) + for i, v := range addrs { + bech32Addrs[i] = v.String() + } + if err := assertValidAddresses(bech32Addrs); err != nil { + panic(sdkerrors.Wrap(err, "addresses")) + } + return AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: bech32Addrs} } panic("unsupported access type") } @@ -46,6 +59,8 @@ func (a AccessType) String() string { return "OnlyAddress" case AccessTypeEverybody: return "Everybody" + case AccessTypeAnyOfAddresses: + return "AnyOfAddresses" } return "Unspecified" } @@ -147,6 +162,7 @@ func validateAccessType(i interface{}) error { return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a) } +// ValidateBasic performs basic validation func (a AccessConfig) ValidateBasic() error { switch a.Permission { case AccessTypeUnspecified: @@ -157,12 +173,39 @@ func (a AccessConfig) ValidateBasic() error { } return nil case AccessTypeOnlyAddress: + if len(a.Addresses) != 0 { + return ErrInvalid.Wrap("addresses field set") + } _, err := sdk.AccAddressFromBech32(a.Address) return err + case AccessTypeAnyOfAddresses: + if a.Address != "" { + return ErrInvalid.Wrap("address field set") + } + return sdkerrors.Wrap(assertValidAddresses(a.Addresses), "addresses") } return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a.Permission) } +func assertValidAddresses(addrs []string) error { + if len(addrs) == 0 { + return ErrEmpty + } + idx := make(map[string]struct{}, len(addrs)) + for _, a := range addrs { + if _, err := sdk.AccAddressFromBech32(a); err != nil { + return sdkerrors.Wrapf(err, "address: %s", a) + } + if _, exists := idx[a]; exists { + return ErrDuplicate.Wrapf("address: %s", a) + } + idx[a] = struct{}{} + } + return nil +} + +// Allowed returns if permission includes the actor. +// Actor address must be valid and not nil func (a AccessConfig) Allowed(actor sdk.AccAddress) bool { switch a.Permission { case AccessTypeNobody: @@ -171,6 +214,13 @@ func (a AccessConfig) Allowed(actor sdk.AccAddress) bool { return true case AccessTypeOnlyAddress: return a.Address == actor.String() + case AccessTypeAnyOfAddresses: + for _, v := range a.Addresses { + if v == actor.String() { + return true + } + } + return false default: panic("unknown type") } diff --git a/x/wasm/types/params_test.go b/x/wasm/types/params_test.go index 35799cb48..77ac8b742 100644 --- a/x/wasm/types/params_test.go +++ b/x/wasm/types/params_test.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "encoding/json" "testing" @@ -14,6 +15,7 @@ import ( func TestValidateParams(t *testing.T) { var ( anyAddress sdk.AccAddress = make([]byte, ContractAddrLen) + otherAddress sdk.AccAddress = bytes.Repeat([]byte{1}, ContractAddrLen) invalidAddress = "invalid address" ) @@ -42,6 +44,18 @@ func TestValidateParams(t *testing.T) { InstantiateDefaultPermission: AccessTypeOnlyAddress, }, }, + "all good with anyOf address": { + src: Params{ + CodeUploadAccess: AccessTypeAnyOfAddresses.With(anyAddress), + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + }, + "all good with anyOf addresses": { + src: Params{ + CodeUploadAccess: AccessTypeAnyOfAddresses.With(anyAddress, otherAddress), + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + }, "reject empty type in instantiate permission": { src: Params{ CodeUploadAccess: AllowNobody, @@ -62,6 +76,13 @@ func TestValidateParams(t *testing.T) { }, expErr: true, }, + "reject wrong field addresses in only address": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeOnlyAddress, Address: anyAddress.String(), Addresses: []string{anyAddress.String()}}, + InstantiateDefaultPermission: AccessTypeOnlyAddress, + }, + expErr: true, + }, "reject CodeUploadAccess Everybody with obsolete address": { src: Params{ CodeUploadAccess: AccessConfig{Permission: AccessTypeEverybody, Address: anyAddress.String()}, @@ -89,6 +110,41 @@ func TestValidateParams(t *testing.T) { }, expErr: true, }, + "reject empty addresses in any of addresses": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{}}, + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + expErr: true, + }, + "reject addresses not set in any of addresses": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeAnyOfAddresses}, + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + expErr: true, + }, + "reject invalid address in any of addresses": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{invalidAddress}}, + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + expErr: true, + }, + "reject duplicate address in any of addresses": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{anyAddress.String(), anyAddress.String()}}, + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + expErr: true, + }, + "reject wrong field address in any of addresses": { + src: Params{ + CodeUploadAccess: AccessConfig{Permission: AccessTypeAnyOfAddresses, Address: anyAddress.String(), Addresses: []string{anyAddress.String()}}, + InstantiateDefaultPermission: AccessTypeAnyOfAddresses, + }, + expErr: true, + }, } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { @@ -107,11 +163,12 @@ func TestAccessTypeMarshalJson(t *testing.T) { src AccessType exp string }{ - "Unspecified": {src: AccessTypeUnspecified, exp: `"Unspecified"`}, - "Nobody": {src: AccessTypeNobody, exp: `"Nobody"`}, - "OnlyAddress": {src: AccessTypeOnlyAddress, exp: `"OnlyAddress"`}, - "Everybody": {src: AccessTypeEverybody, exp: `"Everybody"`}, - "unknown": {src: 999, exp: `"Unspecified"`}, + "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) { @@ -127,11 +184,12 @@ func TestAccessTypeUnmarshalJson(t *testing.T) { src string exp AccessType }{ - "Unspecified": {src: `"Unspecified"`, exp: AccessTypeUnspecified}, - "Nobody": {src: `"Nobody"`, exp: AccessTypeNobody}, - "OnlyAddress": {src: `"OnlyAddress"`, exp: AccessTypeOnlyAddress}, - "Everybody": {src: `"Everybody"`, exp: AccessTypeEverybody}, - "unknown": {src: `""`, exp: AccessTypeUnspecified}, + "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) { @@ -166,3 +224,83 @@ func TestParamsUnmarshalJson(t *testing.T) { }) } } + +func TestAccessTypeWith(t *testing.T) { + myAddress := sdk.AccAddress(randBytes(SDKAddrLen)) + myOtherAddress := sdk.AccAddress(randBytes(SDKAddrLen)) + specs := map[string]struct { + src AccessType + addrs []sdk.AccAddress + exp AccessConfig + expPanic bool + }{ + "nobody": { + src: AccessTypeNobody, + exp: AccessConfig{Permission: AccessTypeNobody}, + }, + "nobody with address": { + src: AccessTypeNobody, + addrs: []sdk.AccAddress{myAddress}, + exp: AccessConfig{Permission: AccessTypeNobody}, + }, + "everybody": { + src: AccessTypeEverybody, + exp: AccessConfig{Permission: AccessTypeEverybody}, + }, + "everybody with address": { + src: AccessTypeEverybody, + addrs: []sdk.AccAddress{myAddress}, + exp: AccessConfig{Permission: AccessTypeEverybody}, + }, + "only address without address": { + src: AccessTypeOnlyAddress, + expPanic: true, + }, + "only address with address": { + src: AccessTypeOnlyAddress, + addrs: []sdk.AccAddress{myAddress}, + exp: AccessConfig{Permission: AccessTypeOnlyAddress, Address: myAddress.String()}, + }, + "only address with invalid address": { + src: AccessTypeOnlyAddress, + addrs: []sdk.AccAddress{nil}, + expPanic: true, + }, + "any of address without address": { + src: AccessTypeAnyOfAddresses, + expPanic: true, + }, + "any of address with single address": { + src: AccessTypeAnyOfAddresses, + addrs: []sdk.AccAddress{myAddress}, + exp: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{myAddress.String()}}, + }, + "any of address with multiple addresses": { + src: AccessTypeAnyOfAddresses, + addrs: []sdk.AccAddress{myAddress, myOtherAddress}, + exp: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{myAddress.String(), myOtherAddress.String()}}, + }, + "any of address with duplicate addresses": { + src: AccessTypeAnyOfAddresses, + addrs: []sdk.AccAddress{myAddress, myAddress}, + expPanic: true, + }, + "any of address with invalid address": { + src: AccessTypeAnyOfAddresses, + addrs: []sdk.AccAddress{nil}, + expPanic: true, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + if !spec.expPanic { + got := spec.src.With(spec.addrs...) + assert.Equal(t, spec.exp, got) + return + } + assert.Panics(t, func() { + spec.src.With(spec.addrs...) + }) + }) + } +} diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go index 748a03895..ed5c43b0e 100644 --- a/x/wasm/types/proposal.go +++ b/x/wasm/types/proposal.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type ProposalType string @@ -61,26 +62,26 @@ func ConvertToProposals(keys []string) ([]ProposalType, error) { } func init() { // register new content types with the sdk - govtypes.RegisterProposalType(string(ProposalTypeStoreCode)) - govtypes.RegisterProposalType(string(ProposalTypeInstantiateContract)) - govtypes.RegisterProposalType(string(ProposalTypeMigrateContract)) - govtypes.RegisterProposalType(string(ProposalTypeSudoContract)) - govtypes.RegisterProposalType(string(ProposalTypeExecuteContract)) - govtypes.RegisterProposalType(string(ProposalTypeUpdateAdmin)) - govtypes.RegisterProposalType(string(ProposalTypeClearAdmin)) - govtypes.RegisterProposalType(string(ProposalTypePinCodes)) - govtypes.RegisterProposalType(string(ProposalTypeUnpinCodes)) - govtypes.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig)) - govtypes.RegisterProposalTypeCodec(&StoreCodeProposal{}, "wasm/StoreCodeProposal") - govtypes.RegisterProposalTypeCodec(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal") - govtypes.RegisterProposalTypeCodec(&MigrateContractProposal{}, "wasm/MigrateContractProposal") - govtypes.RegisterProposalTypeCodec(&SudoContractProposal{}, "wasm/SudoContractProposal") - govtypes.RegisterProposalTypeCodec(&ExecuteContractProposal{}, "wasm/ExecuteContractProposal") - govtypes.RegisterProposalTypeCodec(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal") - govtypes.RegisterProposalTypeCodec(&ClearAdminProposal{}, "wasm/ClearAdminProposal") - govtypes.RegisterProposalTypeCodec(&PinCodesProposal{}, "wasm/PinCodesProposal") - govtypes.RegisterProposalTypeCodec(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal") - govtypes.RegisterProposalTypeCodec(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal") + govv1beta1.RegisterProposalType(string(ProposalTypeStoreCode)) + govv1beta1.RegisterProposalType(string(ProposalTypeInstantiateContract)) + govv1beta1.RegisterProposalType(string(ProposalTypeMigrateContract)) + govv1beta1.RegisterProposalType(string(ProposalTypeSudoContract)) + govv1beta1.RegisterProposalType(string(ProposalTypeExecuteContract)) + govv1beta1.RegisterProposalType(string(ProposalTypeUpdateAdmin)) + govv1beta1.RegisterProposalType(string(ProposalTypeClearAdmin)) + govv1beta1.RegisterProposalType(string(ProposalTypePinCodes)) + govv1beta1.RegisterProposalType(string(ProposalTypeUnpinCodes)) + govv1beta1.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig)) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&StoreCodeProposal{}, "wasm/StoreCodeProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&MigrateContractProposal{}, "wasm/MigrateContractProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&SudoContractProposal{}, "wasm/SudoContractProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&ExecuteContractProposal{}, "wasm/ExecuteContractProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&ClearAdminProposal{}, "wasm/ClearAdminProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil) + govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal", nil) } // ProposalRoute returns the routing key of a parameter change proposal. @@ -170,7 +171,7 @@ func (p InstantiateContractProposal) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required") } - if err := validateLabel(p.Label); err != nil { + if err := ValidateLabel(p.Label); err != nil { return err } @@ -536,8 +537,8 @@ func validateProposalCommons(title, description string) error { if len(title) == 0 { return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal title cannot be blank") } - if len(title) > govtypes.MaxTitleLength { - return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal title is longer than max length of %d", govtypes.MaxTitleLength) + if len(title) > govv1beta1.MaxTitleLength { + return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal title is longer than max length of %d", govv1beta1.MaxTitleLength) } if strings.TrimSpace(description) != description { return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal description must not start/end with white spaces") @@ -545,8 +546,8 @@ func validateProposalCommons(title, description string) error { if len(description) == 0 { return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal description cannot be blank") } - if len(description) > govtypes.MaxDescriptionLength { - return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal description is longer than max length of %d", govtypes.MaxDescriptionLength) + if len(description) > govv1beta1.MaxDescriptionLength { + return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal description is longer than max length of %d", govv1beta1.MaxDescriptionLength) } return nil } diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go index c4b1d977a..7a2397420 100644 --- a/x/wasm/types/proposal.pb.go +++ b/x/wasm/types/proposal.pb.go @@ -6,23 +6,19 @@ package types import ( bytes "bytes" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/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 - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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. @@ -42,6 +38,8 @@ type StoreCodeProposal struct { WASMByteCode []byte `protobuf:"bytes,4,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` // InstantiatePermission to apply on contract creation, optional InstantiatePermission *AccessConfig `protobuf:"bytes,7,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` + // UnpinCode code on upload, optional + UnpinCode bool `protobuf:"varint,8,opt,name=unpin_code,json=unpinCode,proto3" json:"unpin_code,omitempty"` } func (m *StoreCodeProposal) Reset() { *m = StoreCodeProposal{} } @@ -49,11 +47,9 @@ func (*StoreCodeProposal) ProtoMessage() {} func (*StoreCodeProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{0} } - func (m *StoreCodeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *StoreCodeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StoreCodeProposal.Marshal(b, m, deterministic) @@ -66,15 +62,12 @@ func (m *StoreCodeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *StoreCodeProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_StoreCodeProposal.Merge(m, src) } - func (m *StoreCodeProposal) XXX_Size() int { return m.Size() } - func (m *StoreCodeProposal) XXX_DiscardUnknown() { xxx_messageInfo_StoreCodeProposal.DiscardUnknown(m) } @@ -107,11 +100,9 @@ func (*InstantiateContractProposal) ProtoMessage() {} func (*InstantiateContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{1} } - func (m *InstantiateContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *InstantiateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_InstantiateContractProposal.Marshal(b, m, deterministic) @@ -124,15 +115,12 @@ func (m *InstantiateContractProposal) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *InstantiateContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_InstantiateContractProposal.Merge(m, src) } - func (m *InstantiateContractProposal) XXX_Size() int { return m.Size() } - func (m *InstantiateContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_InstantiateContractProposal.DiscardUnknown(m) } @@ -158,11 +146,9 @@ func (*MigrateContractProposal) ProtoMessage() {} func (*MigrateContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{2} } - func (m *MigrateContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MigrateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MigrateContractProposal.Marshal(b, m, deterministic) @@ -175,15 +161,12 @@ func (m *MigrateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *MigrateContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_MigrateContractProposal.Merge(m, src) } - func (m *MigrateContractProposal) XXX_Size() int { return m.Size() } - func (m *MigrateContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_MigrateContractProposal.DiscardUnknown(m) } @@ -207,11 +190,9 @@ func (*SudoContractProposal) ProtoMessage() {} func (*SudoContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{3} } - func (m *SudoContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *SudoContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_SudoContractProposal.Marshal(b, m, deterministic) @@ -224,15 +205,12 @@ func (m *SudoContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *SudoContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_SudoContractProposal.Merge(m, src) } - func (m *SudoContractProposal) XXX_Size() int { return m.Size() } - func (m *SudoContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_SudoContractProposal.DiscardUnknown(m) } @@ -261,11 +239,9 @@ func (*ExecuteContractProposal) ProtoMessage() {} func (*ExecuteContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{4} } - func (m *ExecuteContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ExecuteContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExecuteContractProposal.Marshal(b, m, deterministic) @@ -278,15 +254,12 @@ func (m *ExecuteContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *ExecuteContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_ExecuteContractProposal.Merge(m, src) } - func (m *ExecuteContractProposal) XXX_Size() int { return m.Size() } - func (m *ExecuteContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_ExecuteContractProposal.DiscardUnknown(m) } @@ -310,11 +283,9 @@ func (*UpdateAdminProposal) ProtoMessage() {} func (*UpdateAdminProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{5} } - func (m *UpdateAdminProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UpdateAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateAdminProposal.Marshal(b, m, deterministic) @@ -327,15 +298,12 @@ func (m *UpdateAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *UpdateAdminProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateAdminProposal.Merge(m, src) } - func (m *UpdateAdminProposal) XXX_Size() int { return m.Size() } - func (m *UpdateAdminProposal) XXX_DiscardUnknown() { xxx_messageInfo_UpdateAdminProposal.DiscardUnknown(m) } @@ -358,11 +326,9 @@ func (*ClearAdminProposal) ProtoMessage() {} func (*ClearAdminProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{6} } - func (m *ClearAdminProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ClearAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ClearAdminProposal.Marshal(b, m, deterministic) @@ -375,15 +341,12 @@ func (m *ClearAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *ClearAdminProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_ClearAdminProposal.Merge(m, src) } - func (m *ClearAdminProposal) XXX_Size() int { return m.Size() } - func (m *ClearAdminProposal) XXX_DiscardUnknown() { xxx_messageInfo_ClearAdminProposal.DiscardUnknown(m) } @@ -406,11 +369,9 @@ func (*PinCodesProposal) ProtoMessage() {} func (*PinCodesProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{7} } - func (m *PinCodesProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *PinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PinCodesProposal.Marshal(b, m, deterministic) @@ -423,15 +384,12 @@ func (m *PinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *PinCodesProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_PinCodesProposal.Merge(m, src) } - func (m *PinCodesProposal) XXX_Size() int { return m.Size() } - func (m *PinCodesProposal) XXX_DiscardUnknown() { xxx_messageInfo_PinCodesProposal.DiscardUnknown(m) } @@ -454,11 +412,9 @@ func (*UnpinCodesProposal) ProtoMessage() {} func (*UnpinCodesProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{8} } - func (m *UnpinCodesProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UnpinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UnpinCodesProposal.Marshal(b, m, deterministic) @@ -471,15 +427,12 @@ func (m *UnpinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *UnpinCodesProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UnpinCodesProposal.Merge(m, src) } - func (m *UnpinCodesProposal) XXX_Size() int { return m.Size() } - func (m *UnpinCodesProposal) XXX_DiscardUnknown() { xxx_messageInfo_UnpinCodesProposal.DiscardUnknown(m) } @@ -500,11 +453,9 @@ func (*AccessConfigUpdate) ProtoMessage() {} func (*AccessConfigUpdate) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{9} } - func (m *AccessConfigUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *AccessConfigUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessConfigUpdate.Marshal(b, m, deterministic) @@ -517,15 +468,12 @@ func (m *AccessConfigUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *AccessConfigUpdate) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessConfigUpdate.Merge(m, src) } - func (m *AccessConfigUpdate) XXX_Size() int { return m.Size() } - func (m *AccessConfigUpdate) XXX_DiscardUnknown() { xxx_messageInfo_AccessConfigUpdate.DiscardUnknown(m) } @@ -549,11 +497,9 @@ func (*UpdateInstantiateConfigProposal) ProtoMessage() {} func (*UpdateInstantiateConfigProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{10} } - func (m *UpdateInstantiateConfigProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UpdateInstantiateConfigProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateInstantiateConfigProposal.Marshal(b, m, deterministic) @@ -566,15 +512,12 @@ func (m *UpdateInstantiateConfigProposal) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } - func (m *UpdateInstantiateConfigProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateInstantiateConfigProposal.Merge(m, src) } - func (m *UpdateInstantiateConfigProposal) XXX_Size() int { return m.Size() } - func (m *UpdateInstantiateConfigProposal) XXX_DiscardUnknown() { xxx_messageInfo_UpdateInstantiateConfigProposal.DiscardUnknown(m) } @@ -598,59 +541,60 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/proposal.proto", fileDescriptor_be6422d717c730cb) } var fileDescriptor_be6422d717c730cb = []byte{ - // 817 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xcf, 0xe4, 0x8f, 0x93, 0x4e, 0x22, 0x08, 0xde, 0xb4, 0x1b, 0x0a, 0xb2, 0x23, 0x83, 0x56, - 0xbe, 0x60, 0x93, 0x22, 0x21, 0xe0, 0x16, 0x07, 0x0e, 0x5d, 0x51, 0xa9, 0x72, 0x55, 0xad, 0x04, - 0x12, 0xd6, 0xc4, 0x9e, 0x7a, 0x2d, 0x62, 0x8f, 0xe5, 0x99, 0x34, 0x9b, 0x6f, 0x01, 0x12, 0xe2, - 0xc4, 0x07, 0x40, 0x5c, 0x10, 0x77, 0x3e, 0x40, 0xc5, 0x69, 0x8f, 0x7b, 0x32, 0x6c, 0xf2, 0x0d, - 0x72, 0x44, 0x42, 0x42, 0x33, 0xe3, 0x84, 0x74, 0x97, 0x66, 0x17, 0xd1, 0x20, 0x71, 0x71, 0xf2, - 0xe6, 0xbd, 0x37, 0xef, 0x37, 0x3f, 0xfd, 0xde, 0xbc, 0x81, 0xba, 0x4f, 0x68, 0x3c, 0x45, 0x34, - 0xb6, 0xc5, 0xe7, 0xb2, 0x6f, 0xa7, 0x19, 0x49, 0x09, 0x45, 0x63, 0x2b, 0xcd, 0x08, 0x23, 0x6a, - 0x7b, 0x15, 0x60, 0x89, 0xcf, 0x65, 0xff, 0xb0, 0x13, 0x92, 0x90, 0x08, 0xa7, 0xcd, 0xff, 0xc9, - 0xb8, 0x43, 0x8d, 0xc7, 0x11, 0x6a, 0x8f, 0x10, 0xc5, 0xf6, 0x65, 0x7f, 0x84, 0x19, 0xea, 0xdb, - 0x3e, 0x89, 0x92, 0xc2, 0xff, 0xe6, 0x73, 0x85, 0xd8, 0x2c, 0xc5, 0x54, 0x7a, 0x8d, 0x3f, 0x00, - 0x7c, 0xed, 0x8c, 0x91, 0x0c, 0x0f, 0x49, 0x80, 0x4f, 0x0b, 0x04, 0x6a, 0x07, 0xd6, 0x58, 0xc4, - 0xc6, 0xb8, 0x0b, 0x7a, 0xc0, 0xdc, 0x73, 0xa5, 0xa1, 0xf6, 0x60, 0x33, 0xc0, 0xd4, 0xcf, 0xa2, - 0x94, 0x45, 0x24, 0xe9, 0x96, 0x85, 0x6f, 0x73, 0x49, 0xdd, 0x87, 0x4a, 0x36, 0x49, 0x3c, 0x44, - 0xbb, 0x15, 0x99, 0x98, 0x4d, 0x92, 0x01, 0x55, 0xdf, 0x87, 0xaf, 0xf0, 0xda, 0xde, 0x68, 0xc6, - 0xb0, 0xe7, 0x93, 0x00, 0x77, 0xab, 0x3d, 0x60, 0xb6, 0x9c, 0xf6, 0x3c, 0xd7, 0x5b, 0x0f, 0x06, - 0x67, 0x27, 0xce, 0x8c, 0x09, 0x00, 0x6e, 0x8b, 0xc7, 0xad, 0x2c, 0xf5, 0x1c, 0x1e, 0x44, 0x09, - 0x65, 0x28, 0x61, 0x11, 0x62, 0xd8, 0x4b, 0x71, 0x16, 0x47, 0x94, 0xf2, 0xda, 0xf5, 0x1e, 0x30, - 0x9b, 0x47, 0x9a, 0xf5, 0x2c, 0x47, 0xd6, 0xc0, 0xf7, 0x31, 0xa5, 0x43, 0x92, 0x5c, 0x44, 0xa1, - 0xbb, 0xbf, 0x91, 0x7d, 0xba, 0x4e, 0xbe, 0x5f, 0x6d, 0xd4, 0xda, 0xca, 0xfd, 0x6a, 0x43, 0x69, - 0xd7, 0x8d, 0x5f, 0xca, 0xf0, 0x8d, 0xe3, 0xbf, 0xa2, 0x86, 0x24, 0x61, 0x19, 0xf2, 0xd9, 0xae, - 0x98, 0xe8, 0xc0, 0x1a, 0x0a, 0xe2, 0x28, 0x11, 0x04, 0xec, 0xb9, 0xd2, 0x50, 0xdf, 0x82, 0x75, - 0xce, 0x8a, 0x17, 0x05, 0xdd, 0x5a, 0x0f, 0x98, 0x55, 0x07, 0xce, 0x73, 0x5d, 0xe1, 0x14, 0x1c, - 0x7f, 0xec, 0x2a, 0xdc, 0x75, 0x1c, 0xf0, 0xd4, 0x31, 0x1a, 0xe1, 0x71, 0x57, 0x91, 0xa9, 0xc2, - 0x50, 0x4d, 0x58, 0x89, 0x69, 0x28, 0xf8, 0x68, 0x39, 0x07, 0xbf, 0xe7, 0xba, 0xea, 0xa2, 0xe9, - 0xea, 0x14, 0x27, 0x98, 0x52, 0x14, 0x62, 0x97, 0x87, 0xa8, 0x08, 0xd6, 0x2e, 0x26, 0x49, 0x40, - 0xbb, 0x8d, 0x5e, 0xc5, 0x6c, 0x1e, 0xbd, 0x6e, 0x49, 0xdd, 0x58, 0x5c, 0x37, 0x56, 0xa1, 0x1b, - 0x6b, 0x48, 0xa2, 0xc4, 0x79, 0xf7, 0x2a, 0xd7, 0x4b, 0x3f, 0xfc, 0xaa, 0x9b, 0x61, 0xc4, 0x1e, - 0x4e, 0x46, 0x96, 0x4f, 0x62, 0xbb, 0x10, 0x99, 0xfc, 0x79, 0x87, 0x06, 0x5f, 0x16, 0x2a, 0xe2, - 0x09, 0xd4, 0x95, 0x3b, 0x1b, 0x3f, 0x03, 0x78, 0xf7, 0x24, 0x0a, 0xb3, 0xdb, 0x24, 0xf2, 0x10, - 0x36, 0xfc, 0x62, 0xaf, 0x82, 0xb4, 0xb5, 0xfd, 0x72, 0xbc, 0x15, 0x0c, 0x29, 0x2f, 0x64, 0xc8, - 0xf8, 0x06, 0xc0, 0xce, 0xd9, 0x24, 0x20, 0x3b, 0xc1, 0x5e, 0x79, 0x06, 0x7b, 0x01, 0xab, 0xfa, - 0x62, 0x58, 0x5f, 0x97, 0xe1, 0xdd, 0x4f, 0x1e, 0x61, 0x7f, 0xb2, 0x7b, 0x79, 0x6e, 0x23, 0xbb, - 0x00, 0x5c, 0xfb, 0x07, 0x4a, 0x53, 0x76, 0xa6, 0xb4, 0xef, 0x00, 0xbc, 0x73, 0x9e, 0x06, 0x88, - 0xe1, 0x01, 0xef, 0xa0, 0x7f, 0xcd, 0x47, 0x1f, 0xee, 0x25, 0x78, 0xea, 0xc9, 0xde, 0x14, 0x94, - 0x38, 0x9d, 0x65, 0xae, 0xb7, 0x67, 0x28, 0x1e, 0x7f, 0x64, 0xac, 0x5d, 0x86, 0xdb, 0x48, 0xf0, - 0x54, 0x94, 0xdc, 0xc6, 0x95, 0xf1, 0x10, 0xaa, 0xc3, 0x31, 0x46, 0xd9, 0xed, 0x80, 0xdb, 0x22, - 0x23, 0xe3, 0x47, 0x00, 0xdb, 0xa7, 0x51, 0xc2, 0x35, 0x4f, 0xd7, 0x85, 0xee, 0x5d, 0x2b, 0xe4, - 0xb4, 0x97, 0xb9, 0xde, 0x92, 0x27, 0x11, 0xcb, 0xc6, 0xaa, 0xf4, 0x07, 0x7f, 0x53, 0xda, 0x39, - 0x58, 0xe6, 0xba, 0x2a, 0xa3, 0x37, 0x9c, 0xc6, 0x75, 0x48, 0x1f, 0x72, 0x48, 0xa2, 0xf3, 0xb8, - 0x82, 0x2a, 0x66, 0xd5, 0xd1, 0xe6, 0xb9, 0x5e, 0x97, 0xad, 0x47, 0x97, 0xb9, 0xfe, 0xaa, 0xdc, - 0x61, 0x15, 0x64, 0xb8, 0x75, 0xd9, 0x8e, 0xd4, 0xf8, 0x09, 0x40, 0xf5, 0x3c, 0x49, 0xff, 0x57, - 0x98, 0xbf, 0x05, 0x50, 0xdd, 0x9c, 0x2c, 0x52, 0x7a, 0x9b, 0xf7, 0x0f, 0xb8, 0xf1, 0xfe, 0xf9, - 0xfc, 0xc6, 0x21, 0x56, 0x7e, 0x99, 0x21, 0xe6, 0x54, 0x79, 0x8f, 0xdc, 0x30, 0xca, 0x8c, 0x05, - 0x80, 0xba, 0x04, 0x73, 0x7d, 0x88, 0x5d, 0x44, 0xe1, 0x7f, 0xc8, 0xec, 0x17, 0x70, 0x1f, 0x09, - 0xc8, 0x9e, 0x2f, 0x4a, 0x7b, 0x13, 0x01, 0x49, 0xd2, 0xdc, 0x3c, 0x7a, 0x7b, 0xfb, 0x09, 0x25, - 0xfe, 0xe2, 0x9c, 0x77, 0xd0, 0x73, 0x1e, 0xea, 0x7c, 0x7a, 0xf5, 0x54, 0x2b, 0x3d, 0x79, 0xaa, - 0x95, 0xbe, 0x9f, 0x6b, 0xe0, 0x6a, 0xae, 0x81, 0xc7, 0x73, 0x0d, 0xfc, 0x36, 0xd7, 0xc0, 0x57, - 0x0b, 0xad, 0xf4, 0x78, 0xa1, 0x95, 0x9e, 0x2c, 0xb4, 0xd2, 0x67, 0xf7, 0x36, 0x2e, 0x91, 0x21, - 0xa1, 0xf1, 0x83, 0xd5, 0x9b, 0x27, 0xb0, 0x1f, 0xc9, 0xb7, 0x8f, 0xb8, 0x48, 0x46, 0x8a, 0x78, - 0xf9, 0xbc, 0xf7, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x3f, 0xe6, 0xf2, 0x82, 0x09, 0x00, - 0x00, + // 834 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0xcf, 0xe4, 0x8f, 0x93, 0x9d, 0x8d, 0x20, 0xb8, 0xd9, 0x6d, 0x58, 0xc0, 0x8e, 0x0c, 0xaa, + 0x7c, 0xc1, 0x26, 0x8b, 0x84, 0x80, 0xdb, 0x3a, 0x70, 0xd8, 0x8a, 0x95, 0x56, 0x5e, 0xad, 0x2a, + 0x81, 0x84, 0x35, 0xb1, 0x67, 0x5d, 0x8b, 0xd8, 0x63, 0x79, 0xc6, 0x9b, 0xe6, 0x5b, 0x80, 0x84, + 0x38, 0xf5, 0x03, 0x20, 0x2e, 0x88, 0x3b, 0x1f, 0x60, 0xc5, 0xa9, 0xc7, 0x9e, 0x0c, 0x4d, 0xbe, + 0x41, 0x8e, 0x9c, 0xd0, 0xcc, 0x38, 0x21, 0xdb, 0xb2, 0x69, 0x11, 0x0d, 0x52, 0x2f, 0x4e, 0x66, + 0xde, 0x7b, 0xf3, 0x7e, 0xf3, 0xd3, 0xef, 0xbd, 0x37, 0x50, 0xf7, 0x09, 0x8d, 0x27, 0x88, 0xc6, + 0xb6, 0xf8, 0x5c, 0x0e, 0xec, 0x34, 0x23, 0x29, 0xa1, 0x68, 0x6c, 0xa5, 0x19, 0x61, 0x44, 0xed, + 0x2c, 0x1d, 0x2c, 0xf1, 0xb9, 0x1c, 0x1c, 0x74, 0x43, 0x12, 0x12, 0x61, 0xb4, 0xf9, 0x3f, 0xe9, + 0x77, 0xa0, 0x71, 0x3f, 0x42, 0xed, 0x11, 0xa2, 0xd8, 0xbe, 0x1c, 0x8c, 0x30, 0x43, 0x03, 0xdb, + 0x27, 0x51, 0x52, 0xda, 0xdf, 0x7e, 0x26, 0x11, 0x9b, 0xa6, 0x98, 0x4a, 0xab, 0xf1, 0xb0, 0x0a, + 0xdf, 0x38, 0x63, 0x24, 0xc3, 0x43, 0x12, 0xe0, 0xd3, 0x12, 0x81, 0xda, 0x85, 0x0d, 0x16, 0xb1, + 0x31, 0xee, 0x81, 0x3e, 0x30, 0x77, 0x5c, 0xb9, 0x50, 0xfb, 0x70, 0x37, 0xc0, 0xd4, 0xcf, 0xa2, + 0x94, 0x45, 0x24, 0xe9, 0x55, 0x85, 0x6d, 0x7d, 0x4b, 0xdd, 0x83, 0x4a, 0x96, 0x27, 0x1e, 0xa2, + 0xbd, 0x9a, 0x0c, 0xcc, 0xf2, 0xe4, 0x88, 0xaa, 0x1f, 0xc1, 0xd7, 0x78, 0x6e, 0x6f, 0x34, 0x65, + 0xd8, 0xf3, 0x49, 0x80, 0x7b, 0xf5, 0x3e, 0x30, 0xdb, 0x4e, 0x67, 0x56, 0xe8, 0xed, 0x7b, 0x47, + 0x67, 0x27, 0xce, 0x94, 0x09, 0x00, 0x6e, 0x9b, 0xfb, 0x2d, 0x57, 0xea, 0x39, 0xdc, 0x8f, 0x12, + 0xca, 0x50, 0xc2, 0x22, 0xc4, 0xb0, 0x97, 0xe2, 0x2c, 0x8e, 0x28, 0xe5, 0xb9, 0x9b, 0x7d, 0x60, + 0xee, 0x1e, 0x6a, 0xd6, 0xd3, 0x1c, 0x59, 0x47, 0xbe, 0x8f, 0x29, 0x1d, 0x92, 0xe4, 0x22, 0x0a, + 0xdd, 0xbd, 0xb5, 0xe8, 0xd3, 0x55, 0xb0, 0xfa, 0x0e, 0x84, 0x79, 0x92, 0x46, 0x89, 0x84, 0xd2, + 0xea, 0x03, 0xb3, 0xe5, 0xee, 0x88, 0x1d, 0x9e, 0xf5, 0x6e, 0xbd, 0xd5, 0xe8, 0x28, 0x77, 0xeb, + 0x2d, 0xa5, 0xd3, 0x34, 0x7e, 0xab, 0xc2, 0xb7, 0x8e, 0xff, 0x3e, 0x64, 0x48, 0x12, 0x96, 0x21, + 0x9f, 0x6d, 0x8b, 0xa8, 0x2e, 0x6c, 0xa0, 0x20, 0x8e, 0x12, 0xc1, 0xcf, 0x8e, 0x2b, 0x17, 0xea, + 0xbb, 0xb0, 0xc9, 0x91, 0x7a, 0x51, 0xd0, 0x6b, 0xf4, 0x81, 0x59, 0x77, 0xe0, 0xac, 0xd0, 0x15, + 0x8e, 0xf5, 0xf8, 0x33, 0x57, 0xe1, 0xa6, 0xe3, 0x80, 0x87, 0x8e, 0xd1, 0x08, 0x8f, 0x7b, 0x8a, + 0x0c, 0x15, 0x0b, 0xd5, 0x84, 0xb5, 0x98, 0x86, 0x82, 0xae, 0xb6, 0xb3, 0xff, 0x67, 0xa1, 0xab, + 0x2e, 0x9a, 0x2c, 0x6f, 0x71, 0x82, 0x29, 0x45, 0x21, 0x76, 0xb9, 0x8b, 0x8a, 0x60, 0xe3, 0x22, + 0x4f, 0x02, 0xda, 0x6b, 0xf5, 0x6b, 0xe6, 0xee, 0xe1, 0x9b, 0x96, 0x94, 0x95, 0xc5, 0x65, 0x65, + 0x95, 0xb2, 0xb2, 0x86, 0x24, 0x4a, 0x9c, 0x0f, 0xae, 0x0a, 0xbd, 0xf2, 0xd3, 0xef, 0xba, 0x19, + 0x46, 0xec, 0x7e, 0x3e, 0xb2, 0x7c, 0x12, 0xdb, 0xa5, 0x06, 0xe5, 0xcf, 0xfb, 0x34, 0xf8, 0xa6, + 0x14, 0x19, 0x0f, 0xa0, 0xae, 0x3c, 0xd9, 0xf8, 0x15, 0xc0, 0xdb, 0x27, 0x51, 0x98, 0xbd, 0x4c, + 0x22, 0x0f, 0x60, 0xcb, 0x2f, 0xcf, 0x2a, 0x49, 0x5b, 0xad, 0x5f, 0x8c, 0xb7, 0x92, 0x21, 0xe5, + 0xb9, 0x0c, 0x19, 0xdf, 0x03, 0xd8, 0x3d, 0xcb, 0x03, 0xb2, 0x15, 0xec, 0xb5, 0xa7, 0xb0, 0x97, + 0xb0, 0xea, 0xcf, 0x87, 0xf5, 0x5d, 0x15, 0xde, 0xfe, 0xfc, 0x01, 0xf6, 0xf3, 0xed, 0xcb, 0x73, + 0x13, 0xd9, 0x25, 0xe0, 0xc6, 0xbf, 0x50, 0x9a, 0xb2, 0x35, 0xa5, 0x3d, 0x04, 0xf0, 0xd6, 0x79, + 0x1a, 0x20, 0x86, 0x8f, 0x78, 0x05, 0xfd, 0x67, 0x3e, 0x06, 0x70, 0x27, 0xc1, 0x13, 0x4f, 0xd6, + 0xa6, 0xa0, 0xc4, 0xe9, 0x2e, 0x0a, 0xbd, 0x33, 0x45, 0xf1, 0xf8, 0x53, 0x63, 0x65, 0x32, 0xdc, + 0x56, 0x82, 0x27, 0x22, 0xe5, 0x26, 0xae, 0x8c, 0xfb, 0x50, 0x1d, 0x8e, 0x31, 0xca, 0x5e, 0x0e, + 0xb8, 0x0d, 0x32, 0x32, 0x7e, 0x06, 0xb0, 0x73, 0x2a, 0xfb, 0x1a, 0x5d, 0x25, 0xba, 0x73, 0x2d, + 0x91, 0xd3, 0x59, 0x14, 0x7a, 0x5b, 0xde, 0x44, 0x6c, 0x1b, 0xcb, 0xd4, 0x1f, 0xff, 0x43, 0x6a, + 0x67, 0x7f, 0x51, 0xe8, 0xaa, 0xf4, 0x5e, 0x33, 0x1a, 0xd7, 0x21, 0x7d, 0xc2, 0x21, 0x89, 0xca, + 0xe3, 0x0a, 0xaa, 0x99, 0x75, 0x47, 0x9b, 0x15, 0x7a, 0x53, 0x96, 0x1e, 0x5d, 0x14, 0xfa, 0xeb, + 0xf2, 0x84, 0xa5, 0x93, 0xe1, 0x36, 0x65, 0x39, 0x52, 0xe3, 0x17, 0x00, 0xd5, 0xf3, 0x65, 0x2f, + 0x7e, 0x45, 0x30, 0xff, 0x00, 0xa0, 0xba, 0x3e, 0x78, 0xa4, 0xf4, 0xd6, 0xfb, 0x0f, 0xb8, 0xb1, + 0xff, 0x7c, 0x75, 0xe3, 0x8c, 0xab, 0xbe, 0xc8, 0x8c, 0x73, 0xea, 0xbc, 0x46, 0x6e, 0x98, 0x74, + 0xc6, 0x1c, 0x40, 0x5d, 0x82, 0xb9, 0x3e, 0xc4, 0x2e, 0xa2, 0xf0, 0x7f, 0x64, 0xf6, 0x6b, 0xb8, + 0x87, 0x04, 0x64, 0xcf, 0x17, 0xa9, 0xbd, 0x5c, 0x40, 0x92, 0x34, 0xef, 0x1e, 0xbe, 0xb7, 0xf9, + 0x86, 0x12, 0x7f, 0x79, 0xcf, 0x5b, 0xe8, 0x19, 0x0b, 0x75, 0xbe, 0xb8, 0x7a, 0xa2, 0x55, 0x1e, + 0x3f, 0xd1, 0x2a, 0x3f, 0xce, 0x34, 0x70, 0x35, 0xd3, 0xc0, 0xa3, 0x99, 0x06, 0xfe, 0x98, 0x69, + 0xe0, 0xdb, 0xb9, 0x56, 0x79, 0x34, 0xd7, 0x2a, 0x8f, 0xe7, 0x5a, 0xe5, 0xcb, 0x3b, 0x6b, 0x4d, + 0x64, 0x48, 0x68, 0x7c, 0x6f, 0xf9, 0x24, 0x0a, 0xec, 0x07, 0xf2, 0x69, 0x24, 0x1a, 0xc9, 0x48, + 0x11, 0x0f, 0xa3, 0x0f, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xac, 0x4a, 0xb0, 0xa1, 0x09, + 0x00, 0x00, } func (this *StoreCodeProposal) Equal(that interface{}) bool { @@ -687,9 +631,11 @@ func (this *StoreCodeProposal) Equal(that interface{}) bool { if !this.InstantiatePermission.Equal(that1.InstantiatePermission) { return false } + if this.UnpinCode != that1.UnpinCode { + return false + } return true } - func (this *InstantiateContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -740,7 +686,6 @@ func (this *InstantiateContractProposal) Equal(that interface{}) bool { } return true } - func (this *MigrateContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -777,7 +722,6 @@ func (this *MigrateContractProposal) Equal(that interface{}) bool { } return true } - func (this *SudoContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -811,7 +755,6 @@ func (this *SudoContractProposal) Equal(that interface{}) bool { } return true } - func (this *ExecuteContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -856,7 +799,6 @@ func (this *ExecuteContractProposal) Equal(that interface{}) bool { } return true } - func (this *UpdateAdminProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -890,7 +832,6 @@ func (this *UpdateAdminProposal) Equal(that interface{}) bool { } return true } - func (this *ClearAdminProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -921,7 +862,6 @@ func (this *ClearAdminProposal) Equal(that interface{}) bool { } return true } - func (this *PinCodesProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -957,7 +897,6 @@ func (this *PinCodesProposal) Equal(that interface{}) bool { } return true } - func (this *UnpinCodesProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -993,7 +932,6 @@ func (this *UnpinCodesProposal) Equal(that interface{}) bool { } return true } - func (this *AccessConfigUpdate) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1021,7 +959,6 @@ func (this *AccessConfigUpdate) Equal(that interface{}) bool { } return true } - func (this *UpdateInstantiateConfigProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1057,7 +994,6 @@ func (this *UpdateInstantiateConfigProposal) Equal(that interface{}) bool { } return true } - func (m *StoreCodeProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1078,6 +1014,16 @@ func (m *StoreCodeProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.UnpinCode { + i-- + if m.UnpinCode { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } if m.InstantiatePermission != nil { { size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) @@ -1689,7 +1635,6 @@ func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *StoreCodeProposal) Size() (n int) { if m == nil { return 0 @@ -1716,6 +1661,9 @@ func (m *StoreCodeProposal) Size() (n int) { l = m.InstantiatePermission.Size() n += 1 + l + sovProposal(uint64(l)) } + if m.UnpinCode { + n += 2 + } return n } @@ -1983,11 +1931,9 @@ func (m *UpdateInstantiateConfigProposal) Size() (n int) { func sovProposal(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozProposal(x uint64) (n int) { return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2183,6 +2129,26 @@ func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnpinCode", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UnpinCode = bool(v != 0) default: iNdEx = preIndex skippy, err := skipProposal(dAtA[iNdEx:]) @@ -2204,7 +2170,6 @@ func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *InstantiateContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2502,7 +2467,6 @@ func (m *InstantiateContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2702,7 +2666,6 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *SudoContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2883,7 +2846,6 @@ func (m *SudoContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *ExecuteContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3130,7 +3092,6 @@ func (m *ExecuteContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *UpdateAdminProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3309,7 +3270,6 @@ func (m *UpdateAdminProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *ClearAdminProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3456,7 +3416,6 @@ func (m *ClearAdminProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *PinCodesProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3647,7 +3606,6 @@ func (m *PinCodesProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3838,7 +3796,6 @@ func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *AccessConfigUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3941,7 +3898,6 @@ func (m *AccessConfigUpdate) Unmarshal(dAtA []byte) error { } return nil } - func (m *UpdateInstantiateConfigProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4090,7 +4046,6 @@ func (m *UpdateInstantiateConfigProposal) Unmarshal(dAtA []byte) error { } return nil } - func skipProposal(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/proposal_test.go b/x/wasm/types/proposal_test.go index fcc378d39..fe5139c44 100644 --- a/x/wasm/types/proposal_test.go +++ b/x/wasm/types/proposal_test.go @@ -7,7 +7,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" @@ -48,7 +48,7 @@ func TestValidateProposalCommons(t *testing.T) { }, "prevent title exceeds max length ": { src: commonProposal{ - Title: strings.Repeat("a", govtypes.MaxTitleLength+1), + Title: strings.Repeat("a", govv1beta1.MaxTitleLength+1), Description: "Bar", }, expErr: true, @@ -76,7 +76,7 @@ func TestValidateProposalCommons(t *testing.T) { "prevent descr exceeds max length ": { src: commonProposal{ Title: "Foo", - Description: strings.Repeat("a", govtypes.MaxDescriptionLength+1), + Description: strings.Repeat("a", govv1beta1.MaxDescriptionLength+1), }, expErr: true, }, @@ -521,7 +521,7 @@ func TestValidateClearAdminProposal(t *testing.T) { func TestProposalStrings(t *testing.T) { specs := map[string]struct { - src govtypes.Content + src govv1beta1.Content exp string }{ "store code": { @@ -637,7 +637,7 @@ func TestProposalStrings(t *testing.T) { func TestProposalYaml(t *testing.T) { specs := map[string]struct { - src govtypes.Content + src govv1beta1.Content exp string }{ "store code": { @@ -782,8 +782,8 @@ func TestConvertToProposals(t *testing.T) { func TestUnmarshalContentFromJson(t *testing.T) { specs := map[string]struct { src string - got govtypes.Content - exp govtypes.Content + got govv1beta1.Content + exp govv1beta1.Content }{ "instantiate ": { src: ` @@ -840,7 +840,7 @@ func TestUnmarshalContentFromJson(t *testing.T) { func TestProposalJsonSignBytes(t *testing.T) { const myInnerMsg = `{"foo":"bar"}` specs := map[string]struct { - src govtypes.Content + src govv1beta1.Content exp string }{ "instantiate contract": { @@ -862,7 +862,7 @@ func TestProposalJsonSignBytes(t *testing.T) { } for name, spec := range specs { t.Run(name, func(t *testing.T) { - msg, err := govtypes.NewMsgSubmitProposal(spec.src, sdk.NewCoins(), []byte{}) + msg, err := govv1beta1.NewMsgSubmitProposal(spec.src, sdk.NewCoins(), []byte{}) require.NoError(t, err) bz := msg.GetSignBytes() diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 51aead5aa..3fdb274db 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -7,10 +7,6 @@ import ( bytes "bytes" context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -20,15 +16,15 @@ 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 - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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. @@ -49,11 +45,9 @@ 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) @@ -66,15 +60,12 @@ 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) } @@ -95,11 +86,9 @@ 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) @@ -112,15 +101,12 @@ 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) } @@ -142,11 +128,9 @@ 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) @@ -159,15 +143,12 @@ 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) } @@ -188,11 +169,9 @@ 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) @@ -205,15 +184,12 @@ 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) } @@ -234,11 +210,9 @@ 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) @@ -251,15 +225,12 @@ 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) } @@ -281,11 +252,9 @@ 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) @@ -298,15 +267,12 @@ 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) } @@ -328,11 +294,9 @@ 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) @@ -345,15 +309,12 @@ 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) } @@ -374,11 +335,9 @@ 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) @@ -391,15 +350,12 @@ 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) } @@ -420,11 +376,9 @@ 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) @@ -437,15 +391,12 @@ 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) } @@ -465,11 +416,9 @@ 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) @@ -482,15 +431,12 @@ 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) } @@ -512,11 +458,9 @@ 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) @@ -529,15 +473,12 @@ 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) } @@ -557,11 +498,9 @@ 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) @@ -574,15 +513,12 @@ 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) } @@ -600,11 +536,9 @@ 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) @@ -617,15 +551,12 @@ 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) } @@ -646,11 +577,9 @@ 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) @@ -663,15 +592,12 @@ 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) } @@ -690,11 +616,9 @@ 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) @@ -707,15 +631,12 @@ 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) } @@ -734,11 +655,9 @@ 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) @@ -751,15 +670,12 @@ 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) } @@ -779,11 +695,9 @@ 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) @@ -796,15 +710,12 @@ 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) } @@ -824,11 +735,9 @@ 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) @@ -841,15 +750,12 @@ 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) } @@ -870,11 +776,9 @@ 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) @@ -887,21 +791,94 @@ 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) } var xxx_messageInfo_QueryPinnedCodesResponse proto.InternalMessageInfo +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +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) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + 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) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +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) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + 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) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryContractInfoRequest)(nil), "cosmwasm.wasm.v1.QueryContractInfoRequest") proto.RegisterType((*QueryContractInfoResponse)(nil), "cosmwasm.wasm.v1.QueryContractInfoResponse") @@ -922,87 +899,92 @@ func init() { proto.RegisterType((*QueryCodesResponse)(nil), "cosmwasm.wasm.v1.QueryCodesResponse") proto.RegisterType((*QueryPinnedCodesRequest)(nil), "cosmwasm.wasm.v1.QueryPinnedCodesRequest") proto.RegisterType((*QueryPinnedCodesResponse)(nil), "cosmwasm.wasm.v1.QueryPinnedCodesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmwasm.wasm.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasm.wasm.v1.QueryParamsResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x4f, 0x24, 0x45, - 0x14, 0xc7, 0xa7, 0xd8, 0x61, 0x7e, 0x14, 0x98, 0x1d, 0x2b, 0x0a, 0xe3, 0xc8, 0x76, 0x93, 0x76, - 0x83, 0x2c, 0x8b, 0xdd, 0xc2, 0x42, 0x56, 0x4d, 0x8c, 0xd9, 0x61, 0x75, 0x81, 0x84, 0x84, 0xed, - 0x8d, 0xd9, 0xc4, 0x3d, 0x90, 0x9a, 0xe9, 0x62, 0xe8, 0x84, 0xe9, 0x1a, 0xba, 0x0a, 0xd8, 0x09, - 0x41, 0xcd, 0x26, 0x1e, 0x4c, 0x8c, 0x9a, 0x18, 0x8f, 0x46, 0x0f, 0x66, 0xf5, 0xac, 0x37, 0xff, - 0x02, 0x8e, 0x24, 0x5e, 0x3c, 0x4d, 0x74, 0xf0, 0x60, 0xf8, 0x13, 0xf6, 0x64, 0xaa, 0xba, 0x7a, - 0xe8, 0xf9, 0xd1, 0xcc, 0xb0, 0x21, 0x7b, 0x21, 0xdd, 0xd4, 0xab, 0x57, 0x9f, 0xf7, 0xed, 0x57, - 0xef, 0xbd, 0x81, 0x13, 0x65, 0xca, 0xaa, 0xfb, 0x98, 0x55, 0x2d, 0xf9, 0x67, 0x6f, 0xce, 0xda, - 0xd9, 0x25, 0x7e, 0xdd, 0xac, 0xf9, 0x94, 0x53, 0x94, 0x0b, 0x57, 0x4d, 0xf9, 0x67, 0x6f, 0xae, - 0xf0, 0x4a, 0x85, 0x56, 0xa8, 0x5c, 0xb4, 0xc4, 0x53, 0x60, 0x57, 0xe8, 0xf6, 0xc2, 0xeb, 0x35, - 0xc2, 0xc2, 0xd5, 0x0a, 0xa5, 0x95, 0x6d, 0x62, 0xe1, 0x9a, 0x6b, 0x61, 0xcf, 0xa3, 0x1c, 0x73, - 0x97, 0x7a, 0xe1, 0xea, 0x8c, 0xd8, 0x4b, 0x99, 0x55, 0xc2, 0x8c, 0x04, 0x87, 0x5b, 0x7b, 0x73, - 0x25, 0xc2, 0xf1, 0x9c, 0x55, 0xc3, 0x15, 0xd7, 0x93, 0xc6, 0x81, 0xad, 0xb1, 0x00, 0xf3, 0xf7, - 0x85, 0xc5, 0x12, 0xf5, 0xb8, 0x8f, 0xcb, 0x7c, 0xc5, 0xdb, 0xa4, 0x36, 0xd9, 0xd9, 0x25, 0x8c, - 0xa3, 0x3c, 0x4c, 0x63, 0xc7, 0xf1, 0x09, 0x63, 0x79, 0x30, 0x09, 0xa6, 0xb3, 0x76, 0xf8, 0x6a, - 0x7c, 0x0d, 0xe0, 0x6b, 0x3d, 0xb6, 0xb1, 0x1a, 0xf5, 0x18, 0x89, 0xdf, 0x87, 0xee, 0xc3, 0x97, - 0xca, 0x6a, 0xc7, 0x86, 0xeb, 0x6d, 0xd2, 0xfc, 0xd0, 0x24, 0x98, 0x1e, 0x99, 0xd7, 0xcc, 0x4e, - 0x55, 0xcc, 0xa8, 0xe3, 0xe2, 0xe8, 0x51, 0x43, 0x4f, 0x1c, 0x37, 0x74, 0x70, 0xda, 0xd0, 0x13, - 0xf6, 0x68, 0x39, 0xb2, 0xf6, 0x5e, 0xf2, 0xbf, 0x9f, 0x74, 0x60, 0x7c, 0x06, 0x5f, 0x6f, 0xe3, - 0x59, 0x76, 0x19, 0xa7, 0x7e, 0xbd, 0x6f, 0x24, 0xe8, 0x23, 0x08, 0xcf, 0x34, 0x51, 0x38, 0x53, - 0x66, 0x20, 0xa0, 0x29, 0x04, 0x34, 0x83, 0xaf, 0xa7, 0x04, 0x34, 0xd7, 0x71, 0x85, 0x28, 0xaf, - 0x76, 0x64, 0xa7, 0xf1, 0x3b, 0x80, 0x13, 0xbd, 0x09, 0x94, 0x28, 0xab, 0x30, 0x4d, 0x3c, 0xee, - 0xbb, 0x44, 0x20, 0x5c, 0x99, 0x1e, 0x99, 0x9f, 0x89, 0x0f, 0x7a, 0x89, 0x3a, 0x44, 0xed, 0xff, - 0xd0, 0xe3, 0x7e, 0xbd, 0x98, 0x14, 0x02, 0xd8, 0xa1, 0x03, 0x74, 0xaf, 0x07, 0xf4, 0x9b, 0x7d, - 0xa1, 0x03, 0x90, 0x36, 0xea, 0x4f, 0x3b, 0x64, 0x63, 0xc5, 0xba, 0x38, 0x3b, 0x94, 0x6d, 0x1c, - 0xa6, 0xcb, 0xd4, 0x21, 0x1b, 0xae, 0x23, 0x65, 0x4b, 0xda, 0x29, 0xf1, 0xba, 0xe2, 0x5c, 0x9a, - 0x6a, 0x5f, 0x74, 0xaa, 0xd6, 0x02, 0x50, 0xaa, 0x4d, 0xc0, 0x6c, 0xf8, 0xb5, 0x03, 0xdd, 0xb2, - 0xf6, 0xd9, 0x3f, 0x2e, 0x4f, 0x87, 0xcf, 0x43, 0x8e, 0x3b, 0xdb, 0xdb, 0x21, 0xca, 0x03, 0x8e, - 0x39, 0x79, 0x71, 0x09, 0xf4, 0x23, 0x80, 0xd7, 0x62, 0x10, 0x94, 0x16, 0x8b, 0x30, 0x55, 0xa5, - 0x0e, 0xd9, 0x0e, 0x13, 0x68, 0xbc, 0x3b, 0x81, 0xd6, 0xc4, 0xba, 0xca, 0x16, 0x65, 0x7c, 0x79, - 0x22, 0x3d, 0x54, 0x1a, 0xd9, 0x78, 0xff, 0x82, 0x1a, 0x5d, 0x83, 0x50, 0x9e, 0xb1, 0xe1, 0x60, - 0x8e, 0x25, 0xc2, 0xa8, 0x9d, 0x95, 0xff, 0xb9, 0x8b, 0x39, 0x36, 0x6e, 0xa9, 0xc8, 0xbb, 0x1d, - 0xab, 0xc8, 0x11, 0x4c, 0xca, 0x9d, 0x40, 0xee, 0x94, 0xcf, 0xc6, 0x0e, 0xd4, 0xe4, 0xa6, 0x07, - 0x55, 0xec, 0xf3, 0x0b, 0xf2, 0x2c, 0x76, 0xf3, 0x14, 0xc7, 0x9e, 0x35, 0x74, 0x14, 0x21, 0x58, - 0x23, 0x8c, 0x09, 0x25, 0x22, 0x9c, 0x6b, 0x50, 0x8f, 0x3d, 0x52, 0x91, 0xce, 0x44, 0x49, 0x63, - 0x7d, 0x06, 0x11, 0xdc, 0x84, 0x39, 0x95, 0xfb, 0xfd, 0x6f, 0x9c, 0xf1, 0xc3, 0x10, 0xcc, 0x09, - 0xc3, 0xb6, 0x42, 0x7b, 0xa3, 0xc3, 0xba, 0x98, 0x6b, 0x36, 0xf4, 0x94, 0x34, 0xbb, 0x7b, 0xda, - 0xd0, 0x87, 0x5c, 0xa7, 0x75, 0x63, 0xf3, 0x30, 0x5d, 0xf6, 0x09, 0xe6, 0xd4, 0x97, 0xf1, 0x66, - 0xed, 0xf0, 0x15, 0x7d, 0x0c, 0xb3, 0x02, 0x67, 0x63, 0x0b, 0xb3, 0xad, 0xfc, 0x15, 0xc9, 0xfd, - 0xce, 0xb3, 0x86, 0xbe, 0x50, 0x71, 0xf9, 0xd6, 0x6e, 0xc9, 0x2c, 0xd3, 0xaa, 0xc5, 0x89, 0xe7, - 0x10, 0xbf, 0xea, 0x7a, 0x3c, 0xfa, 0xb8, 0xed, 0x96, 0x98, 0x55, 0xaa, 0x73, 0xc2, 0xcc, 0x65, - 0xf2, 0xb8, 0x28, 0x1e, 0xec, 0x8c, 0x70, 0xb5, 0x8c, 0xd9, 0x16, 0x7a, 0x04, 0xc7, 0x5c, 0x8f, - 0x71, 0xec, 0x71, 0x17, 0x73, 0xb2, 0x51, 0x13, 0x9b, 0x18, 0x13, 0x29, 0x98, 0x8a, 0xab, 0xf9, - 0x77, 0xca, 0x65, 0xc2, 0xd8, 0x12, 0xf5, 0x36, 0xdd, 0x8a, 0x4a, 0xe2, 0x57, 0x23, 0x3e, 0xd6, - 0x5b, 0x2e, 0x82, 0xa2, 0xbf, 0x9a, 0xcc, 0x24, 0x73, 0xc3, 0xab, 0xc9, 0xcc, 0x70, 0x2e, 0x65, - 0x3c, 0x01, 0xf0, 0xe5, 0x88, 0x9a, 0x4a, 0xa0, 0x15, 0x51, 0x3e, 0x84, 0x40, 0xa2, 0xd7, 0x00, - 0x79, 0xae, 0xd1, 0xab, 0xec, 0xb6, 0xeb, 0x5a, 0xcc, 0xb4, 0x7a, 0x4d, 0xa6, 0xac, 0xd6, 0xd0, - 0x84, 0xfa, 0xb2, 0x41, 0xb6, 0x64, 0x4e, 0x1b, 0xba, 0x7c, 0x0f, 0xbe, 0xa5, 0xea, 0x42, 0x8f, - 0x22, 0x0c, 0x2c, 0xfc, 0xa4, 0xed, 0x05, 0x02, 0x3c, 0x77, 0x81, 0x78, 0x0a, 0x20, 0x8a, 0x7a, - 0x57, 0x21, 0xde, 0x83, 0xb0, 0x15, 0x62, 0x58, 0x19, 0x06, 0x89, 0x31, 0xd0, 0x37, 0x1b, 0xc6, - 0x77, 0x89, 0x75, 0x02, 0xc3, 0x71, 0xc9, 0xb9, 0xee, 0x7a, 0x1e, 0x71, 0xce, 0xd1, 0xe2, 0xf9, - 0x8b, 0xe5, 0x37, 0x40, 0x8d, 0x2d, 0x6d, 0x67, 0xb4, 0xee, 0x60, 0x46, 0xdd, 0x8a, 0x40, 0x8f, - 0x64, 0xf1, 0xaa, 0x88, 0xb5, 0xd9, 0xd0, 0xd3, 0xc1, 0xd5, 0x60, 0x76, 0x3a, 0xb8, 0x15, 0x97, - 0x17, 0xf4, 0xfc, 0x97, 0x23, 0x70, 0x58, 0x12, 0xa1, 0xef, 0x01, 0x1c, 0x8d, 0x4e, 0x2f, 0xa8, - 0x47, 0xa3, 0x8f, 0x1b, 0xb9, 0x0a, 0x37, 0x07, 0xb2, 0x0d, 0xce, 0x37, 0x66, 0x9f, 0xfc, 0xf9, - 0xef, 0x77, 0x43, 0x53, 0xe8, 0xba, 0xd5, 0x35, 0x2c, 0x86, 0x3d, 0xd2, 0x3a, 0x50, 0x35, 0xef, - 0x10, 0x3d, 0x05, 0xf0, 0x6a, 0xc7, 0x70, 0x82, 0xde, 0xea, 0x73, 0x5c, 0xfb, 0x18, 0x55, 0x30, - 0x07, 0x35, 0x57, 0x80, 0x0b, 0x12, 0xd0, 0x44, 0xb3, 0x83, 0x00, 0x5a, 0x5b, 0x0a, 0xea, 0xe7, - 0x08, 0xa8, 0x9a, 0x07, 0xfa, 0x82, 0xb6, 0x0f, 0x2e, 0x7d, 0x41, 0x3b, 0xc6, 0x0c, 0x63, 0x5e, - 0x82, 0xce, 0xa2, 0x99, 0x5e, 0xa0, 0x0e, 0xb1, 0x0e, 0x54, 0x42, 0x1d, 0x5a, 0x67, 0xc3, 0xc7, - 0x2f, 0x00, 0xe6, 0x3a, 0x7b, 0x35, 0x8a, 0x3b, 0x38, 0x66, 0xae, 0x28, 0x58, 0x03, 0xdb, 0x0f, - 0x42, 0xda, 0x25, 0x29, 0x93, 0x50, 0xbf, 0x01, 0x98, 0xeb, 0xec, 0xad, 0xb1, 0xa4, 0x31, 0xdd, - 0x3d, 0x96, 0x34, 0xae, 0x69, 0x1b, 0xef, 0x4b, 0xd2, 0xdb, 0x68, 0x71, 0x20, 0x52, 0x1f, 0xef, - 0x5b, 0x07, 0x67, 0x4d, 0xf9, 0x10, 0xfd, 0x01, 0x20, 0xea, 0x6e, 0xb4, 0xe8, 0xed, 0x18, 0x8c, - 0xd8, 0x31, 0xa0, 0x30, 0x77, 0x81, 0x1d, 0x0a, 0xfd, 0x03, 0x89, 0xfe, 0x2e, 0xba, 0x3d, 0x98, - 0xc8, 0xc2, 0x51, 0x3b, 0x7c, 0x1d, 0x26, 0x65, 0xda, 0x1a, 0xb1, 0x79, 0x78, 0x96, 0xab, 0x6f, - 0x9c, 0x6b, 0xa3, 0x88, 0xa6, 0x25, 0x91, 0x81, 0x26, 0xfb, 0x25, 0x28, 0xf2, 0xe1, 0xb0, 0x2c, - 0x87, 0xe8, 0x3c, 0xbf, 0x61, 0x41, 0x2e, 0x5c, 0x3f, 0xdf, 0x48, 0x9d, 0xae, 0xc9, 0xd3, 0xf3, - 0x68, 0xac, 0xf7, 0xe9, 0xe8, 0x2b, 0x00, 0x47, 0x22, 0x95, 0x18, 0xdd, 0x88, 0xf1, 0xda, 0xdd, - 0x11, 0x0a, 0x33, 0x83, 0x98, 0x2a, 0x8c, 0x29, 0x89, 0x31, 0x89, 0xb4, 0xde, 0x18, 0xcc, 0xaa, - 0xc9, 0x4d, 0xc5, 0xe5, 0xa3, 0x7f, 0xb4, 0xc4, 0xaf, 0x4d, 0x2d, 0x71, 0xd4, 0xd4, 0xc0, 0x71, - 0x53, 0x03, 0x7f, 0x37, 0x35, 0xf0, 0xed, 0x89, 0x96, 0x38, 0x3e, 0xd1, 0x12, 0x7f, 0x9d, 0x68, - 0x89, 0x4f, 0xa6, 0x22, 0xc3, 0xcd, 0x12, 0x65, 0xd5, 0x87, 0xa1, 0x2f, 0xc7, 0x7a, 0x1c, 0xf8, - 0x94, 0xbf, 0xb6, 0x4b, 0x29, 0xf9, 0x23, 0xf9, 0xd6, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, - 0x7b, 0x25, 0x05, 0xd4, 0x0f, 0x00, 0x00, + // 1245 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, 0xa0, 0x9a, 0xa1, 0x24, 0xc6, 0xa4, 0xbb, 0xd1, 0x52, + 0x42, 0x9a, 0x86, 0x5d, 0x92, 0x26, 0x14, 0x90, 0x10, 0xaa, 0x53, 0x68, 0x12, 0x29, 0x52, 0xba, + 0x15, 0xaa, 0x44, 0x0f, 0xd1, 0xd8, 0x3b, 0x71, 0x56, 0x8a, 0x77, 0x9c, 0x9d, 0x49, 0x52, 0x2b, + 0x0a, 0xa0, 0x4a, 0x48, 0x1c, 0x10, 0x20, 0x21, 0x8e, 0x08, 0x0e, 0xa8, 0x70, 0x86, 0x1b, 0x7f, + 0x41, 0x8e, 0x91, 0xb8, 0x70, 0xb2, 0xc0, 0xe1, 0x80, 0xf2, 0x27, 0xf4, 0x84, 0x76, 0x76, 0xd6, + 0xd9, 0xb5, 0xbd, 0xb1, 0x53, 0x59, 0xbd, 0x58, 0xfb, 0xe3, 0xbd, 0x37, 0x9f, 0xf7, 0x9d, 0xb7, + 0x6f, 0x9e, 0x0c, 0x27, 0xca, 0x94, 0x55, 0xf7, 0x31, 0xab, 0x1a, 0xe2, 0x67, 0x6f, 0xce, 0xd8, + 0xd9, 0x25, 0x6e, 0x5d, 0xaf, 0xb9, 0x94, 0x53, 0x94, 0x0b, 0xde, 0xea, 0xe2, 0x67, 0x6f, 0xae, + 0x70, 0xa5, 0x42, 0x2b, 0x54, 0xbc, 0x34, 0xbc, 0x2b, 0xdf, 0xae, 0xd0, 0x19, 0x85, 0xd7, 0x6b, + 0x84, 0x05, 0x6f, 0x2b, 0x94, 0x56, 0xb6, 0x89, 0x81, 0x6b, 0xb6, 0x81, 0x1d, 0x87, 0x72, 0xcc, + 0x6d, 0xea, 0x04, 0x6f, 0x67, 0x3c, 0x5f, 0xca, 0x8c, 0x12, 0x66, 0xc4, 0x5f, 0xdc, 0xd8, 0x9b, + 0x2b, 0x11, 0x8e, 0xe7, 0x8c, 0x1a, 0xae, 0xd8, 0x8e, 0x30, 0xf6, 0x6d, 0xb5, 0x05, 0x98, 0xbf, + 0xe7, 0x59, 0x2c, 0x51, 0x87, 0xbb, 0xb8, 0xcc, 0x57, 0x9c, 0x4d, 0x6a, 0x92, 0x9d, 0x5d, 0xc2, + 0x38, 0xca, 0xc3, 0x34, 0xb6, 0x2c, 0x97, 0x30, 0x96, 0x07, 0x93, 0x60, 0x3a, 0x6b, 0x06, 0xb7, + 0xda, 0xd7, 0x00, 0xbe, 0xd2, 0xc5, 0x8d, 0xd5, 0xa8, 0xc3, 0x48, 0xbc, 0x1f, 0xba, 0x07, 0x5f, + 0x28, 0x4b, 0x8f, 0x0d, 0xdb, 0xd9, 0xa4, 0xf9, 0xa1, 0x49, 0x30, 0x3d, 0x32, 0xaf, 0xe8, 0xed, + 0xaa, 0xe8, 0xe1, 0xc0, 0xc5, 0xd1, 0xa3, 0x86, 0x9a, 0x38, 0x6e, 0xa8, 0xe0, 0xb4, 0xa1, 0x26, + 0xcc, 0xd1, 0x72, 0xe8, 0xdd, 0x7b, 0xc9, 0xff, 0x7e, 0x52, 0x81, 0xf6, 0x19, 0x7c, 0x35, 0xc2, + 0xb3, 0x6c, 0x33, 0x4e, 0xdd, 0x7a, 0xcf, 0x4c, 0xd0, 0x47, 0x10, 0x9e, 0x69, 0x22, 0x71, 0xa6, + 0x74, 0x5f, 0x40, 0xdd, 0x13, 0x50, 0xf7, 0x77, 0x4f, 0x0a, 0xa8, 0xaf, 0xe3, 0x0a, 0x91, 0x51, + 0xcd, 0x90, 0xa7, 0xf6, 0x3b, 0x80, 0x13, 0xdd, 0x09, 0xa4, 0x28, 0xab, 0x30, 0x4d, 0x1c, 0xee, + 0xda, 0xc4, 0x43, 0xb8, 0x34, 0x3d, 0x32, 0x3f, 0x13, 0x9f, 0xf4, 0x12, 0xb5, 0x88, 0xf4, 0xff, + 0xd0, 0xe1, 0x6e, 0xbd, 0x98, 0xf4, 0x04, 0x30, 0x83, 0x00, 0xe8, 0x6e, 0x17, 0xe8, 0x37, 0x7a, + 0x42, 0xfb, 0x20, 0x11, 0xea, 0x4f, 0xdb, 0x64, 0x63, 0xc5, 0xba, 0xb7, 0x76, 0x20, 0xdb, 0x38, + 0x4c, 0x97, 0xa9, 0x45, 0x36, 0x6c, 0x4b, 0xc8, 0x96, 0x34, 0x53, 0xde, 0xed, 0x8a, 0x35, 0x30, + 0xd5, 0xbe, 0x68, 0x57, 0xad, 0x05, 0x20, 0x55, 0x9b, 0x80, 0xd9, 0x60, 0xb7, 0x7d, 0xdd, 0xb2, + 0xe6, 0xd9, 0x83, 0xc1, 0xe9, 0xf0, 0x79, 0xc0, 0x71, 0x7b, 0x7b, 0x3b, 0x40, 0xb9, 0xcf, 0x31, + 0x27, 0xcf, 0xaf, 0x80, 0x7e, 0x04, 0xf0, 0x6a, 0x0c, 0x82, 0xd4, 0x62, 0x11, 0xa6, 0xaa, 0xd4, + 0x22, 0xdb, 0x41, 0x01, 0x8d, 0x77, 0x16, 0xd0, 0x9a, 0xf7, 0x5e, 0x56, 0x8b, 0x34, 0x1e, 0x9c, + 0x48, 0x0f, 0xa4, 0x46, 0x26, 0xde, 0xbf, 0xa0, 0x46, 0x57, 0x21, 0x14, 0x6b, 0x6c, 0x58, 0x98, + 0x63, 0x81, 0x30, 0x6a, 0x66, 0xc5, 0x93, 0x3b, 0x98, 0x63, 0xed, 0xa6, 0xcc, 0xbc, 0x33, 0xb0, + 0xcc, 0x1c, 0xc1, 0xa4, 0xf0, 0x04, 0xc2, 0x53, 0x5c, 0x6b, 0x3b, 0x50, 0x11, 0x4e, 0xf7, 0xab, + 0xd8, 0xe5, 0x17, 0xe4, 0x59, 0xec, 0xe4, 0x29, 0x8e, 0x3d, 0x6d, 0xa8, 0x28, 0x44, 0xb0, 0x46, + 0x18, 0xf3, 0x94, 0x08, 0x71, 0xae, 0x41, 0x35, 0x76, 0x49, 0x49, 0x3a, 0x13, 0x26, 0x8d, 0x8d, + 0xe9, 0x67, 0x70, 0x03, 0xe6, 0x64, 0xed, 0xf7, 0xfe, 0xe2, 0xb4, 0x1f, 0x86, 0x60, 0xce, 0x33, + 0x8c, 0x34, 0xda, 0xeb, 0x6d, 0xd6, 0xc5, 0x5c, 0xb3, 0xa1, 0xa6, 0x84, 0xd9, 0x9d, 0xd3, 0x86, + 0x3a, 0x64, 0x5b, 0xad, 0x2f, 0x36, 0x0f, 0xd3, 0x65, 0x97, 0x60, 0x4e, 0x5d, 0x91, 0x6f, 0xd6, + 0x0c, 0x6e, 0xd1, 0xc7, 0x30, 0xeb, 0xe1, 0x6c, 0x6c, 0x61, 0xb6, 0x95, 0xbf, 0x24, 0xb8, 0xdf, + 0x79, 0xda, 0x50, 0x17, 0x2a, 0x36, 0xdf, 0xda, 0x2d, 0xe9, 0x65, 0x5a, 0x35, 0x38, 0x71, 0x2c, + 0xe2, 0x56, 0x6d, 0x87, 0x87, 0x2f, 0xb7, 0xed, 0x12, 0x33, 0x4a, 0x75, 0x4e, 0x98, 0xbe, 0x4c, + 0x1e, 0x15, 0xbd, 0x0b, 0x33, 0xe3, 0x85, 0x5a, 0xc6, 0x6c, 0x0b, 0x3d, 0x84, 0x63, 0xb6, 0xc3, + 0x38, 0x76, 0xb8, 0x8d, 0x39, 0xd9, 0xa8, 0x79, 0x4e, 0x8c, 0x79, 0x25, 0x98, 0x8a, 0xeb, 0xf9, + 0xb7, 0xcb, 0x65, 0xc2, 0xd8, 0x12, 0x75, 0x36, 0xed, 0x8a, 0x2c, 0xe2, 0x97, 0x43, 0x31, 0xd6, + 0x5b, 0x21, 0xfc, 0xa6, 0xbf, 0x9a, 0xcc, 0x24, 0x73, 0xc3, 0xab, 0xc9, 0xcc, 0x70, 0x2e, 0xa5, + 0x3d, 0x06, 0xf0, 0xc5, 0x90, 0x9a, 0x52, 0xa0, 0x15, 0xaf, 0x7d, 0x78, 0x02, 0x79, 0x67, 0x0d, + 0x10, 0xeb, 0x6a, 0xdd, 0xda, 0x6e, 0x54, 0xd7, 0x62, 0xa6, 0x75, 0xd6, 0x64, 0xca, 0xf2, 0x1d, + 0x9a, 0x90, 0x3b, 0xeb, 0x57, 0x4b, 0xe6, 0xb4, 0xa1, 0x8a, 0x7b, 0x7f, 0x2f, 0xe5, 0x29, 0xf4, + 0x30, 0xc4, 0xc0, 0x82, 0x2d, 0x8d, 0x36, 0x08, 0xf0, 0xcc, 0x0d, 0xe2, 0x09, 0x80, 0x28, 0x1c, + 0x5d, 0xa6, 0x78, 0x17, 0xc2, 0x56, 0x8a, 0x41, 0x67, 0xe8, 0x27, 0x47, 0x5f, 0xdf, 0x6c, 0x90, + 0xdf, 0x00, 0xfb, 0x04, 0x86, 0xe3, 0x82, 0x73, 0xdd, 0x76, 0x1c, 0x62, 0x9d, 0xa3, 0xc5, 0xb3, + 0x37, 0xcb, 0x6f, 0x80, 0x1c, 0x5b, 0x22, 0x6b, 0xb4, 0xbe, 0xc1, 0x8c, 0xfc, 0x2a, 0x7c, 0x3d, + 0x92, 0xc5, 0xcb, 0x5e, 0xae, 0xcd, 0x86, 0x9a, 0xf6, 0x3f, 0x0d, 0x66, 0xa6, 0xfd, 0xaf, 0x62, + 0x80, 0x49, 0x5f, 0x91, 0x9b, 0xb3, 0x8e, 0x5d, 0x5c, 0x0d, 0xf2, 0xd5, 0xd6, 0xe0, 0x4b, 0x91, + 0xa7, 0x92, 0xf0, 0x6d, 0x98, 0xaa, 0x89, 0x27, 0xb2, 0x1c, 0xf2, 0x9d, 0xfb, 0xe5, 0x7b, 0x04, + 0xad, 0xdc, 0xb7, 0x9e, 0xff, 0x72, 0x14, 0x0e, 0x8b, 0x78, 0xe8, 0x7b, 0x00, 0x47, 0xc3, 0x23, + 0x12, 0xea, 0x32, 0x4d, 0xc4, 0xcd, 0x75, 0x85, 0x1b, 0x7d, 0xd9, 0xfa, 0xac, 0xda, 0xec, 0xe3, + 0x3f, 0xff, 0xfd, 0x6e, 0x68, 0x0a, 0x5d, 0x33, 0x3a, 0x26, 0xd2, 0xe0, 0x20, 0x36, 0x0e, 0x64, + 0x63, 0x3d, 0x44, 0x4f, 0x00, 0xbc, 0xdc, 0x36, 0x01, 0xa1, 0x37, 0x7b, 0x2c, 0x17, 0x9d, 0xd5, + 0x0a, 0x7a, 0xbf, 0xe6, 0x12, 0x70, 0x41, 0x00, 0xea, 0x68, 0xb6, 0x1f, 0x40, 0x63, 0x4b, 0x42, + 0xfd, 0x1c, 0x02, 0x95, 0x43, 0x47, 0x4f, 0xd0, 0xe8, 0x74, 0xd4, 0x13, 0xb4, 0x6d, 0x96, 0xd1, + 0xe6, 0x05, 0xe8, 0x2c, 0x9a, 0xe9, 0x06, 0x6a, 0x11, 0xe3, 0x40, 0x56, 0xed, 0xa1, 0x71, 0x36, + 0xe1, 0xfc, 0x02, 0x60, 0xae, 0x7d, 0x20, 0x40, 0x71, 0x0b, 0xc7, 0x0c, 0x2f, 0x05, 0xa3, 0x6f, + 0xfb, 0x7e, 0x48, 0x3b, 0x24, 0x65, 0x02, 0xea, 0x37, 0x00, 0x73, 0xed, 0x07, 0x78, 0x2c, 0x69, + 0xcc, 0x08, 0x11, 0x4b, 0x1a, 0x37, 0x19, 0x68, 0xef, 0x0b, 0xd2, 0x5b, 0x68, 0xb1, 0x2f, 0x52, + 0x17, 0xef, 0x1b, 0x07, 0x67, 0x27, 0xff, 0x21, 0xfa, 0x03, 0x40, 0xd4, 0x79, 0x9a, 0xa3, 0xb7, + 0x62, 0x30, 0x62, 0x67, 0x8d, 0xc2, 0xdc, 0x05, 0x3c, 0x24, 0xfa, 0x07, 0x02, 0xfd, 0x5d, 0x74, + 0xab, 0x3f, 0x91, 0xbd, 0x40, 0x51, 0xf8, 0x3a, 0x4c, 0x8a, 0xb2, 0xd5, 0x62, 0xeb, 0xf0, 0xac, + 0x56, 0x5f, 0x3b, 0xd7, 0x46, 0x12, 0x4d, 0x0b, 0x22, 0x0d, 0x4d, 0xf6, 0x2a, 0x50, 0xe4, 0xc2, + 0x61, 0xd1, 0x73, 0xd1, 0x79, 0x71, 0x83, 0x2e, 0x58, 0xb8, 0x76, 0xbe, 0x91, 0x5c, 0x5d, 0x11, + 0xab, 0xe7, 0xd1, 0x58, 0xf7, 0xd5, 0xd1, 0x57, 0x00, 0x8e, 0x84, 0xda, 0x3d, 0xba, 0x1e, 0x13, + 0xb5, 0xf3, 0xd8, 0x29, 0xcc, 0xf4, 0x63, 0x2a, 0x31, 0xa6, 0x04, 0xc6, 0x24, 0x52, 0xba, 0x63, + 0x30, 0xa3, 0x26, 0x9c, 0xd0, 0x21, 0x4c, 0xf9, 0x3d, 0x1a, 0xc5, 0xa5, 0x17, 0x39, 0x0a, 0x0a, + 0xaf, 0xf7, 0xb0, 0xea, 0x7b, 0x79, 0xff, 0x60, 0x58, 0x3e, 0xfa, 0x47, 0x49, 0xfc, 0xda, 0x54, + 0x12, 0x47, 0x4d, 0x05, 0x1c, 0x37, 0x15, 0xf0, 0x77, 0x53, 0x01, 0xdf, 0x9e, 0x28, 0x89, 0xe3, + 0x13, 0x25, 0xf1, 0xd7, 0x89, 0x92, 0xf8, 0x64, 0x2a, 0x34, 0xc0, 0x2d, 0x51, 0x56, 0x7d, 0x10, + 0xc4, 0xb2, 0x8c, 0x47, 0x7e, 0x4c, 0xf1, 0x8f, 0x42, 0x29, 0x25, 0xfe, 0x08, 0xb8, 0xf9, 0x7f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xa4, 0x0e, 0x41, 0xb8, 0x10, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1032,7 +1014,6 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool { } return true } - func (this *CodeInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1066,7 +1047,6 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { } return true } - func (this *QueryCodeResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1125,6 +1105,8 @@ type QueryClient interface { Codes(ctx context.Context, in *QueryCodesRequest, opts ...grpc.CallOption) (*QueryCodesResponse, error) // PinnedCodes gets the pinned code ids PinnedCodes(ctx context.Context, in *QueryPinnedCodesRequest, opts ...grpc.CallOption) (*QueryPinnedCodesResponse, error) + // Params gets the module params + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } type queryClient struct { @@ -1216,6 +1198,15 @@ func (c *queryClient) PinnedCodes(ctx context.Context, in *QueryPinnedCodesReque return out, nil } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/Params", 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 @@ -1236,46 +1227,44 @@ type QueryServer interface { Codes(context.Context, *QueryCodesRequest) (*QueryCodesResponse, error) // PinnedCodes gets the pinned code ids PinnedCodes(context.Context, *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) + // Params gets the module params + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, 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 RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1443,6 +1432,24 @@ func _Query_PinnedCodes_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1483,6 +1490,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "PinnedCodes", Handler: _Query_PinnedCodes_Handler, }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/query.proto", @@ -2252,6 +2263,62 @@ func (m *QueryPinnedCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2263,7 +2330,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *QueryContractInfoRequest) Size() (n int) { if m == nil { return 0 @@ -2575,14 +2641,32 @@ func (m *QueryPinnedCodesResponse) Size() (n int) { return n } +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + 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 @@ -2665,7 +2749,6 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2781,7 +2864,6 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2900,7 +2982,6 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3021,7 +3102,6 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3127,7 +3207,6 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3246,7 +3325,6 @@ func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3365,7 +3443,6 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3486,7 +3563,6 @@ func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3603,7 +3679,6 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3688,7 +3763,6 @@ func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3805,7 +3879,6 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3890,7 +3963,6 @@ func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3960,7 +4032,6 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4129,7 +4200,6 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4250,7 +4320,6 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4337,7 +4406,6 @@ func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4458,7 +4526,6 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4545,7 +4612,6 @@ func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4708,7 +4774,139 @@ func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 b382baf77..f5aed81ed 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -25,14 +25,11 @@ import ( // Suppress "imported and not used" errors var _ codes.Code - -var ( - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage -) +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage 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 @@ -58,6 +55,7 @@ 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,9 +82,12 @@ 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 @@ -119,6 +120,7 @@ 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) { @@ -152,9 +154,12 @@ 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 @@ -187,6 +192,7 @@ 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) { @@ -220,9 +226,12 @@ 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 @@ -255,6 +264,7 @@ 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) { @@ -288,6 +298,7 @@ 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) { @@ -325,6 +336,7 @@ 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) { @@ -362,6 +374,7 @@ 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) { @@ -399,6 +412,7 @@ 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) { @@ -436,6 +450,7 @@ 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) { @@ -462,6 +477,7 @@ 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) { @@ -488,9 +504,12 @@ 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 @@ -505,6 +524,7 @@ 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) { @@ -520,9 +540,12 @@ 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 @@ -537,6 +560,7 @@ 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) { @@ -552,6 +576,25 @@ 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) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + 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) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -559,6 +602,7 @@ func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Ma // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) 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() @@ -576,6 +620,7 @@ 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) { @@ -595,6 +640,7 @@ 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) { @@ -614,6 +660,7 @@ 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) { @@ -633,6 +680,7 @@ 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) { @@ -652,6 +700,7 @@ 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) { @@ -671,6 +720,7 @@ 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) { @@ -690,6 +740,7 @@ 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) { @@ -709,6 +760,7 @@ 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) { @@ -728,6 +780,27 @@ 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) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + 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_Params_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -770,6 +843,7 @@ 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() @@ -787,6 +861,7 @@ 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) { @@ -806,6 +881,7 @@ 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) { @@ -825,6 +901,7 @@ 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) { @@ -844,6 +921,7 @@ 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) { @@ -863,6 +941,7 @@ 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) { @@ -882,6 +961,7 @@ 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) { @@ -901,6 +981,7 @@ 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) { @@ -920,6 +1001,7 @@ 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) { @@ -939,6 +1021,27 @@ 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) { + 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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -962,6 +1065,8 @@ var ( pattern_Query_Codes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmwasm", "wasm", "v1", "code"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_PinnedCodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "codes", "pinned"}, "", runtime.AssumeColonVerbOpt(true))) + + 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(true))) ) var ( @@ -982,4 +1087,6 @@ var ( forward_Query_Codes_0 = runtime.ForwardResponseMessage forward_Query_PinnedCodes_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go index 498dc2826..9630777f2 100644 --- a/x/wasm/types/tx.go +++ b/x/wasm/types/tx.go @@ -95,7 +95,7 @@ func (msg MsgInstantiateContract) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required") } - if err := validateLabel(msg.Label); err != nil { + if err := ValidateLabel(msg.Label); err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "label is required") } @@ -306,3 +306,56 @@ func (msg MsgIBCCloseChannel) GetSignBytes() []byte { func (msg MsgIBCCloseChannel) GetSigners() []sdk.AccAddress { return nil } + +var _ sdk.Msg = &MsgInstantiateContract2{} + +func (msg MsgInstantiateContract2) Route() string { + return RouterKey +} + +func (msg MsgInstantiateContract2) Type() string { + return "instantiate2" +} + +func (msg MsgInstantiateContract2) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdkerrors.Wrap(err, "sender") + } + + if msg.CodeID == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required") + } + + if err := ValidateLabel(msg.Label); err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "label is required") + } + + if !msg.Funds.IsValid() { + return sdkerrors.ErrInvalidCoins + } + + if len(msg.Admin) != 0 { + if _, err := sdk.AccAddressFromBech32(msg.Admin); err != nil { + return sdkerrors.Wrap(err, "admin") + } + } + if err := msg.Msg.ValidateBasic(); err != nil { + return sdkerrors.Wrap(err, "payload msg") + } + if err := ValidateSalt(msg.Salt); err != nil { + return sdkerrors.Wrap(err, "salt") + } + 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} +} diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index 7976d9e8f..2151f9423 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" @@ -18,15 +14,15 @@ 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 - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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. @@ -51,11 +47,9 @@ func (*MsgStoreCode) ProtoMessage() {} func (*MsgStoreCode) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{0} } - func (m *MsgStoreCode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgStoreCode.Marshal(b, m, deterministic) @@ -68,15 +62,12 @@ func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *MsgStoreCode) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgStoreCode.Merge(m, src) } - func (m *MsgStoreCode) XXX_Size() int { return m.Size() } - func (m *MsgStoreCode) XXX_DiscardUnknown() { xxx_messageInfo_MsgStoreCode.DiscardUnknown(m) } @@ -87,6 +78,8 @@ var xxx_messageInfo_MsgStoreCode proto.InternalMessageInfo type MsgStoreCodeResponse struct { // CodeID is the reference to the stored WASM code CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Checksum is the sha256 hash of the stored code + Checksum []byte `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"` } func (m *MsgStoreCodeResponse) Reset() { *m = MsgStoreCodeResponse{} } @@ -95,11 +88,9 @@ func (*MsgStoreCodeResponse) ProtoMessage() {} func (*MsgStoreCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{1} } - func (m *MsgStoreCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgStoreCodeResponse.Marshal(b, m, deterministic) @@ -112,15 +103,12 @@ func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *MsgStoreCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgStoreCodeResponse.Merge(m, src) } - func (m *MsgStoreCodeResponse) XXX_Size() int { return m.Size() } - func (m *MsgStoreCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgStoreCodeResponse.DiscardUnknown(m) } @@ -150,11 +138,9 @@ func (*MsgInstantiateContract) ProtoMessage() {} func (*MsgInstantiateContract) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{2} } - func (m *MsgInstantiateContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgInstantiateContract.Marshal(b, m, deterministic) @@ -167,26 +153,78 @@ func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgInstantiateContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgInstantiateContract.Merge(m, src) } - func (m *MsgInstantiateContract) XXX_Size() int { return m.Size() } - func (m *MsgInstantiateContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgInstantiateContract.DiscardUnknown(m) } var xxx_messageInfo_MsgInstantiateContract proto.InternalMessageInfo +// MsgInstantiateContract2 create a new smart contract instance for the given +// code id with a predicable address. +type MsgInstantiateContract2 struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // Admin is an optional address that can execute migrations + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Label is optional metadata to be stored with a contract instance. + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + // Msg json encoded message to be passed to the contract on instantiation + Msg RawContractMessage `protobuf:"bytes,5,opt,name=msg,proto3,casttype=RawContractMessage" json:"msg,omitempty"` + // Funds coins that are transferred to the contract on instantiation + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` + // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. + Salt []byte `protobuf:"bytes,7,opt,name=salt,proto3" json:"salt,omitempty"` + // FixMsg include the msg value into the hash for the predictable address. + // Default is false + FixMsg bool `protobuf:"varint,8,opt,name=fix_msg,json=fixMsg,proto3" json:"fix_msg,omitempty"` +} + +func (m *MsgInstantiateContract2) Reset() { *m = MsgInstantiateContract2{} } +func (m *MsgInstantiateContract2) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateContract2) ProtoMessage() {} +func (*MsgInstantiateContract2) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{3} +} +func (m *MsgInstantiateContract2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateContract2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateContract2.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 *MsgInstantiateContract2) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateContract2.Merge(m, src) +} +func (m *MsgInstantiateContract2) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateContract2) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateContract2.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateContract2 proto.InternalMessageInfo + // MsgInstantiateContractResponse return instantiation result data type MsgInstantiateContractResponse struct { // Address is the bech32 address of the new contract instance. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // Data contains base64-encoded bytes to returned from the contract + // Data contains bytes to returned from the contract Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } @@ -194,13 +232,11 @@ func (m *MsgInstantiateContractResponse) Reset() { *m = MsgInstantiateCo func (m *MsgInstantiateContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgInstantiateContractResponse) ProtoMessage() {} func (*MsgInstantiateContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{3} + return fileDescriptor_4f74d82755520264, []int{4} } - func (m *MsgInstantiateContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgInstantiateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgInstantiateContractResponse.Marshal(b, m, deterministic) @@ -213,21 +249,59 @@ func (m *MsgInstantiateContractResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *MsgInstantiateContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgInstantiateContractResponse.Merge(m, src) } - func (m *MsgInstantiateContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgInstantiateContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgInstantiateContractResponse.DiscardUnknown(m) } var xxx_messageInfo_MsgInstantiateContractResponse proto.InternalMessageInfo +// MsgInstantiateContract2Response return instantiation result data +type MsgInstantiateContract2Response struct { + // Address is the bech32 address of the new contract instance. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Data contains bytes to returned from the contract + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgInstantiateContract2Response) Reset() { *m = MsgInstantiateContract2Response{} } +func (m *MsgInstantiateContract2Response) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateContract2Response) ProtoMessage() {} +func (*MsgInstantiateContract2Response) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{5} +} +func (m *MsgInstantiateContract2Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateContract2Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateContract2Response.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 *MsgInstantiateContract2Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateContract2Response.Merge(m, src) +} +func (m *MsgInstantiateContract2Response) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateContract2Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateContract2Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateContract2Response proto.InternalMessageInfo + // MsgExecuteContract submits the given message data to a smart contract type MsgExecuteContract struct { // Sender is the that actor that signed the messages @@ -244,13 +318,11 @@ func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } func (m *MsgExecuteContract) String() string { return proto.CompactTextString(m) } func (*MsgExecuteContract) ProtoMessage() {} func (*MsgExecuteContract) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{4} + return fileDescriptor_4f74d82755520264, []int{6} } - func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgExecuteContract.Marshal(b, m, deterministic) @@ -263,15 +335,12 @@ func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgExecuteContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgExecuteContract.Merge(m, src) } - func (m *MsgExecuteContract) XXX_Size() int { return m.Size() } - func (m *MsgExecuteContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) } @@ -280,7 +349,7 @@ var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo // MsgExecuteContractResponse returns execution result data. type MsgExecuteContractResponse struct { - // Data contains base64-encoded bytes to returned from the contract + // Data contains bytes to returned from the contract Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } @@ -288,13 +357,11 @@ func (m *MsgExecuteContractResponse) Reset() { *m = MsgExecuteContractRe func (m *MsgExecuteContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgExecuteContractResponse) ProtoMessage() {} func (*MsgExecuteContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{5} + return fileDescriptor_4f74d82755520264, []int{7} } - func (m *MsgExecuteContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgExecuteContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgExecuteContractResponse.Marshal(b, m, deterministic) @@ -307,15 +374,12 @@ func (m *MsgExecuteContractResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } - func (m *MsgExecuteContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgExecuteContractResponse.Merge(m, src) } - func (m *MsgExecuteContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgExecuteContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgExecuteContractResponse.DiscardUnknown(m) } @@ -338,13 +402,11 @@ func (m *MsgMigrateContract) Reset() { *m = MsgMigrateContract{} } func (m *MsgMigrateContract) String() string { return proto.CompactTextString(m) } func (*MsgMigrateContract) ProtoMessage() {} func (*MsgMigrateContract) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{6} + return fileDescriptor_4f74d82755520264, []int{8} } - func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMigrateContract.Marshal(b, m, deterministic) @@ -357,15 +419,12 @@ func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgMigrateContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMigrateContract.Merge(m, src) } - func (m *MsgMigrateContract) XXX_Size() int { return m.Size() } - func (m *MsgMigrateContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgMigrateContract.DiscardUnknown(m) } @@ -383,13 +442,11 @@ func (m *MsgMigrateContractResponse) Reset() { *m = MsgMigrateContractRe func (m *MsgMigrateContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgMigrateContractResponse) ProtoMessage() {} func (*MsgMigrateContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{7} + return fileDescriptor_4f74d82755520264, []int{9} } - func (m *MsgMigrateContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMigrateContractResponse.Marshal(b, m, deterministic) @@ -402,15 +459,12 @@ func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } - func (m *MsgMigrateContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMigrateContractResponse.Merge(m, src) } - func (m *MsgMigrateContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgMigrateContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgMigrateContractResponse.DiscardUnknown(m) } @@ -431,13 +485,11 @@ func (m *MsgUpdateAdmin) Reset() { *m = MsgUpdateAdmin{} } func (m *MsgUpdateAdmin) String() string { return proto.CompactTextString(m) } func (*MsgUpdateAdmin) ProtoMessage() {} func (*MsgUpdateAdmin) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{8} + return fileDescriptor_4f74d82755520264, []int{10} } - func (m *MsgUpdateAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateAdmin.Marshal(b, m, deterministic) @@ -450,15 +502,12 @@ func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } - func (m *MsgUpdateAdmin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateAdmin.Merge(m, src) } - func (m *MsgUpdateAdmin) XXX_Size() int { return m.Size() } - func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateAdmin.DiscardUnknown(m) } @@ -466,19 +515,18 @@ func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo // MsgUpdateAdminResponse returns empty data -type MsgUpdateAdminResponse struct{} +type MsgUpdateAdminResponse struct { +} func (m *MsgUpdateAdminResponse) Reset() { *m = MsgUpdateAdminResponse{} } func (m *MsgUpdateAdminResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateAdminResponse) ProtoMessage() {} func (*MsgUpdateAdminResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{9} + return fileDescriptor_4f74d82755520264, []int{11} } - func (m *MsgUpdateAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateAdminResponse.Marshal(b, m, deterministic) @@ -491,15 +539,12 @@ func (m *MsgUpdateAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgUpdateAdminResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateAdminResponse.Merge(m, src) } - func (m *MsgUpdateAdminResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateAdminResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateAdminResponse.DiscardUnknown(m) } @@ -518,13 +563,11 @@ func (m *MsgClearAdmin) Reset() { *m = MsgClearAdmin{} } func (m *MsgClearAdmin) String() string { return proto.CompactTextString(m) } func (*MsgClearAdmin) ProtoMessage() {} func (*MsgClearAdmin) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{10} + return fileDescriptor_4f74d82755520264, []int{12} } - func (m *MsgClearAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClearAdmin.Marshal(b, m, deterministic) @@ -537,15 +580,12 @@ func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } - func (m *MsgClearAdmin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClearAdmin.Merge(m, src) } - func (m *MsgClearAdmin) XXX_Size() int { return m.Size() } - func (m *MsgClearAdmin) XXX_DiscardUnknown() { xxx_messageInfo_MsgClearAdmin.DiscardUnknown(m) } @@ -553,19 +593,18 @@ func (m *MsgClearAdmin) XXX_DiscardUnknown() { var xxx_messageInfo_MsgClearAdmin proto.InternalMessageInfo // MsgClearAdminResponse returns empty data -type MsgClearAdminResponse struct{} +type MsgClearAdminResponse struct { +} func (m *MsgClearAdminResponse) Reset() { *m = MsgClearAdminResponse{} } func (m *MsgClearAdminResponse) String() string { return proto.CompactTextString(m) } func (*MsgClearAdminResponse) ProtoMessage() {} func (*MsgClearAdminResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4f74d82755520264, []int{11} + return fileDescriptor_4f74d82755520264, []int{13} } - func (m *MsgClearAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgClearAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClearAdminResponse.Marshal(b, m, deterministic) @@ -578,15 +617,12 @@ func (m *MsgClearAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } - func (m *MsgClearAdminResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClearAdminResponse.Merge(m, src) } - func (m *MsgClearAdminResponse) XXX_Size() int { return m.Size() } - func (m *MsgClearAdminResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgClearAdminResponse.DiscardUnknown(m) } @@ -597,7 +633,9 @@ func init() { proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode") proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse") proto.RegisterType((*MsgInstantiateContract)(nil), "cosmwasm.wasm.v1.MsgInstantiateContract") + proto.RegisterType((*MsgInstantiateContract2)(nil), "cosmwasm.wasm.v1.MsgInstantiateContract2") proto.RegisterType((*MsgInstantiateContractResponse)(nil), "cosmwasm.wasm.v1.MsgInstantiateContractResponse") + proto.RegisterType((*MsgInstantiateContract2Response)(nil), "cosmwasm.wasm.v1.MsgInstantiateContract2Response") proto.RegisterType((*MsgExecuteContract)(nil), "cosmwasm.wasm.v1.MsgExecuteContract") proto.RegisterType((*MsgExecuteContractResponse)(nil), "cosmwasm.wasm.v1.MsgExecuteContractResponse") proto.RegisterType((*MsgMigrateContract)(nil), "cosmwasm.wasm.v1.MsgMigrateContract") @@ -611,55 +649,60 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) } var fileDescriptor_4f74d82755520264 = []byte{ - // 759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0x8e, 0x1b, 0x27, 0x4d, 0x4e, 0x73, 0x7b, 0x23, 0xdf, 0x36, 0x37, 0xf5, 0xbd, 0x72, 0xa2, - 0x80, 0x8a, 0x17, 0x60, 0x37, 0x45, 0x62, 0xc3, 0xaa, 0x49, 0x59, 0xb4, 0x92, 0x11, 0x72, 0x55, - 0x2a, 0xd8, 0x44, 0x13, 0x7b, 0x6a, 0x2c, 0x1a, 0x4f, 0xf0, 0x71, 0x9b, 0xf6, 0x25, 0x10, 0x3b, - 0xde, 0x81, 0xb7, 0x60, 0xd7, 0x15, 0xea, 0x06, 0x89, 0x55, 0x80, 0xf4, 0x2d, 0x58, 0x21, 0xff, - 0xa5, 0x6e, 0xea, 0xa4, 0x41, 0x88, 0x4d, 0x32, 0xc7, 0xf3, 0x7d, 0xe7, 0xcc, 0xf9, 0xf4, 0xcd, - 0x19, 0x58, 0x33, 0x18, 0xf6, 0x06, 0x04, 0x7b, 0x6a, 0xf0, 0x73, 0xd2, 0x54, 0xbd, 0x53, 0xa5, - 0xef, 0x32, 0x8f, 0x09, 0xe5, 0x78, 0x4b, 0x09, 0x7e, 0x4e, 0x9a, 0xa2, 0xe4, 0x7f, 0x61, 0xa8, - 0x76, 0x09, 0x52, 0xf5, 0xa4, 0xd9, 0xa5, 0x1e, 0x69, 0xaa, 0x06, 0xb3, 0x9d, 0x90, 0x21, 0xae, - 0x58, 0xcc, 0x62, 0xc1, 0x52, 0xf5, 0x57, 0xd1, 0xd7, 0xff, 0x6f, 0x96, 0x38, 0xeb, 0x53, 0x0c, - 0x77, 0x1b, 0x1f, 0x39, 0x28, 0x69, 0x68, 0xed, 0x79, 0xcc, 0xa5, 0x6d, 0x66, 0x52, 0xa1, 0x02, - 0x79, 0xa4, 0x8e, 0x49, 0xdd, 0x2a, 0x57, 0xe7, 0xe4, 0xa2, 0x1e, 0x45, 0xc2, 0x23, 0x58, 0xf6, - 0xf9, 0x9d, 0xee, 0x99, 0x47, 0x3b, 0x06, 0x33, 0x69, 0x75, 0xa1, 0xce, 0xc9, 0xa5, 0x56, 0x79, - 0x34, 0xac, 0x95, 0x0e, 0xb6, 0xf6, 0xb4, 0xd6, 0x99, 0x17, 0x64, 0xd0, 0x4b, 0x3e, 0x2e, 0x8e, - 0x84, 0x7d, 0xa8, 0xd8, 0x0e, 0x7a, 0xc4, 0xf1, 0x6c, 0xe2, 0xd1, 0x4e, 0x9f, 0xba, 0x3d, 0x1b, - 0xd1, 0x66, 0x4e, 0x35, 0x57, 0xe7, 0xe4, 0xa5, 0x4d, 0x49, 0x99, 0xec, 0x53, 0xd9, 0x32, 0x0c, - 0x8a, 0xd8, 0x66, 0xce, 0xa1, 0x6d, 0xe9, 0xab, 0x09, 0xf6, 0xb3, 0x31, 0x79, 0x97, 0x2f, 0x64, - 0xcb, 0xfc, 0x2e, 0x5f, 0xe0, 0xcb, 0xb9, 0xc6, 0x63, 0x58, 0x49, 0xb6, 0xa0, 0x53, 0xec, 0x33, - 0x07, 0xa9, 0x70, 0x07, 0x16, 0xfd, 0x83, 0x76, 0x6c, 0x33, 0xe8, 0x85, 0x6f, 0xc1, 0x68, 0x58, - 0xcb, 0xfb, 0x90, 0x9d, 0x6d, 0x3d, 0xef, 0x6f, 0xed, 0x98, 0x8d, 0xb7, 0x0b, 0x50, 0xd1, 0xd0, - 0xda, 0xb9, 0xaa, 0xd2, 0x66, 0x8e, 0xe7, 0x12, 0xc3, 0x9b, 0x2a, 0xc5, 0x0a, 0xe4, 0x88, 0xd9, - 0xb3, 0x9d, 0x40, 0x81, 0xa2, 0x1e, 0x06, 0xc9, 0x6a, 0xd9, 0x69, 0xd5, 0x7c, 0xea, 0x11, 0xe9, - 0xd2, 0xa3, 0x2a, 0x1f, 0x52, 0x83, 0x40, 0x90, 0x21, 0xdb, 0x43, 0x2b, 0x10, 0xa4, 0xd4, 0xaa, - 0xfc, 0x18, 0xd6, 0x04, 0x9d, 0x0c, 0xe2, 0x63, 0x68, 0x14, 0x91, 0x58, 0x54, 0xf7, 0x21, 0x02, - 0x81, 0xdc, 0xe1, 0xb1, 0x63, 0x62, 0x35, 0x5f, 0xcf, 0xca, 0x4b, 0x9b, 0x6b, 0x4a, 0x68, 0x09, - 0xc5, 0xb7, 0x84, 0x12, 0x59, 0x42, 0x69, 0x33, 0xdb, 0x69, 0x6d, 0x9c, 0x0f, 0x6b, 0x99, 0x0f, - 0x5f, 0x6b, 0xb2, 0x65, 0x7b, 0xaf, 0x8e, 0xbb, 0x8a, 0xc1, 0x7a, 0x6a, 0xe4, 0x9f, 0xf0, 0xef, - 0x01, 0x9a, 0xaf, 0x23, 0x2b, 0xf8, 0x04, 0xd4, 0xc3, 0xcc, 0x8d, 0xa7, 0x20, 0xa5, 0xeb, 0x31, - 0xd6, 0xb5, 0x0a, 0x8b, 0xc4, 0x34, 0x5d, 0x8a, 0x18, 0x09, 0x13, 0x87, 0x82, 0x00, 0xbc, 0x49, - 0x3c, 0x12, 0x5a, 0x43, 0x0f, 0xd6, 0x8d, 0xcf, 0x1c, 0x08, 0x1a, 0x5a, 0x4f, 0x4e, 0xa9, 0x71, - 0x3c, 0x87, 0xb8, 0x22, 0x14, 0x8c, 0x08, 0x13, 0xe9, 0x3b, 0x8e, 0x63, 0x9d, 0xb2, 0xbf, 0xa0, - 0x53, 0xee, 0x8f, 0xe9, 0xb4, 0x01, 0xe2, 0xcd, 0xb6, 0xc6, 0x1a, 0xc5, 0x4a, 0x70, 0x09, 0x25, - 0xde, 0x87, 0x4a, 0x68, 0xb6, 0xe5, 0x92, 0xdf, 0x54, 0x62, 0x2e, 0xb3, 0x45, 0x72, 0xf1, 0xb7, - 0xca, 0x15, 0xf5, 0x32, 0x71, 0xb0, 0x99, 0xbd, 0x10, 0x58, 0xd6, 0xd0, 0xda, 0xef, 0x9b, 0xc4, - 0xa3, 0x5b, 0x81, 0xff, 0xa7, 0xb5, 0xf1, 0x1f, 0x14, 0x1d, 0x3a, 0xe8, 0x24, 0x6f, 0x4c, 0xc1, - 0xa1, 0x83, 0x90, 0x94, 0xec, 0x31, 0x7b, 0xbd, 0xc7, 0x46, 0x35, 0xb8, 0x98, 0x89, 0x12, 0xf1, - 0x81, 0x1a, 0x6d, 0xf8, 0x4b, 0x43, 0xab, 0x7d, 0x44, 0x89, 0x3b, 0xbb, 0xf6, 0xac, 0xf4, 0xff, - 0xc2, 0xea, 0xb5, 0x24, 0x71, 0xf6, 0xcd, 0x4f, 0x3c, 0x64, 0x35, 0xb4, 0x84, 0x3d, 0x28, 0x5e, - 0x8d, 0xc5, 0x94, 0x31, 0x95, 0x9c, 0x39, 0xe2, 0xfa, 0xec, 0xfd, 0xb1, 0x96, 0x6f, 0xe0, 0x9f, - 0xb4, 0x51, 0x23, 0xa7, 0xd2, 0x53, 0x90, 0xe2, 0xc6, 0xbc, 0xc8, 0x71, 0x49, 0x0a, 0x7f, 0x4f, - 0x5e, 0xbe, 0xbb, 0xa9, 0x49, 0x26, 0x50, 0xe2, 0xfd, 0x79, 0x50, 0xc9, 0x32, 0x93, 0xce, 0x4e, - 0x2f, 0x33, 0x81, 0x9a, 0x52, 0x66, 0x9a, 0x19, 0x5f, 0xc0, 0x52, 0xd2, 0x75, 0xf5, 0x54, 0x72, - 0x02, 0x21, 0xca, 0xb7, 0x21, 0xc6, 0xa9, 0x9f, 0x03, 0x24, 0x3c, 0x55, 0x4b, 0xe5, 0x5d, 0x01, - 0xc4, 0x7b, 0xb7, 0x00, 0xe2, 0xbc, 0xad, 0xed, 0xf3, 0xef, 0x52, 0xe6, 0x7c, 0x24, 0x71, 0x17, - 0x23, 0x89, 0xfb, 0x36, 0x92, 0xb8, 0x77, 0x97, 0x52, 0xe6, 0xe2, 0x52, 0xca, 0x7c, 0xb9, 0x94, - 0x32, 0x2f, 0xd7, 0x13, 0x83, 0xa7, 0xcd, 0xb0, 0x77, 0x10, 0x3f, 0xd5, 0xa6, 0x7a, 0x1a, 0x3e, - 0xd9, 0xc1, 0xf0, 0xe9, 0xe6, 0x83, 0x07, 0xfb, 0xe1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, - 0xd2, 0x4b, 0x17, 0x33, 0x08, 0x00, 0x00, + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0x8e, 0x1b, 0xe7, 0xeb, 0x6d, 0x58, 0x22, 0x93, 0x4d, 0xbd, 0x06, 0x39, 0x91, 0x41, 0x8b, + 0x91, 0xc0, 0x6e, 0x82, 0xc4, 0xbd, 0xc9, 0x72, 0xe8, 0x4a, 0x06, 0xe4, 0x6a, 0xa9, 0xe0, 0x12, + 0x4d, 0xec, 0x89, 0xd7, 0xda, 0xd8, 0x13, 0x3c, 0x93, 0x26, 0xfd, 0x13, 0x88, 0x1b, 0xff, 0x81, + 0xdf, 0xc0, 0x05, 0x89, 0x43, 0x8f, 0x7b, 0x41, 0xe2, 0x14, 0x20, 0xfd, 0x17, 0x9c, 0x90, 0x3f, + 0xeb, 0xcd, 0x3a, 0x69, 0x00, 0x71, 0xe2, 0x92, 0xcc, 0xeb, 0x79, 0xde, 0xaf, 0x67, 0x9e, 0x77, + 0x6c, 0x78, 0x64, 0x11, 0xea, 0x2d, 0x11, 0xf5, 0xf4, 0xe8, 0xe7, 0xaa, 0xaf, 0xb3, 0x95, 0x36, + 0x0f, 0x08, 0x23, 0x42, 0x2b, 0xdd, 0xd2, 0xa2, 0x9f, 0xab, 0xbe, 0x24, 0x87, 0x4f, 0x08, 0xd5, + 0x27, 0x88, 0x62, 0xfd, 0xaa, 0x3f, 0xc1, 0x0c, 0xf5, 0x75, 0x8b, 0xb8, 0x7e, 0xec, 0x21, 0xb5, + 0x1d, 0xe2, 0x90, 0x68, 0xa9, 0x87, 0xab, 0xe4, 0xe9, 0x3b, 0xaf, 0xa7, 0xb8, 0x9e, 0x63, 0x1a, + 0xef, 0x2a, 0x3f, 0x71, 0xd0, 0x34, 0xa8, 0x73, 0xc1, 0x48, 0x80, 0x47, 0xc4, 0xc6, 0x42, 0x07, + 0xaa, 0x14, 0xfb, 0x36, 0x0e, 0x44, 0xae, 0xc7, 0xa9, 0x0d, 0x33, 0xb1, 0x84, 0x4f, 0xe0, 0x41, + 0xe8, 0x3f, 0x9e, 0x5c, 0x33, 0x3c, 0xb6, 0x88, 0x8d, 0xc5, 0xa3, 0x1e, 0xa7, 0x36, 0x87, 0xad, + 0xcd, 0xba, 0xdb, 0xbc, 0x3c, 0xbb, 0x30, 0x86, 0xd7, 0x2c, 0x8a, 0x60, 0x36, 0x43, 0x5c, 0x6a, + 0x09, 0xcf, 0xa0, 0xe3, 0xfa, 0x94, 0x21, 0x9f, 0xb9, 0x88, 0xe1, 0xf1, 0x1c, 0x07, 0x9e, 0x4b, + 0xa9, 0x4b, 0x7c, 0xb1, 0xd2, 0xe3, 0xd4, 0xe3, 0x81, 0xac, 0x6d, 0xf7, 0xa9, 0x9d, 0x59, 0x16, + 0xa6, 0x74, 0x44, 0xfc, 0xa9, 0xeb, 0x98, 0x0f, 0x73, 0xde, 0x5f, 0x64, 0xce, 0x4f, 0xf9, 0x7a, + 0xb9, 0xc5, 0x3f, 0xe5, 0xeb, 0x7c, 0xab, 0xa2, 0x5c, 0x42, 0x3b, 0xdf, 0x82, 0x89, 0xe9, 0x9c, + 0xf8, 0x14, 0x0b, 0xef, 0x42, 0x2d, 0x2c, 0x74, 0xec, 0xda, 0x51, 0x2f, 0xfc, 0x10, 0x36, 0xeb, + 0x6e, 0x35, 0x84, 0x9c, 0x3f, 0x31, 0xab, 0xe1, 0xd6, 0xb9, 0x2d, 0x48, 0x50, 0xb7, 0x9e, 0x63, + 0xeb, 0x05, 0x5d, 0x78, 0x71, 0x47, 0x66, 0x66, 0x2b, 0xdf, 0x1e, 0x41, 0xc7, 0xa0, 0xce, 0xf9, + 0x5d, 0x05, 0x23, 0xe2, 0xb3, 0x00, 0x59, 0x6c, 0x27, 0x4d, 0x6d, 0xa8, 0x20, 0xdb, 0x73, 0xfd, + 0x28, 0x56, 0xc3, 0x8c, 0x8d, 0x7c, 0x25, 0xe5, 0x9d, 0x95, 0xb4, 0xa1, 0x32, 0x43, 0x13, 0x3c, + 0x13, 0xf9, 0xd8, 0x35, 0x32, 0x04, 0x15, 0xca, 0x1e, 0x75, 0x22, 0xb2, 0x9a, 0xc3, 0xce, 0x9f, + 0xeb, 0xae, 0x60, 0xa2, 0x65, 0x5a, 0x86, 0x81, 0x29, 0x45, 0x0e, 0x36, 0x43, 0x88, 0x80, 0xa0, + 0x32, 0x5d, 0xf8, 0x36, 0x15, 0xab, 0xbd, 0xb2, 0x7a, 0x3c, 0x78, 0xa4, 0xc5, 0x72, 0xd1, 0x42, + 0xb9, 0x68, 0x89, 0x5c, 0xb4, 0x11, 0x71, 0xfd, 0xe1, 0xe9, 0xcd, 0xba, 0x5b, 0xfa, 0xe1, 0xb7, + 0xae, 0xea, 0xb8, 0xec, 0xf9, 0x62, 0xa2, 0x59, 0xc4, 0xd3, 0x13, 0x6d, 0xc5, 0x7f, 0x1f, 0x51, + 0xfb, 0x45, 0x22, 0x93, 0xd0, 0x81, 0x9a, 0x71, 0x64, 0xe5, 0xc7, 0x23, 0x38, 0x29, 0x26, 0x64, + 0xf0, 0xff, 0x64, 0x44, 0x10, 0x80, 0xa7, 0x68, 0xc6, 0xc4, 0x5a, 0x24, 0x9d, 0x68, 0x2d, 0x9c, + 0x40, 0x6d, 0xea, 0xae, 0xc6, 0x61, 0x91, 0xf5, 0x1e, 0xa7, 0xd6, 0xcd, 0xea, 0xd4, 0x5d, 0x19, + 0xd4, 0x51, 0x3e, 0x03, 0xb9, 0x98, 0xbd, 0x4c, 0xb2, 0x22, 0xd4, 0x90, 0x6d, 0x07, 0x98, 0xd2, + 0x84, 0xc5, 0xd4, 0x0c, 0x13, 0xd9, 0x88, 0xa1, 0x44, 0xa3, 0xd1, 0x5a, 0xf9, 0x1c, 0xba, 0x3b, + 0x4e, 0xe3, 0x1f, 0x06, 0xfc, 0x85, 0x03, 0xc1, 0xa0, 0xce, 0xa7, 0x2b, 0x6c, 0x2d, 0x0e, 0x10, + 0x7b, 0x38, 0x3b, 0x09, 0x26, 0x39, 0xdd, 0xcc, 0x4e, 0x4f, 0xa9, 0xfc, 0x37, 0x4e, 0xa9, 0xf2, + 0x9f, 0xe9, 0xf6, 0x14, 0xa4, 0xd7, 0xdb, 0xca, 0x38, 0x4a, 0x99, 0xe0, 0x72, 0x4c, 0x7c, 0x1f, + 0x33, 0x61, 0xb8, 0x4e, 0x80, 0xfe, 0x25, 0x13, 0x07, 0x49, 0x3d, 0xa1, 0x8b, 0xbf, 0x97, 0xae, + 0xa4, 0x97, 0xad, 0xc2, 0xf6, 0xf6, 0x82, 0xe0, 0x81, 0x41, 0x9d, 0x67, 0x73, 0x1b, 0x31, 0x7c, + 0x16, 0x4d, 0xdf, 0xae, 0x36, 0xde, 0x86, 0x86, 0x8f, 0x97, 0xe3, 0xfc, 0xbc, 0xd6, 0x7d, 0xbc, + 0x8c, 0x9d, 0xf2, 0x3d, 0x96, 0x5f, 0xed, 0x51, 0x11, 0xa3, 0x8b, 0x32, 0x97, 0x22, 0x2d, 0x48, + 0x19, 0xc1, 0x1b, 0x06, 0x75, 0x46, 0x33, 0x8c, 0x82, 0xfd, 0xb9, 0xf7, 0x85, 0x3f, 0x81, 0x87, + 0xaf, 0x04, 0x49, 0xa3, 0x0f, 0x7e, 0xae, 0x40, 0xd9, 0xa0, 0x8e, 0x70, 0x01, 0x8d, 0xbb, 0x57, + 0x58, 0xc1, 0x2b, 0x25, 0xff, 0x7e, 0x90, 0x1e, 0xef, 0xdf, 0xcf, 0xb8, 0xfc, 0x06, 0xde, 0x2a, + 0xba, 0xfa, 0xd5, 0x42, 0xf7, 0x02, 0xa4, 0x74, 0x7a, 0x28, 0x32, 0x4b, 0xc9, 0xa0, 0x5d, 0x78, + 0xb9, 0x7e, 0x70, 0x68, 0xa4, 0x81, 0xd4, 0x3f, 0x18, 0x9a, 0x65, 0xc5, 0xf0, 0xe6, 0xf6, 0xc8, + 0xbf, 0x57, 0x18, 0x65, 0x0b, 0x25, 0x7d, 0x78, 0x08, 0x2a, 0x9f, 0x66, 0x7b, 0x9e, 0x8a, 0xd3, + 0x6c, 0xa1, 0x76, 0xa4, 0xd9, 0x35, 0x02, 0x5f, 0xc1, 0x71, 0x5e, 0xeb, 0xbd, 0x42, 0xe7, 0x1c, + 0x42, 0x52, 0xef, 0x43, 0x64, 0xa1, 0xbf, 0x04, 0xc8, 0x29, 0xb9, 0x5b, 0xe8, 0x77, 0x07, 0x90, + 0xde, 0xbf, 0x07, 0x90, 0xc6, 0x1d, 0x3e, 0xb9, 0xf9, 0x43, 0x2e, 0xdd, 0x6c, 0x64, 0xee, 0xe5, + 0x46, 0xe6, 0x7e, 0xdf, 0xc8, 0xdc, 0x77, 0xb7, 0x72, 0xe9, 0xe5, 0xad, 0x5c, 0xfa, 0xf5, 0x56, + 0x2e, 0x7d, 0xfd, 0x38, 0x77, 0xdd, 0x8d, 0x08, 0xf5, 0x2e, 0xd3, 0x8f, 0x39, 0x5b, 0x5f, 0xc5, + 0x1f, 0x75, 0xd1, 0x95, 0x37, 0xa9, 0x46, 0x9f, 0x74, 0x1f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, + 0x1a, 0x2c, 0xa2, 0xcd, 0x55, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -676,8 +719,12 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // StoreCode to submit Wasm code to the system StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error) - // Instantiate creates a new smart contract instance for the given code id. + // InstantiateContract creates a new smart contract instance for the given + // code id. InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error) + // InstantiateContract2 creates a new smart contract instance for the given + // code id with a predictable address + InstantiateContract2(ctx context.Context, in *MsgInstantiateContract2, opts ...grpc.CallOption) (*MsgInstantiateContract2Response, error) // Execute submits the given message data to a smart contract ExecuteContract(ctx context.Context, in *MsgExecuteContract, opts ...grpc.CallOption) (*MsgExecuteContractResponse, error) // Migrate runs a code upgrade/ downgrade for a smart contract @@ -714,6 +761,15 @@ func (c *msgClient) InstantiateContract(ctx context.Context, in *MsgInstantiateC return out, nil } +func (c *msgClient) InstantiateContract2(ctx context.Context, in *MsgInstantiateContract2, opts ...grpc.CallOption) (*MsgInstantiateContract2Response, error) { + out := new(MsgInstantiateContract2Response) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/InstantiateContract2", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) ExecuteContract(ctx context.Context, in *MsgExecuteContract, opts ...grpc.CallOption) (*MsgExecuteContractResponse, error) { out := new(MsgExecuteContractResponse) err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/ExecuteContract", in, out, opts...) @@ -754,8 +810,12 @@ func (c *msgClient) ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...g type MsgServer interface { // StoreCode to submit Wasm code to the system StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error) - // Instantiate creates a new smart contract instance for the given code id. + // InstantiateContract creates a new smart contract instance for the given + // code id. InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) + // InstantiateContract2 creates a new smart contract instance for the given + // code id with a predictable address + InstantiateContract2(context.Context, *MsgInstantiateContract2) (*MsgInstantiateContract2Response, error) // Execute submits the given message data to a smart contract ExecuteContract(context.Context, *MsgExecuteContract) (*MsgExecuteContractResponse, error) // Migrate runs a code upgrade/ downgrade for a smart contract @@ -767,28 +827,27 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct{} +type UnimplementedMsgServer struct { +} func (*UnimplementedMsgServer) StoreCode(ctx context.Context, req *MsgStoreCode) (*MsgStoreCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StoreCode not implemented") } - func (*UnimplementedMsgServer) InstantiateContract(ctx context.Context, req *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract not implemented") } - +func (*UnimplementedMsgServer) InstantiateContract2(ctx context.Context, req *MsgInstantiateContract2) (*MsgInstantiateContract2Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract2 not implemented") +} func (*UnimplementedMsgServer) ExecuteContract(ctx context.Context, req *MsgExecuteContract) (*MsgExecuteContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExecuteContract not implemented") } - func (*UnimplementedMsgServer) MigrateContract(ctx context.Context, req *MsgMigrateContract) (*MsgMigrateContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MigrateContract not implemented") } - func (*UnimplementedMsgServer) UpdateAdmin(ctx context.Context, req *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateAdmin not implemented") } - func (*UnimplementedMsgServer) ClearAdmin(ctx context.Context, req *MsgClearAdmin) (*MsgClearAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClearAdmin not implemented") } @@ -833,6 +892,24 @@ func _Msg_InstantiateContract_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_InstantiateContract2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgInstantiateContract2) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).InstantiateContract2(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/InstantiateContract2", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).InstantiateContract2(ctx, req.(*MsgInstantiateContract2)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_ExecuteContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgExecuteContract) if err := dec(in); err != nil { @@ -917,6 +994,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "InstantiateContract", Handler: _Msg_InstantiateContract_Handler, }, + { + MethodName: "InstantiateContract2", + Handler: _Msg_InstantiateContract2_Handler, + }, { MethodName: "ExecuteContract", Handler: _Msg_ExecuteContract_Handler, @@ -1007,6 +1088,13 @@ func (m *MsgStoreCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Checksum) > 0 { + i -= len(m.Checksum) + copy(dAtA[i:], m.Checksum) + i = encodeVarintTx(dAtA, i, uint64(len(m.Checksum))) + i-- + dAtA[i] = 0x12 + } if m.CodeID != 0 { i = encodeVarintTx(dAtA, i, uint64(m.CodeID)) i-- @@ -1085,7 +1173,7 @@ func (m *MsgInstantiateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgInstantiateContractResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgInstantiateContract2) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1095,53 +1183,33 @@ func (m *MsgInstantiateContractResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgInstantiateContractResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgInstantiateContract2) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgInstantiateContract2) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + if m.FixMsg { i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + if m.FixMsg { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x40 } - return len(dAtA) - i, nil -} - -func (m *MsgExecuteContract) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if len(m.Salt) > 0 { + i -= len(m.Salt) + copy(dAtA[i:], m.Salt) + i = encodeVarintTx(dAtA, i, uint64(len(m.Salt))) + i-- + dAtA[i] = 0x3a } - return dAtA[:n], nil -} - -func (m *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l if len(m.Funds) > 0 { for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { { @@ -1153,7 +1221,7 @@ func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } } if len(m.Msg) > 0 { @@ -1161,12 +1229,24 @@ func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Msg) i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x2a } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintTx(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0x22 + } + if m.CodeID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeID)) + i-- + dAtA[i] = 0x18 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0x12 } @@ -1180,7 +1260,7 @@ func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgExecuteContractResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgInstantiateContractResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1190,12 +1270,12 @@ func (m *MsgExecuteContractResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgExecuteContractResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgInstantiateContractResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgExecuteContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1205,12 +1285,19 @@ func (m *MsgExecuteContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, err copy(dAtA[i:], m.Data) i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error) { +func (m *MsgInstantiateContract2Response) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1220,12 +1307,137 @@ func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgInstantiateContract2Response) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgInstantiateContract2Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteContract) 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 *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x1a + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteContractResponse) 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 *MsgExecuteContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMigrateContract) 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 *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1427,7 +1639,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgStoreCode) Size() (n int) { if m == nil { return 0 @@ -1458,6 +1669,10 @@ func (m *MsgStoreCodeResponse) Size() (n int) { if m.CodeID != 0 { n += 1 + sovTx(uint64(m.CodeID)) } + l = len(m.Checksum) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1495,6 +1710,47 @@ func (m *MsgInstantiateContract) Size() (n int) { return n } +func (m *MsgInstantiateContract2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + l = len(m.Label) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Salt) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.FixMsg { + n += 2 + } + return n +} + func (m *MsgInstantiateContractResponse) Size() (n int) { if m == nil { return 0 @@ -1512,6 +1768,23 @@ func (m *MsgInstantiateContractResponse) Size() (n int) { return n } +func (m *MsgInstantiateContract2Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgExecuteContract) Size() (n int) { if m == nil { return 0 @@ -1648,11 +1921,9 @@ func (m *MsgClearAdminResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1743,14 +2014,352 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) - if m.WASMByteCode == nil { - m.WASMByteCode = []byte{} + m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) + if m.WASMByteCode == nil { + m.WASMByteCode = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InstantiatePermission == nil { + m.InstantiatePermission = &AccessConfig{} + } + if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStoreCodeResponse) 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 ErrIntOverflowTx + } + 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: MsgStoreCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + } + m.CodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...) + if m.Checksum == nil { + m.Checksum = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInstantiateContract) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + } + m.CodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1777,10 +2386,8 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.InstantiatePermission == nil { - m.InstantiatePermission = &AccessConfig{} - } - if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Funds = append(m.Funds, types.Coin{}) + if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1805,78 +2412,7 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { } return nil } - -func (m *MsgStoreCodeResponse) 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 ErrIntOverflowTx - } - 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: MsgStoreCodeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStoreCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) - } - m.CodeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { +func (m *MsgInstantiateContract2) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1899,10 +2435,10 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContract: wiretype end group for non-group") + return fmt.Errorf("proto: MsgInstantiateContract2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgInstantiateContract2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2088,6 +2624,60 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Salt = append(m.Salt[:0], dAtA[iNdEx:postIndex]...) + if m.Salt == nil { + m.Salt = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FixMsg", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FixMsg = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2109,7 +2699,6 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2226,7 +2815,122 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgInstantiateContract2Response) 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 ErrIntOverflowTx + } + 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: MsgInstantiateContract2Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract2Response: 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 ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2409,7 +3113,6 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2494,7 +3197,6 @@ func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2662,7 +3364,6 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2747,7 +3448,6 @@ func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2894,7 +3594,6 @@ func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2945,7 +3644,6 @@ func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3060,7 +3758,6 @@ func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3111,7 +3808,6 @@ func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/tx_test.go b/x/wasm/types/tx_test.go index b0ea43e96..f5838b345 100644 --- a/x/wasm/types/tx_test.go +++ b/x/wasm/types/tx_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" @@ -15,7 +15,7 @@ import ( const firstCodeID = 1 func TestStoreCodeValidation(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size @@ -79,11 +79,12 @@ func TestStoreCodeValidation(t *testing.T) { } func TestInstantiateContractValidation(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size goodAddress := sdk.AccAddress(make([]byte, 20)).String() + sdk.GetConfig().SetAddressVerifier(VerifyAddressLen()) cases := map[string]struct { msg MsgInstantiateContract @@ -185,8 +186,144 @@ func TestInstantiateContractValidation(t *testing.T) { } } +func TestInstantiateContract2Validation(t *testing.T) { + bad, err := sdk.AccAddressFromHexUnsafe("012345") + require.NoError(t, err) + badAddress := bad.String() + // proper address size + goodAddress := sdk.AccAddress(make([]byte, 20)).String() + sdk.GetConfig().SetAddressVerifier(VerifyAddressLen()) + + cases := map[string]struct { + msg MsgInstantiateContract2 + valid bool + }{ + "empty": { + msg: MsgInstantiateContract2{}, + valid: false, + }, + "correct minimal": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: "foo", + Msg: []byte("{}"), + Salt: []byte{0}, + }, + valid: true, + }, + "missing code": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + Label: "foo", + Msg: []byte("{}"), + Salt: []byte{0}, + }, + valid: false, + }, + "missing label": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + Msg: []byte("{}"), + Salt: []byte{0}, + }, + valid: false, + }, + "label too long": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + Label: strings.Repeat("food", 33), + Salt: []byte{0}, + }, + valid: false, + }, + "bad sender minimal": { + msg: MsgInstantiateContract2{ + Sender: badAddress, + CodeID: firstCodeID, + Label: "foo", + Msg: []byte("{}"), + Salt: []byte{0}, + }, + valid: false, + }, + "correct maximal": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: strings.Repeat("a", MaxLabelSize), + Msg: []byte(`{"some": "data"}`), + Funds: sdk.Coins{sdk.Coin{Denom: "foobar", Amount: sdk.NewInt(200)}}, + Salt: bytes.Repeat([]byte{0}, MaxSaltSize), + FixMsg: true, + }, + valid: true, + }, + "negative funds": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + 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)}}, + Salt: []byte{0}, + }, + valid: false, + }, + "non json init msg": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: "foo", + Msg: []byte("invalid-json"), + Salt: []byte{0}, + }, + valid: false, + }, + "empty init msg": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: "foo", + Salt: []byte{0}, + }, + valid: false, + }, + "empty salt": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: "foo", + Msg: []byte(`{"some": "data"}`), + }, + valid: false, + }, + "salt too long": { + msg: MsgInstantiateContract2{ + Sender: goodAddress, + CodeID: firstCodeID, + Label: "foo", + Msg: []byte(`{"some": "data"}`), + Salt: bytes.Repeat([]byte{0}, 65), + }, + valid: false, + }, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.valid { + assert.NoError(t, err) + } else { + assert.Error(t, err) + } + }) + } +} + func TestExecuteContractValidation(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size @@ -295,7 +432,7 @@ func TestExecuteContractValidation(t *testing.T) { } func TestMsgUpdateAdministrator(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size @@ -367,7 +504,7 @@ func TestMsgUpdateAdministrator(t *testing.T) { } func TestMsgClearAdministrator(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size @@ -418,7 +555,7 @@ func TestMsgClearAdministrator(t *testing.T) { } func TestMsgMigrateContract(t *testing.T) { - bad, err := sdk.AccAddressFromHex("012345") + bad, err := sdk.AccAddressFromHexUnsafe("012345") require.NoError(t, err) badAddress := bad.String() // proper address size diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go index 7c9e14e64..6453c5f1d 100644 --- a/x/wasm/types/types.go +++ b/x/wasm/types/types.go @@ -88,7 +88,7 @@ func (c *ContractInfo) ValidateBasic() error { return sdkerrors.Wrap(err, "admin") } } - if err := validateLabel(c.Label); err != nil { + if err := ValidateLabel(c.Label); err != nil { return sdkerrors.Wrap(err, "label") } if c.Extension == nil { @@ -128,10 +128,11 @@ func (c *ContractInfo) SetExtension(ext ContractInfoExtension) error { // ReadExtension copies the extension value to the pointer passed as argument so that there is no need to cast // For example with a custom extension of type `MyContractDetails` it will look as following: -// var d MyContractDetails -// if err := info.ReadExtension(&d); err != nil { -// return nil, sdkerrors.Wrap(err, "extension") -// } +// +// var d MyContractDetails +// if err := info.ReadExtension(&d); err != nil { +// return nil, sdkerrors.Wrap(err, "extension") +// } func (c *ContractInfo) ReadExtension(e ContractInfoExtension) error { rv := reflect.ValueOf(e) if rv.Kind() != reflect.Ptr || rv.IsNil() { @@ -333,18 +334,54 @@ func VerifyAddressLen() func(addr []byte) error { // IsSubset will return true if the caller is the same as the superset, // or if the caller is more restrictive than the superset. -func (a AccessConfig) IsSubset(superSet AccessConfig) bool { - switch superSet.Permission { +func (a AccessType) IsSubset(superSet AccessType) bool { + switch superSet { case AccessTypeEverybody: // Everything is a subset of this - return a.Permission != AccessTypeUnspecified + return a != AccessTypeUnspecified case AccessTypeNobody: // Only an exact match is a subset of this - return a.Permission == AccessTypeNobody + return a == AccessTypeNobody + case AccessTypeOnlyAddress, AccessTypeAnyOfAddresses: + // Nobody or address(es) + return a == AccessTypeNobody || a == AccessTypeOnlyAddress || a == AccessTypeAnyOfAddresses + default: + return false + } +} + +// IsSubset will return true if the caller is the same as the superset, +// or if the caller is more restrictive than the superset. +func (a AccessConfig) IsSubset(superSet AccessConfig) bool { + switch superSet.Permission { case AccessTypeOnlyAddress: // An exact match or nobody - return a.Permission == AccessTypeNobody || (a.Permission == AccessTypeOnlyAddress && a.Address == superSet.Address) - default: + return a.Permission == AccessTypeNobody || (a.Permission == AccessTypeOnlyAddress && a.Address == superSet.Address) || + (a.Permission == AccessTypeAnyOfAddresses && isSubset([]string{superSet.Address}, a.Addresses)) + case AccessTypeAnyOfAddresses: + // An exact match or nobody + return a.Permission == AccessTypeNobody || (a.Permission == AccessTypeOnlyAddress && isSubset(superSet.Addresses, []string{a.Address})) || + a.Permission == AccessTypeAnyOfAddresses && isSubset(superSet.Addresses, a.Addresses) + case AccessTypeUnspecified: return false + default: + return a.Permission.IsSubset(superSet.Permission) + } +} + +// return true when all elements in sub are also part of super +func isSubset(super, sub []string) bool { + if len(sub) == 0 { + return true + } + var matches int + for _, o := range sub { + for _, s := range super { + if o == s { + matches++ + break + } + } } + return matches == len(sub) } diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go index 05ff057a0..62bc6090e 100644 --- a/x/wasm/types/types.pb.go +++ b/x/wasm/types/types.pb.go @@ -6,24 +6,20 @@ package types import ( bytes "bytes" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes" + 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 - _ = math.Inf -) +var _ = fmt.Errorf +var _ = 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,10 +35,13 @@ const ( AccessTypeUnspecified AccessType = 0 // AccessTypeNobody forbidden AccessTypeNobody AccessType = 1 - // AccessTypeOnlyAddress restricted to an address + // 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{ @@ -50,13 +49,15 @@ var AccessType_name = map[int32]string{ 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_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) { @@ -110,11 +111,9 @@ 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) @@ -127,15 +126,12 @@ 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) } @@ -145,7 +141,10 @@ 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 string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` + // 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{} } @@ -154,11 +153,9 @@ 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) @@ -171,15 +168,12 @@ 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) } @@ -197,11 +191,9 @@ 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) @@ -214,15 +206,12 @@ 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) } @@ -245,11 +234,9 @@ 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) @@ -262,15 +249,12 @@ 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) } @@ -303,11 +287,9 @@ 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) @@ -320,15 +302,12 @@ 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) } @@ -351,11 +330,9 @@ 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) @@ -368,15 +345,12 @@ 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) } @@ -399,11 +373,9 @@ 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) @@ -416,15 +388,12 @@ 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) } @@ -445,11 +414,9 @@ 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) @@ -462,15 +429,12 @@ 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) } @@ -493,78 +457,81 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/types.proto", fileDescriptor_e6155d98fa173e02) } var fileDescriptor_e6155d98fa173e02 = []byte{ - // 1123 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcd, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x93, 0xec, 0xd7, 0x34, 0x14, 0x77, 0xd8, 0xa5, 0x49, 0xa8, 0x9c, 0xd4, 0x14, 0xd8, - 0x7e, 0x25, 0x74, 0x41, 0x80, 0x7a, 0xa8, 0x94, 0x0f, 0xd3, 0xb8, 0x62, 0x93, 0x68, 0x92, 0x52, - 0x2d, 0x52, 0x65, 0x39, 0xf6, 0x6c, 0x62, 0xd5, 0xf1, 0x44, 0x9e, 0xc9, 0x36, 0xfe, 0x0f, 0x50, - 0x24, 0x04, 0x37, 0xb8, 0x44, 0x42, 0x80, 0x50, 0xff, 0x00, 0xae, 0xdc, 0x2b, 0x4e, 0x3d, 0x72, - 0x8a, 0x20, 0xbd, 0xc0, 0x75, 0x8f, 0xe5, 0x82, 0x3c, 0x93, 0x10, 0xab, 0xdd, 0x76, 0xc3, 0xc5, - 0xf2, 0xbc, 0xf7, 0x7e, 0xbf, 0xf7, 0xde, 0x6f, 0xde, 0xb3, 0x0c, 0x2e, 0x58, 0x84, 0xf6, 0x1f, - 0x9a, 0xb4, 0x5f, 0xe4, 0x8f, 0xa3, 0x1b, 0x45, 0x16, 0x0c, 0x30, 0x2d, 0x0c, 0x7c, 0xc2, 0x08, - 0x94, 0x17, 0xde, 0x02, 0x7f, 0x1c, 0xdd, 0xc8, 0x66, 0x42, 0x0b, 0xa1, 0x06, 0xf7, 0x17, 0xc5, - 0x41, 0x04, 0x67, 0xb7, 0xbb, 0xa4, 0x4b, 0x84, 0x3d, 0x7c, 0x9b, 0x5b, 0x33, 0x5d, 0x42, 0xba, - 0x2e, 0x2e, 0xf2, 0x53, 0x67, 0x78, 0x58, 0x34, 0xbd, 0x40, 0xb8, 0xd4, 0xfb, 0xe0, 0xf5, 0x92, - 0x65, 0x61, 0x4a, 0xdb, 0xc1, 0x00, 0x37, 0x4d, 0xdf, 0xec, 0xc3, 0x2a, 0x58, 0x3b, 0x32, 0xdd, - 0x21, 0x4e, 0x4b, 0x79, 0x69, 0xf7, 0xec, 0xde, 0x85, 0xc2, 0xf3, 0x05, 0x14, 0x96, 0x88, 0xb2, - 0x7c, 0x3c, 0xcd, 0xa5, 0x02, 0xb3, 0xef, 0xde, 0x54, 0x39, 0x48, 0x45, 0x02, 0x7c, 0x33, 0xf9, - 0xdd, 0xf7, 0x39, 0x49, 0xfd, 0x56, 0x02, 0x29, 0x11, 0x5d, 0x21, 0xde, 0xa1, 0xd3, 0x85, 0x2d, - 0x00, 0x06, 0xd8, 0xef, 0x3b, 0x94, 0x3a, 0xc4, 0x5b, 0x29, 0xc3, 0xce, 0xf1, 0x34, 0x77, 0x4e, - 0x64, 0x58, 0x22, 0x55, 0x14, 0xa1, 0x81, 0xd7, 0xc0, 0x86, 0x69, 0xdb, 0x3e, 0xa6, 0x34, 0x1d, - 0xcf, 0x4b, 0xbb, 0x5b, 0x65, 0x78, 0x3c, 0xcd, 0x9d, 0x15, 0x98, 0xb9, 0x43, 0x45, 0x8b, 0x90, - 0x79, 0x65, 0x5f, 0xc7, 0xc1, 0x3a, 0xef, 0x97, 0x42, 0x02, 0xa0, 0x45, 0x6c, 0x6c, 0x0c, 0x07, - 0x2e, 0x31, 0x6d, 0xc3, 0xe4, 0xb9, 0x79, 0x6d, 0x67, 0xf6, 0x94, 0x97, 0xd5, 0x26, 0xfa, 0x29, - 0x5f, 0x7c, 0x3c, 0xcd, 0xc5, 0x8e, 0xa7, 0xb9, 0x8c, 0xc8, 0xf6, 0x22, 0x8f, 0x8a, 0xe4, 0xd0, - 0x78, 0x97, 0xdb, 0x04, 0x14, 0x7e, 0x25, 0x01, 0xc5, 0xf1, 0x28, 0x33, 0x3d, 0xe6, 0x98, 0x0c, - 0x1b, 0x36, 0x3e, 0x34, 0x87, 0x2e, 0x33, 0x22, 0xca, 0xc4, 0x57, 0x50, 0xe6, 0xf2, 0xf1, 0x34, - 0xf7, 0x8e, 0xc8, 0xfb, 0x6a, 0x36, 0x15, 0x5d, 0x88, 0x04, 0x54, 0x85, 0xbf, 0xf9, 0x9f, 0x9b, - 0x2b, 0x12, 0x53, 0x7f, 0x90, 0xc0, 0x66, 0x85, 0xd8, 0x58, 0xf7, 0x0e, 0x09, 0x7c, 0x0b, 0x6c, - 0xf1, 0x5e, 0x7a, 0x26, 0xed, 0x71, 0x29, 0x52, 0x68, 0x33, 0x34, 0xd4, 0x4c, 0xda, 0x83, 0x69, - 0xb0, 0x61, 0xf9, 0xd8, 0x64, 0xc4, 0x17, 0x7a, 0xa3, 0xc5, 0x11, 0xb6, 0x00, 0x8c, 0x96, 0x62, - 0x71, 0x91, 0xd2, 0x6b, 0x2b, 0x49, 0x99, 0x0c, 0xa5, 0x44, 0xe7, 0x22, 0x78, 0xe1, 0xb8, 0x93, - 0xdc, 0x4c, 0xc8, 0xc9, 0x3b, 0xc9, 0xcd, 0xa4, 0xbc, 0xa6, 0xfe, 0x1a, 0x07, 0xa9, 0x0a, 0xf1, - 0x98, 0x6f, 0x5a, 0x8c, 0x17, 0xfa, 0x36, 0xd8, 0xe0, 0x85, 0x3a, 0x36, 0x2f, 0x33, 0x59, 0x06, - 0xb3, 0x69, 0x6e, 0x9d, 0xf7, 0x51, 0x45, 0xeb, 0xa1, 0x4b, 0xb7, 0x5f, 0x51, 0xf0, 0x36, 0x58, - 0x33, 0xed, 0xbe, 0xe3, 0xa5, 0x13, 0xdc, 0x2e, 0x0e, 0xa1, 0xd5, 0x35, 0x3b, 0xd8, 0x4d, 0x27, - 0x85, 0x95, 0x1f, 0xe0, 0xad, 0x39, 0x0b, 0xb6, 0xe7, 0x1d, 0x5d, 0x3a, 0xa1, 0xa3, 0x0e, 0x25, - 0xee, 0x90, 0xe1, 0xf6, 0xa8, 0x49, 0xa8, 0xc3, 0x1c, 0xe2, 0xa1, 0x05, 0x08, 0x5e, 0x07, 0x67, - 0x9c, 0x8e, 0x65, 0x0c, 0x88, 0xcf, 0xc2, 0x72, 0xd7, 0xf9, 0xa8, 0xbe, 0x36, 0x9b, 0xe6, 0xb6, - 0xf4, 0x72, 0xa5, 0x49, 0x7c, 0xa6, 0x57, 0xd1, 0x96, 0xd3, 0xb1, 0xf8, 0xab, 0x0d, 0xf7, 0xc1, - 0x16, 0x1e, 0x31, 0xec, 0xf1, 0x79, 0xd8, 0xe0, 0x09, 0xb7, 0x0b, 0x62, 0x93, 0x0b, 0x8b, 0x4d, - 0x2e, 0x94, 0xbc, 0xa0, 0x9c, 0xf9, 0xed, 0x97, 0xeb, 0x3b, 0x51, 0x51, 0xb4, 0x05, 0x0c, 0x2d, - 0x19, 0x6e, 0x26, 0xff, 0x0a, 0xc7, 0xfe, 0x1f, 0x09, 0xa4, 0x17, 0xa1, 0xa1, 0x48, 0x35, 0x87, - 0x32, 0xe2, 0x07, 0x9a, 0xc7, 0xfc, 0x00, 0x36, 0xc1, 0x16, 0x19, 0x60, 0xdf, 0x64, 0xcb, 0xdd, - 0xdc, 0x7b, 0xb1, 0xc5, 0x13, 0xe0, 0x8d, 0x05, 0x2a, 0x9c, 0x4b, 0xb4, 0x24, 0x89, 0xde, 0x4e, - 0xfc, 0xa5, 0xb7, 0x73, 0x0b, 0x6c, 0x0c, 0x07, 0x36, 0xd7, 0x35, 0xf1, 0x7f, 0x74, 0x9d, 0x83, - 0xe0, 0x2e, 0x48, 0xf4, 0x69, 0x97, 0xdf, 0x55, 0xaa, 0xfc, 0xe6, 0xb3, 0x69, 0x0e, 0x22, 0xf3, - 0xe1, 0xa2, 0xca, 0x7d, 0x4c, 0xa9, 0xd9, 0xc5, 0x28, 0x0c, 0x51, 0x11, 0x80, 0x2f, 0x12, 0xc1, - 0x8b, 0x20, 0xd5, 0x71, 0x89, 0xf5, 0xc0, 0xe8, 0x61, 0xa7, 0xdb, 0x63, 0x62, 0x8e, 0xd0, 0x19, - 0x6e, 0xab, 0x71, 0x13, 0xcc, 0x80, 0x4d, 0x36, 0x32, 0x1c, 0xcf, 0xc6, 0x23, 0xd1, 0x08, 0xda, - 0x60, 0x23, 0x3d, 0x3c, 0xaa, 0x0e, 0x58, 0xdb, 0x27, 0x36, 0x76, 0xe1, 0x1d, 0x90, 0x78, 0x80, - 0x03, 0xb1, 0x2c, 0xe5, 0x4f, 0x9e, 0x4d, 0x73, 0x1f, 0x76, 0x1d, 0xd6, 0x1b, 0x76, 0x0a, 0x16, - 0xe9, 0x17, 0x19, 0xf6, 0xec, 0x70, 0xe1, 0x3c, 0x16, 0x7d, 0x75, 0x9d, 0x0e, 0x2d, 0x76, 0x02, - 0x86, 0x69, 0xa1, 0x86, 0x47, 0xe5, 0xf0, 0x05, 0x85, 0x24, 0xe1, 0x00, 0x8a, 0x6f, 0x70, 0x9c, - 0xaf, 0x9e, 0x38, 0x5c, 0xf9, 0x5b, 0x02, 0x60, 0xb9, 0xff, 0xf0, 0x23, 0x70, 0xbe, 0x54, 0xa9, - 0x68, 0xad, 0x96, 0xd1, 0x3e, 0x68, 0x6a, 0xc6, 0xdd, 0x7a, 0xab, 0xa9, 0x55, 0xf4, 0x4f, 0x75, - 0xad, 0x2a, 0xc7, 0xb2, 0x99, 0xf1, 0x24, 0xbf, 0xb3, 0x0c, 0xbe, 0xeb, 0xd1, 0x01, 0xb6, 0x9c, - 0x43, 0x07, 0xdb, 0xf0, 0x1a, 0x80, 0x51, 0x5c, 0xbd, 0x51, 0x6e, 0x54, 0x0f, 0x64, 0x29, 0xbb, - 0x3d, 0x9e, 0xe4, 0xe5, 0x25, 0xa4, 0x4e, 0x3a, 0xc4, 0x0e, 0xe0, 0xc7, 0x20, 0x1d, 0x8d, 0x6e, - 0xd4, 0x3f, 0x3b, 0x30, 0x4a, 0xd5, 0x2a, 0xd2, 0x5a, 0x2d, 0x39, 0xfe, 0x7c, 0x9a, 0x86, 0xe7, - 0x06, 0x25, 0xf1, 0x9d, 0x85, 0x7b, 0x60, 0x27, 0x0a, 0xd4, 0x3e, 0xd7, 0xd0, 0x01, 0xcf, 0x94, - 0xc8, 0x9e, 0x1f, 0x4f, 0xf2, 0x6f, 0x2c, 0x51, 0xda, 0x11, 0xf6, 0x83, 0x30, 0x59, 0x76, 0xf3, - 0xcb, 0x1f, 0x95, 0xd8, 0xa3, 0x9f, 0x94, 0xd8, 0x95, 0x9f, 0x13, 0x20, 0x7f, 0xda, 0xa4, 0x41, - 0x0c, 0xde, 0xaf, 0x34, 0xea, 0x6d, 0x54, 0xaa, 0xb4, 0x8d, 0x4a, 0xa3, 0xaa, 0x19, 0x35, 0xbd, - 0xd5, 0x6e, 0xa0, 0x03, 0xa3, 0xd1, 0xd4, 0x50, 0xa9, 0xad, 0x37, 0xea, 0x27, 0x49, 0x53, 0x1c, - 0x4f, 0xf2, 0x57, 0x4f, 0xe3, 0x8e, 0x0a, 0x76, 0x0f, 0x5c, 0x5e, 0x29, 0x8d, 0x5e, 0xd7, 0xdb, - 0xb2, 0x94, 0xdd, 0x1d, 0x4f, 0xf2, 0x97, 0x4e, 0xe3, 0xd7, 0x3d, 0x87, 0xc1, 0xfb, 0xe0, 0xda, - 0x4a, 0xc4, 0xfb, 0xfa, 0x6d, 0x54, 0x6a, 0x6b, 0x72, 0x3c, 0x7b, 0x75, 0x3c, 0xc9, 0xbf, 0x77, - 0x1a, 0xf7, 0xbe, 0xd3, 0xf5, 0x4d, 0x86, 0x57, 0xa6, 0xbf, 0xad, 0xd5, 0xb5, 0x96, 0xde, 0x92, - 0x13, 0xab, 0xd1, 0xdf, 0xc6, 0x1e, 0xa6, 0x0e, 0xcd, 0x26, 0xc3, 0xcb, 0x2a, 0xd7, 0x1e, 0xff, - 0xa9, 0xc4, 0x1e, 0xcd, 0x14, 0xe9, 0xf1, 0x4c, 0x91, 0x9e, 0xcc, 0x14, 0xe9, 0x8f, 0x99, 0x22, - 0x7d, 0xf3, 0x54, 0x89, 0x3d, 0x79, 0xaa, 0xc4, 0x7e, 0x7f, 0xaa, 0xc4, 0xbe, 0x78, 0x37, 0xb2, - 0x07, 0x15, 0x42, 0xfb, 0xf7, 0x16, 0xbf, 0x3a, 0x76, 0x71, 0x24, 0x7e, 0x79, 0xf8, 0xff, 0x4e, - 0x67, 0x9d, 0x7f, 0xd5, 0x3e, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x21, 0x8c, 0xa0, 0x70, 0x10, - 0x09, 0x00, 0x00, + // 1178 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, 0xec, 0xd2, 0x6c, 0x58, 0x25, 0xa9, + 0x29, 0xb0, 0xfd, 0x95, 0xd0, 0x05, 0x01, 0xea, 0xa1, 0x52, 0x7e, 0xb8, 0x5d, 0x57, 0x6c, 0x1c, + 0x4d, 0x52, 0xaa, 0x45, 0xaa, 0x2c, 0xc7, 0x9e, 0xcd, 0x5a, 0x75, 0x3c, 0x91, 0x67, 0xb2, 0x8d, + 0xff, 0x03, 0x14, 0x09, 0xc1, 0x91, 0x4b, 0x24, 0x04, 0x08, 0x95, 0x3b, 0x57, 0xee, 0x15, 0x5c, + 0x7a, 0xe4, 0x14, 0xc1, 0xf6, 0xc2, 0x39, 0xc7, 0x72, 0x41, 0x9e, 0x89, 0x1b, 0xd3, 0x6e, 0xbb, + 0xe1, 0x62, 0xcd, 0xbc, 0xf7, 0x3e, 0x9f, 0xf7, 0xde, 0x67, 0xe6, 0x8d, 0x0c, 0xb6, 0x2c, 0x42, + 0x7b, 0x0f, 0x4d, 0xda, 0x2b, 0xf3, 0xcf, 0xd1, 0xf5, 0x32, 0x0b, 0xfa, 0x98, 0x96, 0xfa, 0x3e, + 0x61, 0x04, 0xca, 0x91, 0xb7, 0xc4, 0x3f, 0x47, 0xd7, 0x73, 0x9b, 0xa1, 0x85, 0x50, 0x83, 0xfb, + 0xcb, 0x62, 0x23, 0x82, 0x73, 0xeb, 0x5d, 0xd2, 0x25, 0xc2, 0x1e, 0xae, 0x66, 0xd6, 0xcd, 0x2e, + 0x21, 0x5d, 0x17, 0x97, 0xf9, 0xae, 0x33, 0x38, 0x28, 0x9b, 0x5e, 0x20, 0x5c, 0xca, 0x7d, 0xf0, + 0xff, 0x8a, 0x65, 0x61, 0x4a, 0xdb, 0x41, 0x1f, 0x37, 0x4d, 0xdf, 0xec, 0xc1, 0x3a, 0x58, 0x3a, + 0x32, 0xdd, 0x01, 0xce, 0x4a, 0x45, 0x69, 0xfb, 0xec, 0xce, 0x56, 0xe9, 0xc5, 0x02, 0x4a, 0x73, + 0x44, 0x55, 0x9e, 0x4e, 0x0a, 0x6b, 0x81, 0xd9, 0x73, 0x6f, 0x28, 0x1c, 0xa4, 0x20, 0x01, 0xbe, + 0x91, 0xfe, 0xe6, 0xdb, 0x82, 0xa4, 0xfc, 0x26, 0x81, 0x35, 0x11, 0x5d, 0x23, 0xde, 0x81, 0xd3, + 0x85, 0x2d, 0x00, 0xfa, 0xd8, 0xef, 0x39, 0x94, 0x3a, 0xc4, 0x5b, 0x28, 0xc3, 0xc6, 0x74, 0x52, + 0x38, 0x27, 0x32, 0xcc, 0x91, 0x0a, 0x8a, 0xd1, 0xc0, 0xab, 0x60, 0xc5, 0xb4, 0x6d, 0x1f, 0x53, + 0x9a, 0x4d, 0x16, 0xa5, 0xed, 0x4c, 0x15, 0x4e, 0x27, 0x85, 0xb3, 0x02, 0x33, 0x73, 0x28, 0x28, + 0x0a, 0x81, 0x3b, 0x20, 0x33, 0x5b, 0x62, 0x9a, 0x4d, 0x15, 0x53, 0xdb, 0x99, 0xea, 0xfa, 0x74, + 0x52, 0x90, 0xff, 0x15, 0x8f, 0xa9, 0x82, 0xe6, 0x61, 0xb3, 0x6e, 0xbe, 0x4a, 0x82, 0x65, 0xae, + 0x11, 0x85, 0x04, 0x40, 0x8b, 0xd8, 0xd8, 0x18, 0xf4, 0x5d, 0x62, 0xda, 0x86, 0xc9, 0xeb, 0xe5, + 0xfd, 0x9c, 0xd9, 0xc9, 0xbf, 0xaa, 0x1f, 0xa1, 0x41, 0xf5, 0xc2, 0xe3, 0x49, 0x21, 0x31, 0x9d, + 0x14, 0x36, 0x45, 0xc6, 0x97, 0x79, 0x14, 0x24, 0x87, 0xc6, 0xbb, 0xdc, 0x26, 0xa0, 0xf0, 0x4b, + 0x09, 0xe4, 0x1d, 0x8f, 0x32, 0xd3, 0x63, 0x8e, 0xc9, 0xb0, 0x61, 0xe3, 0x03, 0x73, 0xe0, 0x32, + 0x23, 0xa6, 0x66, 0x72, 0x01, 0x35, 0x2f, 0x4d, 0x27, 0x85, 0x77, 0x44, 0xde, 0xd7, 0xb3, 0x29, + 0x68, 0x2b, 0x16, 0x50, 0x17, 0xfe, 0xe6, 0x73, 0x37, 0x57, 0x24, 0xa1, 0x7c, 0x27, 0x81, 0xd5, + 0x1a, 0xb1, 0xb1, 0xe6, 0x1d, 0x10, 0xf8, 0x16, 0xc8, 0xf0, 0x5e, 0x0e, 0x4d, 0x7a, 0xc8, 0xa5, + 0x58, 0x43, 0xab, 0xa1, 0x61, 0xd7, 0xa4, 0x87, 0x30, 0x0b, 0x56, 0x2c, 0x1f, 0x9b, 0x8c, 0xf8, + 0xe2, 0x8c, 0x50, 0xb4, 0x85, 0x2d, 0x00, 0xe3, 0xa5, 0x58, 0x5c, 0xa4, 0xec, 0xd2, 0x42, 0x52, + 0xa6, 0x43, 0x29, 0xd1, 0xb9, 0x18, 0x5e, 0x38, 0xee, 0xa4, 0x57, 0x53, 0x72, 0xfa, 0x4e, 0x7a, + 0x35, 0x2d, 0x2f, 0x29, 0xbf, 0x24, 0xc1, 0x5a, 0x8d, 0x78, 0xcc, 0x37, 0x2d, 0xc6, 0x0b, 0x7d, + 0x1b, 0xac, 0xf0, 0x42, 0x1d, 0x9b, 0x97, 0x99, 0xae, 0x82, 0xe3, 0x49, 0x61, 0x99, 0xf7, 0x51, + 0x47, 0xcb, 0xa1, 0x4b, 0xb3, 0x5f, 0x53, 0xf0, 0x3a, 0x58, 0x32, 0xed, 0x9e, 0xe3, 0x65, 0x53, + 0xdc, 0x2e, 0x36, 0xa1, 0xd5, 0x35, 0x3b, 0xd8, 0xcd, 0xa6, 0x85, 0x95, 0x6f, 0xe0, 0xcd, 0x19, + 0x0b, 0xb6, 0x67, 0x1d, 0x5d, 0x3c, 0xa1, 0xa3, 0x0e, 0x25, 0xee, 0x80, 0xe1, 0xf6, 0xb0, 0x49, + 0xa8, 0xc3, 0x1c, 0xe2, 0xa1, 0x08, 0x04, 0xaf, 0x81, 0x33, 0x4e, 0xc7, 0x32, 0xfa, 0xc4, 0x67, + 0x61, 0xb9, 0xcb, 0xfc, 0x7a, 0xff, 0xef, 0x78, 0x52, 0xc8, 0x68, 0xd5, 0x5a, 0x93, 0xf8, 0x4c, + 0xab, 0xa3, 0x8c, 0xd3, 0xb1, 0xf8, 0xd2, 0x86, 0x7b, 0x20, 0x83, 0x87, 0x0c, 0x7b, 0xfc, 0x3e, + 0xac, 0xf0, 0x84, 0xeb, 0x25, 0x31, 0xfd, 0xa5, 0x68, 0xfa, 0x4b, 0x15, 0x2f, 0xa8, 0x6e, 0xfe, + 0xfa, 0xf3, 0xb5, 0x8d, 0xb8, 0x28, 0x6a, 0x04, 0x43, 0x73, 0x86, 0x1b, 0xe9, 0xbf, 0xc2, 0x6b, + 0xff, 0xb7, 0x04, 0xb2, 0x51, 0x68, 0x28, 0xd2, 0xae, 0x43, 0x19, 0xf1, 0x03, 0xd5, 0x63, 0x7e, + 0x00, 0x9b, 0x20, 0x43, 0xfa, 0xd8, 0x37, 0xd9, 0x7c, 0x9e, 0x77, 0x5e, 0x6e, 0xf1, 0x04, 0xb8, + 0x1e, 0xa1, 0xc2, 0x7b, 0x89, 0xe6, 0x24, 0xf1, 0xd3, 0x49, 0xbe, 0xf2, 0x74, 0x6e, 0x82, 0x95, + 0x41, 0xdf, 0xe6, 0xba, 0xa6, 0xfe, 0x8b, 0xae, 0x33, 0x10, 0xdc, 0x06, 0xa9, 0x1e, 0xed, 0xf2, + 0xb3, 0x5a, 0xab, 0xbe, 0xf9, 0x6c, 0x52, 0x80, 0xc8, 0x7c, 0x18, 0x55, 0xb9, 0x87, 0x29, 0x35, + 0xbb, 0x18, 0x85, 0x21, 0x0a, 0x02, 0xf0, 0x65, 0x22, 0x78, 0x01, 0xac, 0x75, 0x5c, 0x62, 0x3d, + 0x30, 0x0e, 0xb1, 0xd3, 0x3d, 0x64, 0xe2, 0x1e, 0xa1, 0x33, 0xdc, 0xb6, 0xcb, 0x4d, 0x70, 0x13, + 0xac, 0xb2, 0xa1, 0xe1, 0x78, 0x36, 0x1e, 0x8a, 0x46, 0xd0, 0x0a, 0x1b, 0x6a, 0xe1, 0x56, 0x71, + 0xc0, 0xd2, 0x1e, 0xb1, 0xb1, 0x0b, 0xef, 0x80, 0xd4, 0x03, 0x1c, 0x88, 0x61, 0xa9, 0x7e, 0xf2, + 0x6c, 0x52, 0xf8, 0xb0, 0xeb, 0xb0, 0xc3, 0x41, 0xa7, 0x64, 0x91, 0x5e, 0x99, 0x61, 0xcf, 0x0e, + 0x07, 0xce, 0x63, 0xf1, 0xa5, 0xeb, 0x74, 0x68, 0xb9, 0x13, 0x30, 0x4c, 0x4b, 0xbb, 0x78, 0x58, + 0x0d, 0x17, 0x28, 0x24, 0x09, 0x2f, 0xa0, 0x78, 0xb7, 0x93, 0x7c, 0xf4, 0xc4, 0xe6, 0xf2, 0x4f, + 0x49, 0x00, 0xe6, 0xf3, 0x0f, 0x3f, 0x02, 0xe7, 0x2b, 0xb5, 0x9a, 0xda, 0x6a, 0x19, 0xed, 0xfd, + 0xa6, 0x6a, 0xdc, 0x6d, 0xb4, 0x9a, 0x6a, 0x4d, 0xbb, 0xa5, 0xa9, 0x75, 0x39, 0x91, 0xdb, 0x1c, + 0x8d, 0x8b, 0x1b, 0xf3, 0xe0, 0xbb, 0x1e, 0xed, 0x63, 0xcb, 0x39, 0x70, 0xb0, 0x0d, 0xaf, 0x02, + 0x18, 0xc7, 0x35, 0xf4, 0xaa, 0x5e, 0xdf, 0x97, 0xa5, 0xdc, 0xfa, 0x68, 0x5c, 0x94, 0xe7, 0x90, + 0x06, 0xe9, 0x10, 0x3b, 0x80, 0x1f, 0x83, 0x6c, 0x3c, 0x5a, 0x6f, 0x7c, 0xba, 0x6f, 0x54, 0xea, + 0x75, 0xa4, 0xb6, 0x5a, 0x72, 0xf2, 0xc5, 0x34, 0xba, 0xe7, 0x06, 0x95, 0xe7, 0x6f, 0xf3, 0x46, + 0x1c, 0xa8, 0x7e, 0xa6, 0xa2, 0x7d, 0x9e, 0x29, 0x95, 0x3b, 0x3f, 0x1a, 0x17, 0xdf, 0x98, 0xa3, + 0xd4, 0x23, 0xec, 0x07, 0x3c, 0xd9, 0x4d, 0xb0, 0x15, 0xc7, 0x54, 0x1a, 0xfb, 0x86, 0x7e, 0x2b, + 0x4a, 0xa7, 0xb6, 0xe4, 0x74, 0x6e, 0x6b, 0x34, 0x2e, 0x66, 0xe7, 0xd0, 0x8a, 0x17, 0xe8, 0x07, + 0x95, 0xe8, 0x6d, 0xcf, 0xad, 0x7e, 0xf1, 0x7d, 0x3e, 0xf1, 0xe8, 0x87, 0x7c, 0xe2, 0xf2, 0x8f, + 0x29, 0x50, 0x3c, 0xed, 0xa6, 0x42, 0x0c, 0xde, 0xaf, 0xe9, 0x8d, 0x36, 0xaa, 0xd4, 0xda, 0x46, + 0x4d, 0xaf, 0xab, 0xc6, 0xae, 0xd6, 0x6a, 0xeb, 0x68, 0xdf, 0xd0, 0x9b, 0x2a, 0xaa, 0xb4, 0x35, + 0xbd, 0x71, 0x92, 0xb4, 0xe5, 0xd1, 0xb8, 0x78, 0xe5, 0x34, 0xee, 0xb8, 0xe0, 0xf7, 0xc0, 0xa5, + 0x85, 0xd2, 0x68, 0x0d, 0xad, 0x2d, 0x4b, 0xb9, 0xed, 0xd1, 0xb8, 0x78, 0xf1, 0x34, 0x7e, 0xcd, + 0x73, 0x18, 0xbc, 0x0f, 0xae, 0x2e, 0x44, 0xbc, 0xa7, 0xdd, 0x46, 0x95, 0xb6, 0x2a, 0x27, 0x73, + 0x57, 0x46, 0xe3, 0xe2, 0x7b, 0xa7, 0x71, 0xef, 0x39, 0x5d, 0xdf, 0x64, 0x78, 0x61, 0xfa, 0xdb, + 0x6a, 0x43, 0x6d, 0x69, 0x2d, 0x39, 0xb5, 0x18, 0xfd, 0x6d, 0xec, 0x61, 0xea, 0xd0, 0x5c, 0x3a, + 0x3c, 0xac, 0xea, 0xee, 0xe3, 0x3f, 0xf3, 0x89, 0x47, 0xc7, 0x79, 0xe9, 0xf1, 0x71, 0x5e, 0x7a, + 0x72, 0x9c, 0x97, 0xfe, 0x38, 0xce, 0x4b, 0x5f, 0x3f, 0xcd, 0x27, 0x9e, 0x3c, 0xcd, 0x27, 0x7e, + 0x7f, 0x9a, 0x4f, 0x7c, 0xfe, 0x6e, 0x6c, 0x8e, 0x6a, 0x84, 0xf6, 0xee, 0x45, 0xbf, 0x57, 0x76, + 0x79, 0x28, 0x7e, 0xb3, 0xf8, 0x3f, 0x56, 0x67, 0x99, 0xbf, 0x8a, 0x1f, 0xfc, 0x13, 0x00, 0x00, + 0xff, 0xff, 0x7a, 0x16, 0x8c, 0xd9, 0x84, 0x09, 0x00, 0x00, } func (this *AccessTypeParam) Equal(that interface{}) bool { @@ -591,7 +558,6 @@ func (this *AccessTypeParam) Equal(that interface{}) bool { } return true } - func (this *AccessConfig) Equal(that interface{}) bool { if that == nil { return this == nil @@ -617,9 +583,16 @@ func (this *AccessConfig) Equal(that interface{}) bool { if this.Address != that1.Address { return false } + if len(this.Addresses) != len(that1.Addresses) { + return false + } + for i := range this.Addresses { + if this.Addresses[i] != that1.Addresses[i] { + return false + } + } return true } - func (this *Params) Equal(that interface{}) bool { if that == nil { return this == nil @@ -647,7 +620,6 @@ func (this *Params) Equal(that interface{}) bool { } return true } - func (this *CodeInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -678,7 +650,6 @@ func (this *CodeInfo) Equal(that interface{}) bool { } return true } - func (this *ContractInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -721,7 +692,6 @@ func (this *ContractInfo) Equal(that interface{}) bool { } return true } - func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { if that == nil { return this == nil @@ -755,7 +725,6 @@ func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { } return true } - func (this *AbsoluteTxPosition) Equal(that interface{}) bool { if that == nil { return this == nil @@ -783,7 +752,6 @@ func (this *AbsoluteTxPosition) Equal(that interface{}) bool { } return true } - func (this *Model) Equal(that interface{}) bool { if that == nil { return this == nil @@ -811,7 +779,6 @@ func (this *Model) Equal(that interface{}) bool { } return true } - func (m *AccessTypeParam) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -860,6 +827,15 @@ func (m *AccessConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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) @@ -1173,7 +1149,6 @@ 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 @@ -1199,6 +1174,12 @@ func (m *AccessConfig) Size() (n int) { 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 } @@ -1329,11 +1310,9 @@ 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 @@ -1403,7 +1382,6 @@ func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { } return nil } - func (m *AccessConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1484,6 +1462,38 @@ func (m *AccessConfig) Unmarshal(dAtA []byte) error { } 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:]) @@ -1505,7 +1515,6 @@ func (m *AccessConfig) Unmarshal(dAtA []byte) error { } return nil } - func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1608,7 +1617,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } - func (m *CodeInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1758,7 +1766,6 @@ func (m *CodeInfo) Unmarshal(dAtA []byte) error { } return nil } - func (m *ContractInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2028,7 +2035,6 @@ func (m *ContractInfo) Unmarshal(dAtA []byte) error { } return nil } - func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2187,7 +2193,6 @@ func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { } return nil } - func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2276,7 +2281,6 @@ func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { } return nil } - func (m *Model) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2395,7 +2399,6 @@ 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 117415930..0abdbd00e 100644 --- a/x/wasm/types/types_test.go +++ b/x/wasm/types/types_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/rand" @@ -373,79 +373,332 @@ func TestVerifyAddressLen(t *testing.T) { } } -func TestAccesConfigSubset(t *testing.T) { +func TestAccessConfigSubset(t *testing.T) { + // read + // <, <= is subset of + // !< is not subset of specs := map[string]struct { check AccessConfig superSet AccessConfig isSubSet bool }{ + // nobody "nobody <= nobody": { superSet: AccessConfig{Permission: AccessTypeNobody}, check: AccessConfig{Permission: AccessTypeNobody}, isSubSet: true, }, - "only > nobody": { + "only !< nobody": { superSet: AccessConfig{Permission: AccessTypeNobody}, check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "foobar"}, isSubSet: false, }, - "everybody > nobody": { + "anyOf !< nobody": { + superSet: AccessConfig{Permission: AccessTypeNobody}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"foobar"}}, + isSubSet: false, + }, + "everybody !< nobody ": { superSet: AccessConfig{Permission: AccessTypeNobody}, check: AccessConfig{Permission: AccessTypeEverybody}, isSubSet: false, }, - "unspecified > nobody": { + "unspecified !< nobody": { superSet: AccessConfig{Permission: AccessTypeNobody}, check: AccessConfig{Permission: AccessTypeUnspecified}, isSubSet: false, }, - "nobody <= everybody": { + // only + "nobody < only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeNobody}, + isSubSet: true, + }, + "only <= only(same)": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + isSubSet: true, + }, + "only !< only(other)": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "other"}, + isSubSet: false, + }, + "anyOf(same) <= only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + isSubSet: true, + }, + "anyOf(other) !< only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"foobar"}}, + isSubSet: false, + }, + "anyOf(same, other) !< only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "foobar"}}, + isSubSet: false, + }, + "everybody !< only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeEverybody}, + isSubSet: false, + }, + "unspecified !<= only": { + superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + check: AccessConfig{Permission: AccessTypeUnspecified}, + isSubSet: false, + }, + + // any of + "nobody < anyOf": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeNobody}, + isSubSet: true, + }, + "only(same) < anyOf(same)": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + isSubSet: true, + }, + "only(same) < anyOf(same, other)": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other"}}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + isSubSet: true, + }, + "only(other) !< anyOf": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "other"}, + isSubSet: false, + }, + "anyOf < anyOf": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + isSubSet: true, + }, + "anyOf(multiple) < anyOf(multiple)": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other"}}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other"}}, + isSubSet: true, + }, + "anyOf(multiple, other) !< anyOf(multiple)": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other", "foo"}}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other", "bar"}}, + isSubSet: false, + }, + "anyOf(multiple) !< anyOf": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner", "other"}}, + isSubSet: false, + }, + "everybody !< anyOf": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeEverybody}, + isSubSet: false, + }, + "unspecified !< anyOf ": { + superSet: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"owner"}}, + check: AccessConfig{Permission: AccessTypeUnspecified}, + isSubSet: false, + }, + // everybody + "nobody < everybody": { superSet: AccessConfig{Permission: AccessTypeEverybody}, check: AccessConfig{Permission: AccessTypeNobody}, isSubSet: true, }, - "only <= everybody": { + "only < everybody": { superSet: AccessConfig{Permission: AccessTypeEverybody}, check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "foobar"}, isSubSet: true, }, + "anyOf < everybody": { + superSet: AccessConfig{Permission: AccessTypeEverybody}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"foobar"}}, + isSubSet: true, + }, "everybody <= everybody": { superSet: AccessConfig{Permission: AccessTypeEverybody}, check: AccessConfig{Permission: AccessTypeEverybody}, isSubSet: true, }, - "unspecified > everybody": { + "unspecified !< everybody ": { superSet: AccessConfig{Permission: AccessTypeEverybody}, check: AccessConfig{Permission: AccessTypeUnspecified}, isSubSet: false, }, - "nobody <= only": { - superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + // unspecified + "nobody !< unspecified": { + superSet: AccessConfig{Permission: AccessTypeUnspecified}, check: AccessConfig{Permission: AccessTypeNobody}, - isSubSet: true, + isSubSet: false, }, - "only <= only(same)": { - superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, - check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, - isSubSet: true, + "only !< unspecified": { + superSet: AccessConfig{Permission: AccessTypeUnspecified}, + check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "foobar"}, + isSubSet: false, }, - "only > only(other)": { - superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, - check: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "other"}, + "anyOf !< unspecified": { + superSet: AccessConfig{Permission: AccessTypeUnspecified}, + check: AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: []string{"foobar"}}, isSubSet: false, }, - "everybody > only": { - superSet: AccessConfig{Permission: AccessTypeOnlyAddress, Address: "owner"}, + "everybody !< unspecified": { + superSet: AccessConfig{Permission: AccessTypeUnspecified}, check: AccessConfig{Permission: AccessTypeEverybody}, isSubSet: false, }, - "nobody > unspecified": { + "unspecified !< unspecified ": { superSet: AccessConfig{Permission: AccessTypeUnspecified}, - check: AccessConfig{Permission: AccessTypeNobody}, + check: AccessConfig{Permission: AccessTypeUnspecified}, isSubSet: false, }, } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + subset := spec.check.IsSubset(spec.superSet) + require.Equal(t, spec.isSubSet, subset) + }) + } +} +func TestAccessTypeSubset(t *testing.T) { + specs := map[string]struct { + check AccessType + superSet AccessType + isSubSet bool + }{ + // nobody + "nobody <= nobody": { + superSet: AccessTypeNobody, + check: AccessTypeNobody, + isSubSet: true, + }, + "only !< nobody": { + superSet: AccessTypeNobody, + check: AccessTypeOnlyAddress, + isSubSet: false, + }, + "any !< nobody": { + superSet: AccessTypeNobody, + check: AccessTypeAnyOfAddresses, + isSubSet: false, + }, + "everybody !< nobody": { + superSet: AccessTypeNobody, + check: AccessTypeEverybody, + isSubSet: false, + }, + "unspecified !< nobody": { + superSet: AccessTypeNobody, + check: AccessTypeUnspecified, + isSubSet: false, + }, + // only + "nobody < only": { + superSet: AccessTypeOnlyAddress, + check: AccessTypeNobody, + isSubSet: true, + }, + "only <= only": { + superSet: AccessTypeOnlyAddress, + check: AccessTypeOnlyAddress, + isSubSet: true, + }, + "anyOf !< only": { + superSet: AccessTypeOnlyAddress, + check: AccessTypeAnyOfAddresses, + isSubSet: true, + }, + "everybody !< only": { + superSet: AccessTypeOnlyAddress, + check: AccessTypeEverybody, + isSubSet: false, + }, + "unspecified !< only": { + superSet: AccessTypeOnlyAddress, + check: AccessTypeUnspecified, + isSubSet: false, + }, + // any of + "nobody < anyOf": { + superSet: AccessTypeAnyOfAddresses, + check: AccessTypeNobody, + isSubSet: true, + }, + "only <= anyOf": { + superSet: AccessTypeAnyOfAddresses, + check: AccessTypeOnlyAddress, + isSubSet: true, + }, + "anyOf <= anyOf": { + superSet: AccessTypeAnyOfAddresses, + check: AccessTypeAnyOfAddresses, + isSubSet: true, + }, + "everybody !< anyOf": { + superSet: AccessTypeAnyOfAddresses, + check: AccessTypeEverybody, + isSubSet: false, + }, + "unspecified !< anyOf": { + superSet: AccessTypeAnyOfAddresses, + check: AccessTypeUnspecified, + isSubSet: false, + }, + // everybody + "nobody < everybody": { + superSet: AccessTypeEverybody, + check: AccessTypeNobody, + isSubSet: true, + }, + "only < everybody": { + superSet: AccessTypeEverybody, + check: AccessTypeOnlyAddress, + isSubSet: true, + }, + "anyOf < everybody": { + superSet: AccessTypeEverybody, + check: AccessTypeAnyOfAddresses, + isSubSet: true, + }, + "everybody <= everybody": { + superSet: AccessTypeEverybody, + check: AccessTypeEverybody, + isSubSet: true, + }, + "unspecified !< everybody": { + superSet: AccessTypeEverybody, + check: AccessTypeUnspecified, + isSubSet: false, + }, + // unspecified + "nobody !< unspecified": { + superSet: AccessTypeUnspecified, + check: AccessTypeNobody, + isSubSet: false, + }, + "only !< unspecified": { + superSet: AccessTypeUnspecified, + check: AccessTypeOnlyAddress, + isSubSet: false, + }, + "anyOf !< unspecified": { + superSet: AccessTypeUnspecified, + check: AccessTypeAnyOfAddresses, + isSubSet: false, + }, + "everybody !< unspecified": { + superSet: AccessTypeUnspecified, + check: AccessTypeEverybody, + isSubSet: false, + }, + "unspecified !< unspecified": { + superSet: AccessTypeUnspecified, + check: AccessTypeUnspecified, + isSubSet: false, + }, + } for name, spec := range specs { t.Run(name, func(t *testing.T) { subset := spec.check.IsSubset(spec.superSet) diff --git a/x/wasm/types/validation.go b/x/wasm/types/validation.go index 4984fa28d..908c52552 100644 --- a/x/wasm/types/validation.go +++ b/x/wasm/types/validation.go @@ -4,8 +4,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// MaxSaltSize is the longest salt that can be used when instantiating a contract +const MaxSaltSize = 64 + var ( - // MaxLabelSize is the longest label that can be used when Instantiating a contract + // MaxLabelSize is the longest label that can be used when instantiating a contract MaxLabelSize = 128 // extension point for chains to customize via compile flag. // MaxWasmSize is the largest a compiled contract code can be when storing code on chain @@ -22,12 +25,24 @@ func validateWasmCode(s []byte) error { return nil } -func validateLabel(label string) error { +// ValidateLabel ensure label constraints +func ValidateLabel(label string) error { if label == "" { return sdkerrors.Wrap(ErrEmpty, "is required") } if len(label) > MaxLabelSize { - return sdkerrors.Wrap(ErrLimit, "cannot be longer than 128 characters") + return ErrLimit.Wrapf("cannot be longer than %d characters", MaxLabelSize) + } + return nil +} + +// ValidateSalt ensure salt constraints +func ValidateSalt(salt []byte) error { + switch n := len(salt); { + case n == 0: + return sdkerrors.Wrap(ErrEmpty, "is required") + case n > MaxSaltSize: + return ErrLimit.Wrapf("cannot be longer than %d characters", MaxSaltSize) } return nil }