From fa949b1509726ef7f0154bc68f3a711d69f6644e Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Sat, 30 Mar 2024 09:00:27 +0700 Subject: [PATCH] feat: bump 08-wasmd --- modules/light-clients/08-wasm/Dockerfile | 38 + .../light-clients/08-wasm/client/cli/cli.go | 2 +- .../light-clients/08-wasm/client/cli/query.go | 9 +- .../light-clients/08-wasm/client/cli/tx.go | 4 +- modules/light-clients/08-wasm/doc.go | 8 + modules/light-clients/08-wasm/go.mod | 197 ++ modules/light-clients/08-wasm/go.sum | 1716 +++++++++++++++++ .../internal/ibcwasm/expected_interfaces.go | 131 ++ .../08-wasm/internal/ibcwasm/wasm.go | 57 + .../08-wasm/keeper/grpc_query.go | 2 +- .../light-clients/08-wasm/keeper/keeper.go | 181 +- .../08-wasm/keeper/msg_server.go | 34 +- .../08-wasm/keeper/snapshotter.go | 44 +- modules/light-clients/08-wasm/keeper/utils.go | 2 +- modules/light-clients/08-wasm/module.go | 43 +- .../08-wasm/simulation/proposals.go | 40 + .../08-wasm/simulation/proposals_test.go | 41 + .../08-wasm/testing/mock/mock.go | 27 + .../08-wasm/testing/mock_engine.go | 289 +++ .../08-wasm/testing/simapp/README.md | 5 + .../08-wasm/testing/simapp/ante_handler.go | 50 + .../08-wasm/testing/simapp/app.go | 1125 +++++++++++ .../08-wasm/testing/simapp/encoding.go | 18 + .../08-wasm/testing/simapp/export.go | 249 +++ .../08-wasm/testing/simapp/genesis.go | 14 + .../08-wasm/testing/simapp/genesis_account.go | 47 + .../08-wasm/testing/simapp/params/amino.go | 27 + .../08-wasm/testing/simapp/params/doc.go | 19 + .../08-wasm/testing/simapp/params/encoding.go | 16 + .../08-wasm/testing/simapp/params/proto.go | 27 + .../08-wasm/testing/simapp/simd/cmd/root.go | 428 ++++ .../08-wasm/testing/simapp/simd/main.go | 20 + .../08-wasm/testing/simapp/test_helpers.go | 113 ++ .../08-wasm/testing/simapp/upgrades.go | 45 + .../light-clients/08-wasm/testing/values.go | 59 + .../08-wasm/testing/wasm_endpoint.go | 61 + .../08-wasm/types/client_state.go | 68 +- .../08-wasm/types/client_state_test.go | 1358 ++++--------- modules/light-clients/08-wasm/types/codec.go | 11 +- modules/light-clients/08-wasm/types/config.go | 42 + .../08-wasm/types/consensus_state.go | 26 +- .../08-wasm/types/consensus_state_test.go | 50 +- .../08-wasm/types/contract_api.go | 129 ++ modules/light-clients/08-wasm/types/errors.go | 44 +- modules/light-clients/08-wasm/types/events.go | 11 + .../08-wasm/types/gas_register.go | 49 +- .../light-clients/08-wasm/types/genesis.go | 18 +- .../08-wasm/types/genesis_test.go | 202 +- modules/light-clients/08-wasm/types/header.go | 4 +- .../08-wasm/types/header_test.go | 54 - modules/light-clients/08-wasm/types/keys.go | 2 + .../08-wasm/types/misbehaviour.go | 4 +- .../08-wasm/types/misbehaviour_handle.go | 5 +- .../08-wasm/types/misbehaviour_handle_test.go | 868 +-------- .../08-wasm/types/misbehaviour_test.go | 47 - modules/light-clients/08-wasm/types/msgs.go | 52 +- .../08-wasm/types/proposal_handle.go | 9 +- .../08-wasm/types/proposal_handle_test.go | 350 +--- .../light-clients/08-wasm/types/querier.go | 178 ++ modules/light-clients/08-wasm/types/store.go | 95 +- .../light-clients/08-wasm/types/types_test.go | 363 +--- modules/light-clients/08-wasm/types/update.go | 11 +- .../08-wasm/types/update_test.go | 1029 ++-------- .../light-clients/08-wasm/types/upgrade.go | 15 +- .../08-wasm/types/upgrade_test.go | 764 ++------ .../light-clients/08-wasm/types/validation.go | 23 +- modules/light-clients/08-wasm/types/vm.go | 46 +- .../light-clients/08-wasm/types/wasm.pb.go | 2 +- 68 files changed, 6828 insertions(+), 4289 deletions(-) create mode 100644 modules/light-clients/08-wasm/Dockerfile create mode 100644 modules/light-clients/08-wasm/doc.go create mode 100644 modules/light-clients/08-wasm/go.mod create mode 100644 modules/light-clients/08-wasm/go.sum create mode 100644 modules/light-clients/08-wasm/internal/ibcwasm/expected_interfaces.go create mode 100644 modules/light-clients/08-wasm/internal/ibcwasm/wasm.go create mode 100644 modules/light-clients/08-wasm/simulation/proposals.go create mode 100644 modules/light-clients/08-wasm/simulation/proposals_test.go create mode 100644 modules/light-clients/08-wasm/testing/mock/mock.go create mode 100644 modules/light-clients/08-wasm/testing/mock_engine.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/README.md create mode 100644 modules/light-clients/08-wasm/testing/simapp/ante_handler.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/app.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/encoding.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/export.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/genesis.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/genesis_account.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/params/amino.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/params/doc.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/params/encoding.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/params/proto.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/simd/main.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/test_helpers.go create mode 100644 modules/light-clients/08-wasm/testing/simapp/upgrades.go create mode 100644 modules/light-clients/08-wasm/testing/values.go create mode 100644 modules/light-clients/08-wasm/testing/wasm_endpoint.go create mode 100644 modules/light-clients/08-wasm/types/config.go create mode 100644 modules/light-clients/08-wasm/types/contract_api.go create mode 100644 modules/light-clients/08-wasm/types/events.go delete mode 100644 modules/light-clients/08-wasm/types/header_test.go delete mode 100644 modules/light-clients/08-wasm/types/misbehaviour_test.go create mode 100644 modules/light-clients/08-wasm/types/querier.go diff --git a/modules/light-clients/08-wasm/Dockerfile b/modules/light-clients/08-wasm/Dockerfile new file mode 100644 index 00000000000..b32b7242bc8 --- /dev/null +++ b/modules/light-clients/08-wasm/Dockerfile @@ -0,0 +1,38 @@ +FROM golang:1.21-alpine3.18 as builder + +ARG LIBWASM_VERSION +ARG LIBWASM_CHECKSUM + +RUN test -n "${LIBWASM_VERSION}" +RUN test -n "${LIBWASM_CHECKSUM}" + +RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make; + +ENV GOPATH="" + +# Grab the static library and copy it to location that will be found by the linker flag `-lwasmvm_muslc`. +ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a +RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ${LIBWASM_CHECKSUM} +RUN cp /lib/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a + +# Copy relevant files before go mod download. Replace directives to local paths break if local +# files are not copied before go mod download. +ADD internal internal +ADD testing testing +ADD modules modules +ADD LICENSE LICENSE + +COPY go.mod . +COPY go.sum . + +WORKDIR /go/modules/light-clients/08-wasm + +RUN go mod download + +RUN GOOS=linux GOARCH=amd64 go build -mod=readonly -tags "netgo ledger muslc" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=sim -X github.com/cosmos/cosmos-sdk/version.AppName=simd -X github.com/cosmos/cosmos-sdk/version.Version= -X github.com/cosmos/cosmos-sdk/version.Commit= -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger muslc," -w -s -linkmode=external -extldflags "-Wl,-z,muldefs -static"' -trimpath -o /go/build/ ./... + +FROM alpine:3.18 + +COPY --from=builder /go/build/simd /bin/simd + +ENTRYPOINT ["simd"] diff --git a/modules/light-clients/08-wasm/client/cli/cli.go b/modules/light-clients/08-wasm/client/cli/cli.go index 11d03d7dfb0..89fedb12520 100644 --- a/modules/light-clients/08-wasm/client/cli/cli.go +++ b/modules/light-clients/08-wasm/client/cli/cli.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" - types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) // GetQueryCmd returns the query commands for IBC channels diff --git a/modules/light-clients/08-wasm/client/cli/query.go b/modules/light-clients/08-wasm/client/cli/query.go index 729fe555af5..95e8db103f2 100644 --- a/modules/light-clients/08-wasm/client/cli/query.go +++ b/modules/light-clients/08-wasm/client/cli/query.go @@ -3,12 +3,11 @@ package cli import ( "context" "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/spf13/cobra" ) @@ -19,7 +18,7 @@ func getCmdCode() *cobra.Command { Short: "Query wasm code", Long: "Query wasm code", Example: fmt.Sprintf( - "%s query %s %s code [code-id]", version.AppName, host.SubModuleName, types.ModuleName, + "%s query %s code [code-id]", version.AppName, ibcexported.ModuleName, ), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -55,7 +54,7 @@ func getAllWasmCode() *cobra.Command { Short: "Query all wasm code", Long: "Query all wasm code", Example: fmt.Sprintf( - "%s query %s all-wasm-code", version.AppName, types.ModuleName, + "%s query %s all-wasm-code", version.AppName, ibcexported.ModuleName, ), Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/modules/light-clients/08-wasm/client/cli/tx.go b/modules/light-clients/08-wasm/client/cli/tx.go index bc352d94b30..dc73633a756 100644 --- a/modules/light-clients/08-wasm/client/cli/tx.go +++ b/modules/light-clients/08-wasm/client/cli/tx.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/spf13/cobra" ) diff --git a/modules/light-clients/08-wasm/doc.go b/modules/light-clients/08-wasm/doc.go new file mode 100644 index 00000000000..1c4484759b5 --- /dev/null +++ b/modules/light-clients/08-wasm/doc.go @@ -0,0 +1,8 @@ +/* +Package wasm implements a concrete ClientState, ConsensusState, +ClientMessage and types for the proxy light client module communicating +with underlying Wasm light clients. +This implementation is based off the ICS 08 specification +(https://github.com/cosmos/ibc/blob/main/spec/client/ics-008-wasm-client) +*/ +package wasm diff --git a/modules/light-clients/08-wasm/go.mod b/modules/light-clients/08-wasm/go.mod new file mode 100644 index 00000000000..a6345da4d09 --- /dev/null +++ b/modules/light-clients/08-wasm/go.mod @@ -0,0 +1,197 @@ +module github.com/cosmos/ibc-go/modules/light-clients/08-wasm + +go 1.21 + +replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + +require ( + cosmossdk.io/api v0.7.2 + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/collections v0.4.0 + cosmossdk.io/core v0.11.0 + cosmossdk.io/errors v1.0.0 + cosmossdk.io/log v1.2.1 + cosmossdk.io/math v1.2.0 + cosmossdk.io/store v1.0.0 + cosmossdk.io/tools/confix v0.1.0 + cosmossdk.io/x/circuit v0.1.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/tx v0.12.0 + cosmossdk.io/x/upgrade v0.1.0 + github.com/CosmWasm/wasmvm v1.5.0 + github.com/cometbft/cometbft v0.38.0 + github.com/cosmos/cosmos-db v1.0.0 + github.com/cosmos/cosmos-sdk v0.50.1 + github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/golang/protobuf v1.5.3 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/spf13/cast v1.5.1 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.17.0 + github.com/stretchr/testify v1.8.4 + google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a + google.golang.org/grpc v1.59.0 +) + +require ( + cloud.google.com/go v0.110.8 // indirect + cloud.google.com/go/compute v1.23.1 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.3 // indirect + cloud.google.com/go/storage v1.30.1 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + filippo.io/edwards25519 v1.0.0 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/aws/aws-sdk-go v1.44.224 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect + github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/chzyer/readline v1.5.1 // indirect + github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/creachadair/atomicfile v0.3.1 // indirect + github.com/creachadair/tomledit v0.0.24 // indirect + github.com/danieljoos/wincred v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect + github.com/dgraph-io/badger/v2 v2.2007.4 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/emicklei/dot v1.6.0 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/getsentry/sentry-go v0.25.0 // indirect + github.com/go-kit/kit v0.12.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.1.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/orderedcode v0.0.1 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-getter v1.7.1 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.2 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect + github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/huandu/skiplist v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/klauspost/compress v1.17.2 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/lib/pq v1.10.7 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/linxGnu/grocksdb v1.8.4 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/manifoldco/promptui v0.9.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + github.com/minio/highwayhash v1.0.2 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mtibben/percent v0.2.1 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rs/cors v1.8.3 // indirect + github.com/rs/zerolog v1.31.0 // indirect + github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.10.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + github.com/tendermint/go-amino v0.16.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.3.7 // indirect + go.opencensus.io v0.24.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/api v0.143.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect + nhooyr.io/websocket v1.8.6 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/modules/light-clients/08-wasm/go.sum b/modules/light-clients/08-wasm/go.sum new file mode 100644 index 00000000000..2a2960f760d --- /dev/null +++ b/modules/light-clients/08-wasm/go.sum @@ -0,0 +1,1716 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +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.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= +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/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= +cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= +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/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= +cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v1.1.3 h1:18tKG7DzydKWUnLjonWcJO6wjSCAtzh4GcRKlH/Hrzc= +cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= +cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= +cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= +cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= +cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= +cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/store v1.0.0 h1:6tnPgTpTSIskaTmw/4s5C9FARdgFflycIc9OX8i1tOI= +cosmossdk.io/store v1.0.0/go.mod h1:ABMprwjvx6IpMp8l06TwuMrj6694/QP5NIW+X6jaTYc= +cosmossdk.io/tools/confix v0.1.0 h1:2OOZTtQsDT5e7P3FM5xqM0bPfluAxZlAwxqaDmYBE+E= +cosmossdk.io/tools/confix v0.1.0/go.mod h1:TdXKVYs4gEayav5wM+JHT+kTU2J7fozFNqoVaN+8CdY= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= +cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= +cosmossdk.io/x/upgrade v0.1.0 h1:z1ZZG4UL9ICTNbJDYZ6jOnF9GdEK9wyoEFi4BUScHXE= +cosmossdk.io/x/upgrade v0.1.0/go.mod h1:/6jjNGbiPCNtmA1N+rBtP601sr0g4ZXuj3yC6ClPCGY= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= +filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= +github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CosmWasm/wasmvm v1.5.0 h1:3hKeT9SfwfLhxTGKH3vXaKFzBz1yuvP8SlfwfQXbQfw= +github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +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/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= +github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= +github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +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/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +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/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-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +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/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +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/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-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-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= +github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb h1:6Po+YYKT5B5ZXN0wd2rwFBaebM0LufPf8p4zxOd48Kg= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb/go.mod h1:acMRUGd/BK8AUmQNK3spUCCGzFLZU2bSST3NMXSq2Kc= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/cometbft/cometbft v0.38.0 h1:ogKnpiPX7gxCvqTEF4ly25/wAxUqf181t30P3vqdpdc= +github.com/cometbft/cometbft v0.38.0/go.mod h1:5Jz0Z8YsHSf0ZaAqGvi/ifioSdVFPtEGrm8Y9T/993k= +github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= +github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= +github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-sdk v0.50.1 h1:2SYwAYqd7ZwtrWxu/J8PwbQV/cDcu90bCr/a78g3lVw= +github.com/cosmos/cosmos-sdk v0.50.1/go.mod h1:fsLSPGstCwn6MMsFDMAQWGJj8E4sYsN9Gnu1bGE5imA= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= +github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= +github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= +github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= +github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= +github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= +github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= +github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= +github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= +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.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= +github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= +github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.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/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= +github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= +github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +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.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +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.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +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.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/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.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/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= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +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/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= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/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/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= +github.com/googleapis/enterprise-certificate-proxy v0.3.1 h1:SBWmZhjUDRorQxrN0nwzf+AHBxnbFjViHQS4P0yVpmQ= +github.com/googleapis/enterprise-certificate-proxy v0.3.1/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +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/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= +github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.2 h1:ErEYO2f//CjKsUDw4SmLzelsK6L3ZmOAR/4P9iS7ruY= +github.com/hashicorp/go-metrics v0.5.2/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +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/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= +github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= +github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= +github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +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= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +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/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +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.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +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/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +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.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/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/linxGnu/grocksdb v1.8.4 h1:ZMsBpPpJNtRLHiKKp0mI7gW+NT4s7UgfD5xHxx1jVRo= +github.com/linxGnu/grocksdb v1.8.4/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 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/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +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/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= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +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/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= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= +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/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +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/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= +github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +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/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +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.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +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.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= +github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= +github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +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.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.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/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.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= +github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/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= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/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/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +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= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +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-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/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-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-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/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +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= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/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-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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-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-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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-20220503163025-988cb79eb6c6/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-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +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= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +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.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/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.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= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +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.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +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.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.143.0 h1:o8cekTkqhywkbZT6p1UHJPZ9+9uuCAJs/KYomxZB8fA= +google.golang.org/api v0.143.0/go.mod h1:FoX9DO9hT7DLNn97OuoZAGSDuNAXdJRuGK98rSUgurk= +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= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +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-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/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-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= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +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-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +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-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b h1:+YaDE2r2OG8t/z5qmsh7Y+XXwCbvadxxZ0YY6mTdrVA= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= +google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a h1:myvhA4is3vrit1a6NZCWBIwN0kNEnX21DJOJX/NvIfI= +google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:SUBoKXbI1Efip18FClrQVGjWcyd0QZd8KkvdP34t7ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.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.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +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= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +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.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/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +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-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.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/modules/light-clients/08-wasm/internal/ibcwasm/expected_interfaces.go b/modules/light-clients/08-wasm/internal/ibcwasm/expected_interfaces.go new file mode 100644 index 00000000000..964b3b1469e --- /dev/null +++ b/modules/light-clients/08-wasm/internal/ibcwasm/expected_interfaces.go @@ -0,0 +1,131 @@ +package ibcwasm + +import ( + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ WasmEngine = (*wasmvm.VM)(nil) + +type WasmEngine interface { + // StoreCode will compile the wasm code, and store the resulting pre-compile + // as well as the original code. Both can be referenced later via checksum + // This must be done one time for given code, after which it can be + // instantiated many times, and each instance called many times. + // It does the same as StoreCodeUnchecked plus the static checks. + StoreCode(code wasmvm.WasmCode) (wasmvm.Checksum, error) + + // StoreCodeUnchecked will compile the wasm code, and store the resulting pre-compile + // as well as the original code. Both can be referenced later via checksum + // This must be done one time for given code, after which it can be + // instantiated many times, and each instance called many times. + // It does the same as StoreCode but without the static checks. + // This allows restoring previous contract code in genesis and state-sync that may have been initially stored under different configuration constraints. + StoreCodeUnchecked(code wasmvm.WasmCode) (wasmvm.Checksum, error) + + // Instantiate will create a new contract based on the given checksum. + // We can set the initMsg (contract "genesis") here, and it then receives + // an account and address and can be invoked (Execute) many times. + // + // Storage should be set with a PrefixedKVStore that this code can safely access. + // + // Under the hood, we may recompile the wasm, use a cached native compile, or even use a cached instance + // for performance. + Instantiate( + checksum 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) + + // Query allows a client to execute a contract-specific query. If the result is not empty, it should be + // valid json-encoded data to return to the client. + // The meaning of path and data can be determined by the code. Path is the suffix of the abci.QueryRequest.Path + Query( + checksum wasmvm.Checksum, + env wasmvmtypes.Env, + queryMsg []byte, + store wasmvm.KVStore, + goapi wasmvm.GoAPI, + querier wasmvm.Querier, + gasMeter wasmvm.GasMeter, + gasLimit uint64, + deserCost wasmvmtypes.UFraction, + ) ([]byte, uint64, error) + + // Migrate migrates an existing contract to a new code binary. + // This takes storage of the data from the original contract and the checksum of the new contract that should + // replace it. This allows it to run a migration step if needed, or return an error if unable to migrate + // the given data. + // + // MigrateMsg has some data on how to perform the migration. + Migrate( + checksum wasmvm.Checksum, + env wasmvmtypes.Env, + migrateMsg []byte, + store wasmvm.KVStore, + goapi wasmvm.GoAPI, + querier wasmvm.Querier, + gasMeter wasmvm.GasMeter, + gasLimit uint64, + deserCost wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) + + // Sudo allows native Go modules to make priviledged (sudo) calls on the contract. + // The contract can expose entry points that cannot be triggered by any transaction, but only via + // native Go modules, and delegate the access control to the system. + // + // These work much like Migrate (same scenario) but allows custom apps to extend the priviledged entry points + // without forking cosmwasm-vm. + Sudo( + checksum wasmvm.Checksum, + env wasmvmtypes.Env, + sudoMsg []byte, + store wasmvm.KVStore, + goapi wasmvm.GoAPI, + querier wasmvm.Querier, + gasMeter wasmvm.GasMeter, + gasLimit uint64, + deserCost wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) + + // GetCode will load the original wasm code for the given checksum. + // This will only succeed if that checksum was previously returned from + // a call to Create. + // + // This can be used so that the (short) checksum is stored in the iavl tree + // and the larger binary blobs (wasm and pre-compiles) are all managed by the + // rust library + GetCode(checksum wasmvm.Checksum) (wasmvm.WasmCode, error) + + // Pin pins a code to an in-memory cache, such that is + // always loaded quickly when executed. + // Pin is idempotent. + Pin(checksum wasmvm.Checksum) error + + // Unpin removes the guarantee of a contract to be pinned (see Pin). + // After calling this, the code may or may not remain in memory depending on + // the implementor's choice. + // Unpin is idempotent. + Unpin(checksum wasmvm.Checksum) error +} + +type QueryRouter interface { + // Route returns the GRPCQueryHandler for a given query route path or nil + // if not found + Route(path string) baseapp.GRPCQueryHandler +} + +type QueryPluginsI interface { + // HandleQuery will route the query to the correct plugin and return the result + HandleQuery(ctx sdk.Context, caller string, request wasmvmtypes.QueryRequest) ([]byte, error) +} diff --git a/modules/light-clients/08-wasm/internal/ibcwasm/wasm.go b/modules/light-clients/08-wasm/internal/ibcwasm/wasm.go new file mode 100644 index 00000000000..3f4121aac35 --- /dev/null +++ b/modules/light-clients/08-wasm/internal/ibcwasm/wasm.go @@ -0,0 +1,57 @@ +package ibcwasm + +import ( + "cosmossdk.io/collections" + storetypes "cosmossdk.io/core/store" + "errors" +) + +var ( + // state management + Checksums collections.KeySet[[]byte] + Schema collections.Schema + ChecksumsKey = collections.NewPrefix(0) + queryPlugins QueryPluginsI + queryRouter QueryRouter +) + +// SetupWasmStoreService sets up the 08-wasm module's collections. +func SetupWasmStoreService(storeService storetypes.KVStoreService) { + sb := collections.NewSchemaBuilder(storeService) + + Checksums = collections.NewKeySet(sb, ChecksumsKey, "checksums", collections.BytesKey) + + schema, err := sb.Build() + if err != nil { + panic(err) + } + + Schema = schema +} + +// SetQueryRouter sets the custom wasm query router for the 08-wasm module. +// Panics if the queryRouter is nil. +func SetQueryRouter(router QueryRouter) { + if router == nil { + panic(errors.New("query router must be not nil")) + } + queryRouter = router +} + +// GetQueryRouter returns the custom wasm query router for the 08-wasm module. +func GetQueryRouter() QueryRouter { + return queryRouter +} + +// SetQueryPlugins sets the current query plugins +func SetQueryPlugins(plugins QueryPluginsI) { + if plugins == nil { + panic(errors.New("query plugins must be not nil")) + } + queryPlugins = plugins +} + +// GetQueryPlugins returns the current query plugins +func GetQueryPlugins() QueryPluginsI { + return queryPlugins +} diff --git a/modules/light-clients/08-wasm/keeper/grpc_query.go b/modules/light-clients/08-wasm/keeper/grpc_query.go index a1ada0b5b92..169bc8e0aae 100644 --- a/modules/light-clients/08-wasm/keeper/grpc_query.go +++ b/modules/light-clients/08-wasm/keeper/grpc_query.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) var _ types.QueryServer = Keeper{} diff --git a/modules/light-clients/08-wasm/keeper/keeper.go b/modules/light-clients/08-wasm/keeper/keeper.go index 17b0e5869f3..ff97acffdb9 100644 --- a/modules/light-clients/08-wasm/keeper/keeper.go +++ b/modules/light-clients/08-wasm/keeper/keeper.go @@ -3,10 +3,11 @@ package keeper import ( "bytes" "context" + "cosmossdk.io/collections" "crypto/sha256" "encoding/hex" - "fmt" - clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper" "math" "path/filepath" "strings" @@ -14,26 +15,28 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + storetypes "cosmossdk.io/core/store" + errorsmod "cosmossdk.io/errors" cosmwasm "github.com/CosmWasm/wasmvm" "github.com/cosmos/cosmos-sdk/codec" - "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" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) type Keeper struct { - storeKey storetypes.StoreKey + storeKey storetypes.KVStoreService cdc codec.BinaryCodec - wasmVM *cosmwasm.VM + wasmVM ibcwasm.WasmEngine authority string clientKeeper *clientkeeper.Keeper } -func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, authority string, homeDir string, clientKeeper *clientkeeper.Keeper) Keeper { +func NewKeeper(cdc codec.BinaryCodec, + key storetypes.KVStoreService, authority string, + homeDir string, clientKeeper *clientkeeper.Keeper, queryRouter ibcwasm.QueryRouter, +) Keeper { // Wasm VM wasmDataDir := filepath.Join(homeDir, "wasm_client_data") wasmSupportedFeatures := strings.Join([]string{"storage", "iterator"}, ",") @@ -46,6 +49,9 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, authority string, panic(err) } types.WasmVM = vm + ibcwasm.SetQueryPlugins(types.NewDefaultQueryPlugins()) + ibcwasm.SetQueryRouter(queryRouter) + ibcwasm.SetupWasmStoreService(key) // governance authority @@ -58,37 +64,54 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, authority string, } } -func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) { - store := ctx.KVStore(k.storeKey) +func NewKeeperWithVm(cdc codec.BinaryCodec, + key storetypes.KVStoreService, authority string, + homeDir string, clientKeeper *clientkeeper.Keeper, queryRouter ibcwasm.QueryRouter, + vm ibcwasm.WasmEngine, +) Keeper { + types.WasmVM = vm + ibcwasm.SetQueryPlugins(types.NewDefaultQueryPlugins()) + ibcwasm.SetQueryRouter(queryRouter) + ibcwasm.SetupWasmStoreService(key) + + // governance authority + return Keeper{ + cdc: cdc, + storeKey: key, + wasmVM: vm, + authority: authority, + clientKeeper: clientKeeper, + } +} + +func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte, storeFn func(code cosmwasm.WasmCode) (cosmwasm.Checksum, error)) ([]byte, error) { var err error if IsGzip(code) { ctx.GasMeter().ConsumeGas(types.VMGasRegister.UncompressCosts(len(code)), "Uncompress gzip bytecode") code, err = Uncompress(code, uint64(types.MaxWasmSize)) if err != nil { - return nil, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) + return nil, errorsmod.Wrap(types.ErrCreateFailed, err.Error()) } } // Check to see if the store has a code with the same code it codeHash := generateWasmCodeHash(code) codeIDKey := types.CodeID(codeHash) - if store.Has(codeIDKey) { + if types.HasChecksum(ctx, codeIDKey) { return nil, types.ErrWasmCodeExists } // run the code through the wasm light client validation process - if isValidWasmCode, err := types.ValidateWasmCode(code); err != nil { - return nil, sdkerrors.Wrapf(types.ErrWasmCodeValidation, "unable to validate wasm code: %s", err) - } else if !isValidWasmCode { - return nil, types.ErrWasmInvalidCode + if err := types.ValidateWasmCode(code); err != nil { + return nil, errorsmod.Wrap(err, "wasm bytecode validation failed") } // create the code in the vm ctx.GasMeter().ConsumeGas(types.VMGasRegister.CompileCosts(len(code)), "Compiling wasm bytecode") - codeID, err := types.WasmVM.Create(code) + codeID, err := storeFn(code) if err != nil { - return nil, sdkerrors.Wrapf(types.ErrWasmInvalidCode, "unable to compile wasm code: %s", err) + return nil, errorsmod.Wrapf(types.ErrWasmInvalidCode, "unable to compile wasm code: %s", err) } // safety check to assert that code id returned by WasmVM equals to code hash @@ -96,29 +119,14 @@ func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) { return nil, types.ErrWasmInvalidCodeID } - store.Set(codeIDKey, code) - return codeID, nil -} - -func (k Keeper) importWasmCode(ctx sdk.Context, codeHash, wasmCode []byte) error { - store := ctx.KVStore(k.storeKey) - if IsGzip(wasmCode) { - var err error - wasmCode, err = Uncompress(wasmCode, uint64(types.MaxWasmSize)) - if err != nil { - return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) - } - } - newCodeHash, err := k.wasmVM.Create(wasmCode) - if err != nil { - return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) - } - if !bytes.Equal(codeHash, types.CodeID(newCodeHash)) { - return sdkerrors.Wrap(types.ErrInvalid, "code hashes not same") + // pin the code to the vm in-memory cache + if err := types.WasmVM.Pin(codeID); err != nil { + return nil, errorsmod.Wrapf(err, "failed to pin contract with checksum (%s) to vm cache", hex.EncodeToString(codeID)) } - store.Set(codeHash, wasmCode) - return nil + err = ibcwasm.Checksums.Set(ctx, codeHash) + + return codeID, nil } func generateWasmCodeHash(code []byte) []byte { @@ -132,19 +140,22 @@ func (k Keeper) getWasmCode(c context.Context, query *types.WasmCodeQuery) (*typ } ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(k.storeKey) - codeID, err := hex.DecodeString(query.CodeId) if err != nil { return nil, status.Error(codes.InvalidArgument, "invalid code id") } + // Only return checksums we previously stored, not arbitrary checksums that might be stored via e.g Wasmd. + if !types.HasChecksum(ctx, codeID) { + return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrWasmChecksumNotFound, query.CodeId).Error()) + } + codeKey := types.CodeID(codeID) - code := store.Get(codeKey) - if code == nil { + code, err := types.WasmVM.GetCode(codeKey) + if err != nil { return nil, status.Error( codes.NotFound, - sdkerrors.Wrap(types.ErrWasmCodeIDNotFound, query.CodeId).Error(), + errorsmod.Wrap(types.ErrWasmCodeIDNotFound, query.CodeId).Error(), ) } @@ -154,35 +165,26 @@ func (k Keeper) getWasmCode(c context.Context, query *types.WasmCodeQuery) (*typ } func (k Keeper) getAllWasmCodeID(c context.Context, query *types.AllWasmCodeIDQuery) (*types.AllWasmCodeIDResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var allCode []string - - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.PrefixCodeIDKey) - - iter := prefixStore.Iterator(nil, nil) - defer iter.Close() - - pageRes, err := sdkquery.FilteredPaginate(prefixStore, query.Pagination, func(key []byte, _ []byte, accumulate bool) (bool, error) { - if accumulate { - allCode = append(allCode, string(key)) - } - return true, nil - }) + checksums, pageRes, err := sdkquery.CollectionPaginate( + c, + ibcwasm.Checksums, + query.Pagination, + func(key []byte, value collections.NoValue) (string, error) { + return hex.EncodeToString(key), nil + }) if err != nil { return nil, err } return &types.AllWasmCodeIDResponse{ - CodeIds: allCode, + CodeIds: checksums, Pagination: pageRes, }, nil } func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) error { for _, contract := range gs.Contracts { - err := k.importWasmCode(ctx, contract.CodeHash, contract.ContractCode) + _, err := k.storeWasmCode(ctx, contract.ContractCode, types.WasmVM.StoreCodeUnchecked) if err != nil { return err } @@ -191,45 +193,38 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) error { } func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.PrefixCodeIDKey) - defer iterator.Close() + checksums, err := types.GetAllChecksums(ctx) + if err != nil { + panic(err) + } + // Grab code from wasmVM and add to genesis state. var genesisState types.GenesisState - for ; iterator.Valid(); iterator.Next() { + for _, checksum := range checksums { + code, err := types.WasmVM.GetCode(checksum) + if err != nil { + panic(err) + } genesisState.Contracts = append(genesisState.Contracts, types.GenesisContract{ - CodeHash: iterator.Key(), - ContractCode: iterator.Value(), + CodeHash: checksum, + ContractCode: code, }) } - return genesisState -} - -// TODO: testing -func (k Keeper) IterateCodeInfos(ctx sdk.Context, fn func(codeID string) (stop bool)) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(fmt.Sprintf("%s/", types.PrefixCodeIDKey))) - iter := prefixStore.Iterator(nil, nil) - defer iter.Close() - - for ; iter.Valid(); iter.Next() { - if fn(string(iter.Value())) { - break - } - } + return genesisState } -// TODO: testing -func (k Keeper) GetWasmByte(ctx sdk.Context, codeID string) ([]byte, error) { - store := ctx.KVStore(k.storeKey) - - byteCodeID, err := hex.DecodeString(codeID) +// InitializePinnedCodes updates wasmvm to pin to cache all contracts marked as pinned +func InitializePinnedCodes(ctx sdk.Context) error { + checksums, err := types.GetAllChecksums(ctx) if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid code ID") + return err } - codeKey := types.CodeID(byteCodeID) - wasmBytes := store.Get(codeKey) - return wasmBytes, nil + for _, checksum := range checksums { + if err := types.WasmVM.Pin(checksum); err != nil { + return err + } + } + return nil } diff --git a/modules/light-clients/08-wasm/keeper/msg_server.go b/modules/light-clients/08-wasm/keeper/msg_server.go index 73fe3152c34..e52967fa523 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server.go +++ b/modules/light-clients/08-wasm/keeper/msg_server.go @@ -2,12 +2,12 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "encoding/hex" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) var _ types.MsgServer = Keeper{} @@ -17,18 +17,18 @@ func (k Keeper) PushNewWasmCode(goCtx context.Context, msg *types.MsgPushNewWasm ctx := sdk.UnwrapSDKContext(goCtx) if k.authority != msg.Signer { - return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", k.authority, msg.Signer) + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", k.authority, msg.Signer) } - codeID, err := k.storeWasmCode(ctx, msg.Code) + codeID, err := k.storeWasmCode(ctx, msg.Code, types.WasmVM.StoreCode) if err != nil { - return nil, sdkerrors.Wrap(err, "pushing new wasm code failed") + return nil, errorsmod.Wrap(err, "pushing new wasm code failed") } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - clienttypes.EventTypePushWasmCode, - sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeID, hex.EncodeToString(codeID)), + types.EventTypePushWasmCode, + sdk.NewAttribute(types.AttributeKeyWasmCodeID, hex.EncodeToString(codeID)), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -44,26 +44,26 @@ func (k Keeper) PushNewWasmCode(goCtx context.Context, msg *types.MsgPushNewWasm // UpdateWasmCodeId defines a rpc handler method for MsgUpdateWasmCodeId func (k Keeper) UpdateWasmCodeId(goCtx context.Context, msg *types.MsgUpdateWasmCodeId) (*types.MsgUpdateWasmCodeIdResponse, error) { if k.authority != msg.Signer { - return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", k.authority, msg.Signer) + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", k.authority, msg.Signer) } ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) - codeId := msg.CodeId - if !store.Has(types.CodeID(codeId)) { - return nil, sdkerrors.Wrapf(types.ErrInvalidCodeId, "code id %s does not exist", hex.EncodeToString(codeId)) + + codeIDKey := types.CodeID(codeId) + if !types.HasChecksum(ctx, codeIDKey) { + return nil, errorsmod.Wrapf(types.ErrInvalidCodeId, "code id %s does not exist", hex.EncodeToString(codeId)) } clientId := msg.ClientId unknownClientState, found := k.clientKeeper.GetClientState(ctx, clientId) if !found { - return nil, sdkerrors.Wrapf(clienttypes.ErrClientNotFound, "cannot update client with ID %s", clientId) + return nil, errorsmod.Wrapf(clienttypes.ErrClientNotFound, "cannot update client with ID %s", clientId) } clientState, ok := unknownClientState.(*types.ClientState) if !ok { - return nil, sdkerrors.Wrapf(types.ErrInvalid, "client state type %T, expected %T", unknownClientState, (*types.ClientState)(nil)) + return nil, errorsmod.Wrapf(types.ErrInvalid, "client state type %T, expected %T", unknownClientState, (*types.ClientState)(nil)) } clientState.CodeId = codeId @@ -72,9 +72,9 @@ func (k Keeper) UpdateWasmCodeId(goCtx context.Context, msg *types.MsgUpdateWasm ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - clienttypes.EventTypeUpdateWasmCodeId, + types.EventTypeUpdateWasmCodeId, sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientId), - sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeID, hex.EncodeToString(codeId)), + sdk.NewAttribute(types.AttributeKeyWasmCodeID, hex.EncodeToString(codeId)), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/modules/light-clients/08-wasm/keeper/snapshotter.go b/modules/light-clients/08-wasm/keeper/snapshotter.go index c77c973f19f..df57c63ca2b 100644 --- a/modules/light-clients/08-wasm/keeper/snapshotter.go +++ b/modules/light-clients/08-wasm/keeper/snapshotter.go @@ -1,14 +1,15 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "io" errorsmod "cosmossdk.io/errors" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - snapshot "github.com/cosmos/cosmos-sdk/snapshots/types" + snapshot "cosmossdk.io/store/snapshots/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) var _ snapshot.ExtensionSnapshotter = &WasmSnapshotter{} @@ -18,10 +19,10 @@ const SnapshotFormat = 1 type WasmSnapshotter struct { wasm *Keeper - cms sdk.MultiStore + cms storetypes.MultiStore } -func NewWasmSnapshotter(cms sdk.MultiStore, wasm *Keeper) *WasmSnapshotter { +func NewWasmSnapshotter(cms storetypes.MultiStore, wasm *Keeper) *WasmSnapshotter { return &WasmSnapshotter{ wasm: wasm, cms: cms, @@ -48,38 +49,29 @@ func (ws *WasmSnapshotter) SnapshotExtension(height uint64, payloadWriter snapsh } ctx := sdk.NewContext(cacheMS, tmproto.Header{}, false, nil) - seenBefore := make(map[string]bool) - var rerr error - ws.wasm.IterateCodeInfos(ctx, func(codeID string) bool { - if seenBefore[codeID] { - return false - } - seenBefore[codeID] = true + checkSums, err := types.GetAllChecksums(ctx) + if err != nil { + return err + } - // load code and abort on error - wasmBytes, err := ws.wasm.GetWasmByte(ctx, codeID) + for _, checksum := range checkSums { + wasmCode, err := types.WasmVM.GetCode(checksum) if err != nil { - rerr = err - return true + return err } - compressedWasm, err := types.GzipIt(wasmBytes) + compressedWasm, err := types.GzipIt(wasmCode) if err != nil { - rerr = err - return true + return err } - err = payloadWriter(compressedWasm) - if err != nil { - rerr = err - return true + if err = payloadWriter(compressedWasm); err != nil { + return err } + } - return false - }) - - return rerr + return nil } func (ws *WasmSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error { diff --git a/modules/light-clients/08-wasm/keeper/utils.go b/modules/light-clients/08-wasm/keeper/utils.go index c09f00bc149..0cbe03bdf41 100644 --- a/modules/light-clients/08-wasm/keeper/utils.go +++ b/modules/light-clients/08-wasm/keeper/utils.go @@ -5,7 +5,7 @@ import ( "compress/gzip" "io" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) // Copied gzip feature from wasmd diff --git a/modules/light-clients/08-wasm/module.go b/modules/light-clients/08-wasm/module.go index 5f8c9745060..f3e91ebf00d 100644 --- a/modules/light-clients/08-wasm/module.go +++ b/modules/light-clients/08-wasm/module.go @@ -2,10 +2,12 @@ package wasm import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "fmt" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/gov/simulation" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -14,16 +16,28 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/client/cli" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/client/cli" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = (*AppModule)(nil) + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.HasProposalMsgs = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasName = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + _ module.HasServices = (*AppModule)(nil) + _ appmodule.AppModule = (*AppModule)(nil) ) +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + // AppModuleBasic defines the basic application module used by the tendermint light client. // Only the RegisterInterfaces function needs to be implemented. All other function perform // a no-op. @@ -97,7 +111,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) []abci.ValidatorUpdate { +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs() +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { var gs types.GenesisState err := cdc.UnmarshalJSON(bz, &gs) if err != nil { @@ -107,19 +126,9 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.Ra if err != nil { panic(err) } - return []abci.ValidatorUpdate{} } func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { gs := am.keeper.ExportGenesis(ctx) return cdc.MustMarshalJSON(&gs) } - -// BeginBlock implements the AppModule interface -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { -} - -// EndBlock implements the AppModule interface -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/modules/light-clients/08-wasm/simulation/proposals.go b/modules/light-clients/08-wasm/simulation/proposals.go new file mode 100644 index 00000000000..2767d5fa52c --- /dev/null +++ b/modules/light-clients/08-wasm/simulation/proposals.go @@ -0,0 +1,40 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgStoreCode int = 100 + + OpWeightMsgStoreCode = "op_weight_msg_store_code" // #nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgStoreCode, + DefaultWeightMsgStoreCode, + SimulateMsgStoreCode, + ), + } +} + +// SimulateMsgStoreCode returns a random MsgStoreCode for the 08-wasm module +func SimulateMsgStoreCode(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + + return &types.MsgStoreCode{ + Signer: signer.String(), + WasmByteCode: []byte{0x01}, + } +} diff --git a/modules/light-clients/08-wasm/simulation/proposals_test.go b/modules/light-clients/08-wasm/simulation/proposals_test.go new file mode 100644 index 00000000000..cc1f6dd9925 --- /dev/null +++ b/modules/light-clients/08-wasm/simulation/proposals_test.go @@ -0,0 +1,41 @@ +package simulation_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/simulation" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + r := rand.New(s) + + ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, 1, len(weightedProposalMsgs)) + w0 := weightedProposalMsgs[0] + + require.Equal(t, simulation.OpWeightMsgStoreCode, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgStoreCode, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgStoreCode, ok := msg.(*types.MsgStoreCode) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgStoreCode.Signer) + require.Equal(t, msgStoreCode.WasmByteCode, []byte{0x01}) +} diff --git a/modules/light-clients/08-wasm/testing/mock/mock.go b/modules/light-clients/08-wasm/testing/mock/mock.go new file mode 100644 index 00000000000..1a9c6370e46 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/mock/mock.go @@ -0,0 +1,27 @@ +package mock + +import ( + "github.com/cosmos/ibc-go/v8/modules/core/exported" +) + +var _ exported.Path = KeyPath{} + +// KeyPath defines a placeholder struct which implements the exported.Path interface +type KeyPath struct{} + +// String implements the exported.Path interface +func (KeyPath) String() string { + return "" +} + +// Empty implements the exported.Path interface +func (KeyPath) Empty() bool { + return false +} + +var _ exported.Height = Height{} + +// Height defines a placeholder struct which implements the exported.Height interface +type Height struct { + exported.Height +} diff --git a/modules/light-clients/08-wasm/testing/mock_engine.go b/modules/light-clients/08-wasm/testing/mock_engine.go new file mode 100644 index 00000000000..6e6e985e65a --- /dev/null +++ b/modules/light-clients/08-wasm/testing/mock_engine.go @@ -0,0 +1,289 @@ +package testing + +import ( + "encoding/binary" + "encoding/json" + "errors" + "fmt" + "reflect" + + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" +) + +const DefaultGasUsed = uint64(1) + +var ( + _ ibcwasm.WasmEngine = (*MockWasmEngine)(nil) + + // queryTypes contains all the possible query message types. + queryTypes = [...]any{types.StatusMsg{}, types.ExportMetadataMsg{}, types.TimestampAtHeightMsg{}, types.VerifyClientMessageMsg{}, types.CheckForMisbehaviourMsg{}} + + // sudoTypes contains all the possible sudo message types. + sudoTypes = [...]any{types.UpdateStateMsg{}, types.UpdateStateOnMisbehaviourMsg{}, types.VerifyUpgradeAndUpdateStateMsg{}, types.VerifyMembershipMsg{}, types.VerifyNonMembershipMsg{}, types.MigrateClientStoreMsg{}} +) + +type ( + // queryFn is a callback function that is invoked when a specific query message type is received. + queryFn func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) + + // sudoFn is a callback function that is invoked when a specific sudo message type is received. + sudoFn func(checksum wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) +) + +// MockWasmEngine implements types.WasmEngine for testing purposes. One or multiple messages can be stubbed. +// Without a stub function a panic is thrown. +// ref: https://github.com/CosmWasm/wasmd/blob/v0.42.0/x/wasm/keeper/wasmtesting/mock_engine.go#L19 +type MockWasmEngine struct { + StoreCodeFn func(code wasmvm.WasmCode) (wasmvm.Checksum, error) + StoreCodeUncheckedFn func(code wasmvm.WasmCode) (wasmvm.Checksum, error) + InstantiateFn func(checksum 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) + MigrateFn func(checksum wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) + GetCodeFn func(checksum wasmvm.Checksum) (wasmvm.WasmCode, error) + PinFn func(checksum wasmvm.Checksum) error + UnpinFn func(checksum wasmvm.Checksum) error + + // queryCallbacks contains a mapping of queryMsg field type name to callback function. + queryCallbacks map[string]queryFn + sudoCallbacks map[string]sudoFn + + // contracts contains a mapping of checksum to code. + storedContracts map[uint32][]byte +} + +// NewMockWasmEngine creates and returns a new instance of the mock wasmvm for testing purposes. +// Each callback method of the mock wasmvm can be overridden to assign specific functionality. +// Default functionality is assigned for StoreCode, StoreCodeUnchecked and GetCode. Both Pin and Unpin are implemented as no-op methods. +// All other callbacks stored in the query and sudo callback maps panic. Use RegisterQueryCallback and RegisterSudoCallback methods +// to assign expected behaviour for test cases. +func NewMockWasmEngine() *MockWasmEngine { + m := &MockWasmEngine{ + queryCallbacks: map[string]queryFn{}, + sudoCallbacks: map[string]sudoFn{}, + storedContracts: map[uint32][]byte{}, + } + + for _, msgType := range queryTypes { + typeName := reflect.TypeOf(msgType).Name() + m.queryCallbacks[typeName] = func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + panic(fmt.Errorf("no callback specified for type %s", typeName)) + } + } + + for _, msgType := range sudoTypes { + typeName := reflect.TypeOf(msgType).Name() + m.sudoCallbacks[typeName] = func(checksum wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + panic(fmt.Errorf("no callback specified for type %s", typeName)) + } + } + + // Set up default behavior for Store/Pin/Get + m.StoreCodeFn = func(code wasmvm.WasmCode) (wasmvm.Checksum, error) { + checkSum, _ := types.CreateChecksum(code) + + m.storedContracts[binary.LittleEndian.Uint32(checkSum)] = code + return checkSum, nil + } + + m.StoreCodeUncheckedFn = func(code wasmvm.WasmCode) (wasmvm.Checksum, error) { + checkSum, _ := types.CreateChecksum(code) + + m.storedContracts[binary.LittleEndian.Uint32(checkSum)] = code + return checkSum, nil + } + + m.PinFn = func(checksum wasmvm.Checksum) error { + return nil + } + + m.UnpinFn = func(checksum wasmvm.Checksum) error { + return nil + } + + m.GetCodeFn = func(checksum wasmvm.Checksum) (wasmvm.WasmCode, error) { + code, ok := m.storedContracts[binary.LittleEndian.Uint32(checksum)] + if !ok { + return nil, errors.New("code not found") + } + return code, nil + } + + return m +} + +// RegisterQueryCallback registers a callback for a specific message type. +func (m *MockWasmEngine) RegisterQueryCallback(queryMessage any, fn queryFn) { + typeName := reflect.TypeOf(queryMessage).Name() + if _, found := m.queryCallbacks[typeName]; !found { + panic(fmt.Errorf("unexpected argument of type %s passed", typeName)) + } + m.queryCallbacks[typeName] = fn +} + +// RegisterSudoCallback registers a callback for a specific sudo message type. +func (m *MockWasmEngine) RegisterSudoCallback(sudoMessage any, fn sudoFn) { + typeName := reflect.TypeOf(sudoMessage).Name() + if _, found := m.sudoCallbacks[typeName]; !found { + panic(fmt.Errorf("unexpected argument of type %s passed", typeName)) + } + m.sudoCallbacks[typeName] = fn +} + +// StoreCode implements the WasmEngine interface. +func (m *MockWasmEngine) StoreCode(code wasmvm.WasmCode) (wasmvm.Checksum, error) { + if m.StoreCodeFn == nil { + panic(errors.New("mock engine is not properly initialized: StoreCodeFn is nil")) + } + return m.StoreCodeFn(code) +} + +// StoreCode implements the WasmEngine interface. +func (m *MockWasmEngine) StoreCodeUnchecked(code wasmvm.WasmCode) (wasmvm.Checksum, error) { + if m.StoreCodeUncheckedFn == nil { + panic(errors.New("mock engine is not properly initialized: StoreCodeUncheckedFn is nil")) + } + return m.StoreCodeUncheckedFn(code) +} + +// Instantiate implements the WasmEngine interface. +func (m *MockWasmEngine) Instantiate(checksum 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) { + if m.InstantiateFn == nil { + panic(errors.New("mock engine is not properly initialized: InstantiateFn is nil")) + } + return m.InstantiateFn(checksum, env, info, initMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) +} + +// Query implements the WasmEngine interface. +func (m *MockWasmEngine) Query(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + msgTypeName := getQueryMsgPayloadTypeName(queryMsg) + + callbackFn, ok := m.queryCallbacks[msgTypeName] + if !ok { + panic(fmt.Errorf("mock engine is not properly initialized: no callback specified for %s", msgTypeName)) + } + + return callbackFn(checksum, env, queryMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) +} + +// Migrate implements the WasmEngine interface. +func (m *MockWasmEngine) Migrate(checksum wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + if m.MigrateFn == nil { + panic(errors.New("mock engine is not properly initialized: MigrateFn is nil")) + } + return m.MigrateFn(checksum, env, migrateMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) +} + +// Sudo implements the WasmEngine interface. +func (m *MockWasmEngine) Sudo(checksum wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + msgTypeName := getSudoMsgPayloadTypeName(sudoMsg) + + sudoFn, ok := m.sudoCallbacks[msgTypeName] + if !ok { + panic(fmt.Errorf("mock engine is not properly initialized: no callback specified for %s", msgTypeName)) + } + + return sudoFn(checksum, env, sudoMsg, store, goapi, querier, gasMeter, gasLimit, deserCost) +} + +// GetCode implements the WasmEngine interface. +func (m *MockWasmEngine) GetCode(checksum wasmvm.Checksum) (wasmvm.WasmCode, error) { + if m.GetCodeFn == nil { + panic(errors.New("mock engine is not properly initialized: GetCodeFn is nil")) + } + return m.GetCodeFn(checksum) +} + +// Pin implements the WasmEngine interface. +func (m *MockWasmEngine) Pin(checksum wasmvm.Checksum) error { + if m.PinFn == nil { + panic(errors.New("mock engine is not properly initialized: PinFn is nil")) + } + return m.PinFn(checksum) +} + +// Unpin implements the WasmEngine interface. +func (m *MockWasmEngine) Unpin(checksum wasmvm.Checksum) error { + if m.UnpinFn == nil { + panic(errors.New("mock engine is not properly initialized: UnpinFn is nil")) + } + return m.UnpinFn(checksum) +} + +// getQueryMsgPayloadTypeName extracts the name of the struct that is populated. +// this value is used as a key to map to a callback function to handle that message type. +func getQueryMsgPayloadTypeName(queryMsgBz []byte) string { + payload := types.QueryMsg{} + if err := json.Unmarshal(queryMsgBz, &payload); err != nil { + panic(err) + } + + var payloadField any + if payload.Status != nil { + payloadField = *payload.Status + } + + if payload.CheckForMisbehaviour != nil { + payloadField = *payload.CheckForMisbehaviour + } + + if payload.ExportMetadata != nil { + payloadField = *payload.ExportMetadata + } + + if payload.TimestampAtHeight != nil { + payloadField = *payload.TimestampAtHeight + } + + if payload.VerifyClientMessage != nil { + payloadField = *payload.VerifyClientMessage + } + + if payloadField == nil { + panic(fmt.Errorf("failed to extract valid query message from bytes: %s", string(queryMsgBz))) + } + + return reflect.TypeOf(payloadField).Name() +} + +// getSudoMsgPayloadTypeName extracts the name of the struct that is populated. +// this value is used as a key to map to a callback function to handle that message type. +func getSudoMsgPayloadTypeName(sudoMsgBz []byte) string { + payload := types.SudoMsg{} + if err := json.Unmarshal(sudoMsgBz, &payload); err != nil { + panic(err) + } + + var payloadField any + if payload.UpdateState != nil { + payloadField = *payload.UpdateState + } + + if payload.UpdateStateOnMisbehaviour != nil { + payloadField = *payload.UpdateStateOnMisbehaviour + } + + if payload.VerifyUpgradeAndUpdateState != nil { + payloadField = *payload.VerifyUpgradeAndUpdateState + } + + if payload.VerifyMembership != nil { + payloadField = *payload.VerifyMembership + } + + if payload.VerifyNonMembership != nil { + payloadField = *payload.VerifyNonMembership + } + + if payload.MigrateClientStore != nil { + payloadField = *payload.MigrateClientStore + } + + if payloadField == nil { + panic(fmt.Errorf("failed to extract valid sudo message from bytes: %s", string(sudoMsgBz))) + } + + return reflect.TypeOf(payloadField).Name() +} diff --git a/modules/light-clients/08-wasm/testing/simapp/README.md b/modules/light-clients/08-wasm/testing/simapp/README.md new file mode 100644 index 00000000000..784ce82a0c2 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/README.md @@ -0,0 +1,5 @@ +# 08-Wasm Testing SimApp + +This testing directory is a duplicate of the ibc-go testing directory. +It is only here as a way of creating a separate SimApp binary to avoid introducing a dependency on the 08-wasm +module from within ibc-go. diff --git a/modules/light-clients/08-wasm/testing/simapp/ante_handler.go b/modules/light-clients/08-wasm/testing/simapp/ante_handler.go new file mode 100644 index 00000000000..098ef9fabbf --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/ante_handler.go @@ -0,0 +1,50 @@ +package simapp + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" + "github.com/cosmos/ibc-go/v8/modules/core/keeper" +) + +// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC keeper. +type HandlerOptions struct { + ante.HandlerOptions + + IBCKeeper *keeper.Keeper +} + +// NewAnteHandler creates a new ante handler +func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { + if options.AccountKeeper == nil { + return nil, errorsmod.Wrap(ibcerrors.ErrLogic, "account keeper is required for AnteHandler") + } + if options.BankKeeper == nil { + return nil, errorsmod.Wrap(ibcerrors.ErrLogic, "bank keeper is required for AnteHandler") + } + if options.SignModeHandler == nil { + return nil, errorsmod.Wrap(ibcerrors.ErrLogic, "sign mode handler is required for AnteHandler") + } + + anteDecorators := []sdk.AnteDecorator{ + ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first + ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), + ante.NewValidateBasicDecorator(), + ante.NewTxTimeoutHeightDecorator(), + ante.NewValidateMemoDecorator(options.AccountKeeper), + ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), + ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewValidateSigCountDecorator(options.AccountKeeper), + ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), + ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + ante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), + } + + return sdk.ChainAnteDecorators(anteDecorators...), nil +} diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go new file mode 100644 index 00000000000..26d142be709 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -0,0 +1,1125 @@ +package simapp + +import ( + "encoding/json" + "fmt" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "io" + "os" + "path/filepath" + + cmtos "github.com/cometbft/cometbft/libs/os" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/gogoproto/proto" + "github.com/spf13/cast" + + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/circuit" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + circuittypes "cosmossdk.io/x/circuit/types" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/posthandler" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + 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" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "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" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/group" + groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" + groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" + "github.com/cosmos/cosmos-sdk/x/mint" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + wasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + wasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" + wasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + transfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibcmock "github.com/cosmos/ibc-go/v8/testing/mock" + ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" +) + +const appName = "SimApp" + +// IBC application testing ports +const ( + MockFeePort string = ibcmock.ModuleName + ibcfeetypes.ModuleName +) + +var ( + // DefaultNodeHome default home directories for the application daemon + DefaultNodeHome string + + // module account permissions + maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + ibcmock.ModuleName: nil, + } +) + +var ( + _ runtime.AppI = (*SimApp)(nil) + _ servertypes.Application = (*SimApp)(nil) +) + +// SimApp extends an ABCI application, but with most of its parameters exported. +// They are exported for convenience in creating helper functions, as object +// capabilities aren't needed for testing. +type SimApp struct { + *baseapp.BaseApp + legacyAmino *codec.LegacyAmino + appCodec codec.Codec + txConfig client.TxConfig + interfaceRegistry types.InterfaceRegistry + + // keys to access the substores + 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 + AuthzKeeper authzkeeper.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 + EvidenceKeeper evidencekeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + WasmClientKeeper wasmkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + GroupKeeper groupkeeper.Keeper + ConsensusParamsKeeper consensusparamkeeper.Keeper + CircuitKeeper circuitkeeper.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper + ScopedICAMockKeeper capabilitykeeper.ScopedKeeper + + // make IBC modules public for test purposes + // these modules are never directly routed to by the IBC Router + ICAAuthModule ibcmock.IBCModule + FeeMockModule ibcmock.IBCModule + + // the module manager + ModuleManager *module.Manager + BasicModuleManager module.BasicManager + + // simulation manager + simulationManager *module.SimulationManager + + // module configurator + configurator module.Configurator +} + +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } + + DefaultNodeHome = filepath.Join(userHomeDir, ".simapp") +} + +// NewSimApp returns a reference to an initialized SimApp. +func NewSimApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + loadLatest bool, + appOpts servertypes.AppOptions, + mockVM ibcwasm.WasmEngine, + baseAppOptions ...func(*baseapp.BaseApp), +) *SimApp { + interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + appCodec := codec.NewProtoCodec(interfaceRegistry) + legacyAmino := codec.NewLegacyAmino() + txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes) + + std.RegisterLegacyAminoCodec(legacyAmino) + std.RegisterInterfaces(interfaceRegistry) + + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. + // + // Example: + // + // bApp := baseapp.NewBaseApp(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp) + // + // bApp.SetMempool(nonceMempool) + // bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to NewBaseApp. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + + bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) + bApp.SetCommitMultiStoreTracer(traceStore) + bApp.SetVersion(version.Version) + bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) + + keys := storetypes.NewKVStoreKeys( + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, + govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, wasmtypes.StoreKey, + ) + + // register streaming services + if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil { + panic(err) + } + + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + + app := &SimApp{ + BaseApp: bApp, + legacyAmino: legacyAmino, + appCodec: appCodec, + txConfig: txConfig, + interfaceRegistry: interfaceRegistry, + keys: keys, + tkeys: tkeys, + memKeys: memKeys, + } + + app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) + + // set the BaseApp's parameter store + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) + bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) + + // add capability keeper and ScopeToModule for ibc module + app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) + + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // not replicate if you do not need to test core IBC or light clients. + scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) + scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) + scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) + + // seal capability keeper after scoping modules + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` + app.CapabilityKeeper.Seal() + + // SDK module keepers + + // add keepers + app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, + runtime.NewKVStoreService(keys[banktypes.StoreKey]), + app.AccountKeeper, + BlockedAddresses(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + logger, + ) + app.StakingKeeper = stakingkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), + ) + app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, legacyAmino, runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[crisistypes.StoreKey]), invCheckPeriod, + app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountKeeper.AddressCodec()) + + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AccountKeeper) + + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + app.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), + ) + + app.CircuitKeeper = circuitkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[circuittypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountKeeper.AddressCodec()) + app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) + + app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper) + + groupConfig := group.DefaultConfig() + /* + Example of setting group params: + groupConfig.MaxMetadataLen = 1000 + */ + app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) + + // get skipUpgradeHeights from the app options + skipUpgradeHeights := map[int64]bool{} + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + homePath := cast.ToString(appOpts.Get(flags.FlagHome)) + // set the governance module account as the authority for conducting upgrades + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.IBCKeeper = ibckeeper.NewKeeper( + appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + // 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://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + govConfig := govtypes.DefaultConfig() + /* + Example of setting gov params: + govConfig.MaxMetadataLen = 10000 + */ + govKeeper := govkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, + app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Set legacy router for backwards compatibility with gov v1beta1 + govKeeper.SetLegacyRouter(govRouter) + + app.GovKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks( + // register the governance hooks + ), + ) + + // 08-wasm's Keeper can be instantiated in two different ways: + // 1. If the chain uses x/wasm: + // Both x/wasm's Keeper and 08-wasm Keeper should share the same Wasm VM instance. + // - Instantiate the Wasm VM in app.go with the parameters of your choice. + // - Create an Option with this Wasm VM instance (see https://github.com/CosmWasm/wasmd/blob/v0.41.0/x/wasm/keeper/options.go#L26-L32). + // - Pass the option to the x/wasm NewKeeper contructor function (https://github.com/CosmWasm/wasmd/blob/v0.41.0/x/wasm/keeper/keeper_cgo.go#L36). + // - Pass a pointer to the Wasm VM instance to 08-wasm NewKeeperWithVM constructor function. + // + // 2. If the chain does not use x/wasm: + // Even though it is still possible to use method 1 above + // (e.g. instantiating a Wasm VM in app.go an pass it in 08-wasm NewKeeper), + // since there is no need to share the Wasm VM instance with another module + // you can use NewKeeperWithConfig constructor function and provide + // the Wasm VM configuration parameters of your choice. + // Check out the WasmConfig type definition for more information on + // each parameter. Some parameters allow node-leve configurations. + // Function DefaultWasmConfig can also be used to use default values. + // + // In the code below we use the second method because we are not using x/wasm in this app.go. + wasmConfig := wasmtypes.WasmConfig{ + DataDir: "ibc_08-wasm_client_data", + SupportedCapabilities: "iterator", + ContractDebugMode: false, + } + if mockVM != nil { + // NOTE: mockVM is used for testing purposes only! + app.WasmClientKeeper = wasmkeeper.NewKeeperWithVm( + appCodec, + runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmConfig.DataDir, + &app.IBCKeeper.ClientKeeper, + app.GRPCQueryRouter(), + mockVM, + ) + } else { + app.WasmClientKeeper = wasmkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmConfig.DataDir, + &app.IBCKeeper.ClientKeeper, + app.GRPCQueryRouter()) + } + + // IBC Fee Module keeper + app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + appCodec, keys[ibcfeetypes.StoreKey], + app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + ) + + // ICA Controller keeper + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // 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(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Create IBC Router + ibcRouter := porttypes.NewRouter() + + // Middleware Stacks + + // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper + // since fee middleware will wrap the IBCKeeper for underlying application. + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Mock Module Stack + + // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // not replicate if you do not need to test core IBC or light clients. + mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + + // The mock module is used for testing IBC + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) + + // Create Transfer Stack + // SendPacket, since it is originating from the application to core IBC: + // transferKeeper.SendPacket -> fee.SendPacket -> channel.SendPacket + + // RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way + // channel.RecvPacket -> fee.OnRecvPacket -> transfer.OnRecvPacket + + // transfer stack contains (from top to bottom): + // - IBC Fee Middleware + // - Transfer + + // create IBC module from bottom to top of stack + var transferStack porttypes.IBCModule + transferStack = transfer.NewIBCModule(app.TransferKeeper) + transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper) + + // Add transfer stack to IBC Router + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) + + // Create Interchain Accounts Stack + // SendPacket, since it is originating from the application to core IBC: + // icaControllerKeeper.SendTx -> fee.SendPacket -> channel.SendPacket + + // initialize ICA module with mock module as the authentication module on the controller side + var icaControllerStack porttypes.IBCModule + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + app.ICAAuthModule = icaControllerStack.(ibcmock.IBCModule) + icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper) + icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper) + + // RecvPacket, message that originates from core IBC and goes down to app, the flow is: + // channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket + + var icaHostStack porttypes.IBCModule + icaHostStack = icahost.NewIBCModule(app.ICAHostKeeper) + icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, app.IBCFeeKeeper) + + // Add host, controller & ica auth modules to IBC router + ibcRouter. + // the ICA Controller middleware needs to be explicitly added to the IBC Router because the + // ICA controller module owns the port capability for ICA. The ICA authentication module + // owns the channel capability. + AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). + AddRoute(icahosttypes.SubModuleName, icaHostStack). + AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack) + + // Create Mock IBC Fee module stack for testing + // SendPacket, mock module cannot send packets + + // OnRecvPacket, message that originates from core IBC and goes down to app, the flow is the otherway + // channel.RecvPacket -> fee.OnRecvPacket -> mockModule.OnRecvPacket + + // OnAcknowledgementPacket as this is where fee's are paid out + // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket + + // create fee wrapped mock module + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + app.FeeMockModule = feeMockModule + feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) + ibcRouter.AddRoute(MockFeePort, feeWithMockModule) + + // Seal the IBC Router + app.IBCKeeper.SetRouter(ibcRouter) + + // create evidence keeper with router + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, app.AccountKeeper.AddressCodec(), runtime.ProvideCometInfoService(), + ) + // If evidence needs to be handled for the app, set routes in router here and seal + app.EvidenceKeeper = *evidenceKeeper + + // **** Module Options **** + + // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment + // we prefer to be more strict in what arguments the modules expect. + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. + app.ModuleManager = module.NewManager( + genutil.NewAppModule( + app.AccountKeeper, app.StakingKeeper, app, + txConfig, + ), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), + evidence.NewAppModule(app.EvidenceKeeper), + params.NewAppModule(app.ParamsKeeper), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), + circuit.NewAppModule(appCodec, app.CircuitKeeper), + + // IBC modules + ibc.NewAppModule(app.IBCKeeper), + transfer.NewAppModule(app.TransferKeeper), + ibcfee.NewAppModule(app.IBCFeeKeeper), + ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + wasm.NewAppModule(app.WasmClientKeeper), + ibctm.NewAppModule(), + solomachine.NewAppModule(), + mockModule, + ) + + // BasicModuleManager defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration and genesis verification. + // By default it is composed of all the module from the module manager. + // Additionally, app module basics can be overwritten by passing them as argument. + app.BasicModuleManager = module.NewBasicManagerFromManager( + app.ModuleManager, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), + }) + app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // NOTE: upgrade module is required to be prioritized + app.ModuleManager.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + app.ModuleManager.SetOrderBeginBlockers( + capabilitytypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + genutiltypes.ModuleName, + authz.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + wasmtypes.ModuleName, + ibcmock.ModuleName, + ) + app.ModuleManager.SetOrderEndBlockers( + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + genutiltypes.ModuleName, + feegrant.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + wasmtypes.ModuleName, + ibcmock.ModuleName, + group.ModuleName, + ) + + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder := []string{ + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, + slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, + vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, wasmtypes.ModuleName, + } + app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) + app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) + + // Uncomment if you want to set a custom migration order here. + // app.ModuleManager.SetOrderMigrations(custom order) + + app.ModuleManager.RegisterInvariants(app.CrisisKeeper) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + err := app.ModuleManager.RegisterServices(app.configurator) + if err != nil { + panic(err) + } + + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) + + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + + // registerUpgradeHandlers is used for registering any on-chain upgrades. + // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. + app.registerUpgradeHandlers() + + // add test gRPC service for testing gRPC queries in isolation + testpb.RegisterQueryServer(app.GRPCQueryRouter(), testpb.QueryImpl{}) + + // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions + overrideModules := map[string]module.AppModuleSimulation{ + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + } + app.simulationManager = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) + + app.simulationManager.RegisterStoreDecoders() + + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tkeys) + app.MountMemoryStores(memKeys) + + // initialize BaseApp + app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) + app.SetBeginBlocker(app.BeginBlocker) + app.SetEndBlocker(app.EndBlocker) + app.setAnteHandler(txConfig) + + // must be before Loading version + if manager := app.SnapshotManager(); manager != nil { + err := manager.RegisterExtensions( + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmClientKeeper), + ) + if err != nil { + panic(fmt.Errorf("failed to register snapshot extension: %s", err)) + } + } + + // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like + // antehandlers, but are run _after_ the `runMsgs` execution. They are also + // defined as a chain, and have the same signature as antehandlers. + // + // In baseapp, postHandlers are run in the same store branch as `runMsgs`, + // meaning that both `runMsgs` and `postHandler` state will be committed if + // both are successful, and both will be reverted if any of the two fails. + // + // The SDK exposes a default postHandlers chain, which comprises of only + // one decorator: the Transaction Tips decorator. However, some chains do + // not need it by default, so feel free to comment the next line if you do + // not need tips. + // To read more about tips: + // https://docs.cosmos.network/main/core/tips.html + // + // Please note that changing any of the anteHandler or postHandler chain is + // likely to be a state-machine breaking change, which needs a coordinated + // upgrade. + app.setPostHandler() + + // At startup, after all modules have been registered, check that all proto + // annotations are correct. + protoFiles, err := proto.MergedRegistry() + if err != nil { + panic(err) + } + err = msgservice.ValidateProtoAnnotations(protoFiles) + if err != nil { + // Once we switch to using protoreflect-based antehandlers, we might + // want to panic here instead of logging a warning. + _, err := fmt.Fprintln(os.Stderr, err.Error()) + if err != nil { + fmt.Println("could not write to stderr") + } + } + + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + panic(fmt.Errorf("error loading last version: %w", err)) + } + + ctx := app.BaseApp.NewUncachedContext(true, cmtproto.Header{}) + + // Initialize pinned codes in wasmvm as they are not persisted there + if err := wasmkeeper.InitializePinnedCodes(ctx); err != nil { + cmtos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) + } + } + + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + + // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // note replicate if you do not need to test core IBC or light clients. + app.ScopedIBCMockKeeper = scopedIBCMockKeeper + app.ScopedICAMockKeeper = scopedICAMockKeeper + app.ScopedFeeMockKeeper = scopedFeeMockKeeper + + return app +} + +func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { + anteHandler, err := NewAnteHandler( + HandlerOptions{ + HandlerOptions: ante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + FeegrantKeeper: app.FeeGrantKeeper, + SignModeHandler: txConfig.SignModeHandler(), + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + }, + IBCKeeper: app.IBCKeeper, + }, + ) + if err != nil { + panic(err) + } + + // Set the AnteHandler for the app + app.SetAnteHandler(anteHandler) +} + +func (app *SimApp) setPostHandler() { + postHandler, err := posthandler.NewPostHandler( + posthandler.HandlerOptions{}, + ) + if err != nil { + panic(err) + } + + app.SetPostHandler(postHandler) +} + +// Name returns the name of the App +func (app *SimApp) Name() string { return app.BaseApp.Name() } + +// PreBlocker application updates every pre block +func (app *SimApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.ModuleManager.PreBlock(ctx) +} + +// BeginBlocker application updates every begin block +func (app *SimApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.ModuleManager.BeginBlock(ctx) +} + +// EndBlocker application updates every end block +func (app *SimApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.ModuleManager.EndBlock(ctx) +} + +// Configurator returns the configurator for the app +func (app *SimApp) Configurator() module.Configurator { + return app.configurator +} + +// InitChainer application update at chain initialization +func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + var genesisState GenesisState + if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + panic(err) + } + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { + panic(err) + } + return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) +} + +// LoadHeight loads a particular height +func (app *SimApp) LoadHeight(height int64) error { + return app.LoadVersion(height) +} + +// LegacyAmino returns SimApp's amino codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *SimApp) LegacyAmino() *codec.LegacyAmino { + return app.legacyAmino +} + +// AppCodec returns SimApp's app codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *SimApp) AppCodec() codec.Codec { + return app.appCodec +} + +// InterfaceRegistry returns SimApp's InterfaceRegistry +func (app *SimApp) InterfaceRegistry() types.InterfaceRegistry { + return app.interfaceRegistry +} + +// TxConfig returns SimApp's TxConfig +func (app *SimApp) TxConfig() client.TxConfig { + return app.txConfig +} + +// AutoCliOpts returns the autocli options for the app. +func (app *SimApp) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.ModuleManager.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), + } +} + +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +func (app *SimApp) DefaultGenesis() map[string]json.RawMessage { + return app.BasicModuleManager.DefaultGenesis(app.appCodec) +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { + return app.keys[storeKey] +} + +// GetStoreKeys returns all the stored store keys. +func (app *SimApp) GetStoreKeys() []storetypes.StoreKey { + keys := make([]storetypes.StoreKey, len(app.keys)) + for _, key := range app.keys { + keys = append(keys, key) + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +// +// NOTE: This is solely to be used for testing purposes. +func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (app *SimApp) SimulationManager() *module.SimulationManager { + return app.simulationManager +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + clientCtx := apiSvr.ClientCtx + // Register new tx routes from grpc-gateway. + authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register new CometBFT queries routes from grpc-gateway. + cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register node gRPC service for grpc-gateway. + nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register grpc-gateway routes for all modules. + app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // register swagger API from root so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} + +// RegisterTxService implements the Application.RegisterTxService method. +func (app *SimApp) RegisterTxService(clientCtx client.Context) { + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +} + +// RegisterTendermintService implements the Application.RegisterTendermintService method. +func (app *SimApp) RegisterTendermintService(clientCtx client.Context) { + cmtApp := server.NewCometABCIWrapper(app) + cmtservice.RegisterTendermintService( + clientCtx, + app.BaseApp.GRPCQueryRouter(), + app.interfaceRegistry, + cmtApp.Query, + ) +} + +func (app *SimApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) +} + +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dupMaccPerms := make(map[string][]string) + for k, v := range maccPerms { + dupMaccPerms[k] = v + } + + return dupMaccPerms +} + +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range GetMaccPerms() { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + // allow the following addresses to receive funds + delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + delete(modAccAddrs, authtypes.NewModuleAddress(ibcmock.ModuleName).String()) + + return modAccAddrs +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + + return paramsKeeper +} + +// IBC TestingApp functions + +// GetBaseApp implements the TestingApp interface. +func (app *SimApp) GetBaseApp() *baseapp.BaseApp { + return app.BaseApp +} + +// GetStakingKeeper implements the TestingApp interface. +func (app *SimApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { + return app.StakingKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper +} + +// GetWasmKeeper implements the TestingApp interface. +func (app *SimApp) GetWasmKeeper() wasmkeeper.Keeper { + return app.WasmClientKeeper +} + +// GetScopedIBCKeeper implements the TestingApp interface. +func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +// GetTxConfig implements the TestingApp interface. +func (app *SimApp) GetTxConfig() client.TxConfig { + return app.txConfig +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (app *SimApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return app.memKeys[storeKey] +} diff --git a/modules/light-clients/08-wasm/testing/simapp/encoding.go b/modules/light-clients/08-wasm/testing/simapp/encoding.go new file mode 100644 index 00000000000..ba2d01ecbcf --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/encoding.go @@ -0,0 +1,18 @@ +package simapp + +import ( + "github.com/cosmos/cosmos-sdk/std" + + simappparams "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp/params" +) + +// MakeTestEncodingConfig creates an EncodingConfig for testing. This function +// should be used only in tests or when creating a new app instance (NewApp*()). +// App user shouldn't create new codecs - use the app.AppCodec instead. +// [DEPRECATED] +func MakeTestEncodingConfig() simappparams.EncodingConfig { + encodingConfig := simappparams.MakeTestEncodingConfig() + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/modules/light-clients/08-wasm/testing/simapp/export.go b/modules/light-clients/08-wasm/testing/simapp/export.go new file mode 100644 index 00000000000..871b15cb41c --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/export.go @@ -0,0 +1,249 @@ +package simapp + +import ( + "encoding/json" + "errors" + "log" + + storetypes "cosmossdk.io/store/types" + + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// ExportAppStateAndValidators exports the state of the application for a genesis +// file. +func (app *SimApp) ExportAppStateAndValidators( + forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, +) (servertypes.ExportedApp, error) { + // as if they could withdraw from the start of the next block + ctx := app.NewContext(true) + + // We export at last height + 1, because that's the height at which + // Tendermint will start InitChain. + height := app.LastBlockHeight() + 1 + if forZeroHeight { + height = 0 + app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) + } + + genState, err := app.ModuleManager.ExportGenesis(ctx, app.appCodec) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") + if err != nil { + return servertypes.ExportedApp{}, err + } + + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) + return servertypes.ExportedApp{ + AppState: appState, + Validators: validators, + Height: height, + ConsensusParams: app.BaseApp.GetConsensusParams(ctx), + }, err +} + +// 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 +func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { + applyAllowedAddrs := false + + // check if there is a allowed address list + if len(jailAllowedAddrs) > 0 { + applyAllowedAddrs = true + } + + allowedAddrsMap := make(map[string]bool) + + for _, addr := range jailAllowedAddrs { + _, err := sdk.ValAddressFromBech32(addr) + if err != nil { + log.Fatal(err) + } + allowedAddrsMap[addr] = true + } + + /* Just to be safe, assert the invariants on current state. */ + app.CrisisKeeper.AssertInvariants(ctx) + + /* Handle fee distribution state. */ + + // withdraw all validator commission + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) + return false + }) + if err != nil { + panic(err) + } + + // withdraw all delegator rewards + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) + } + + delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + } + + // clear validator slash events + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) + + // clear validator historical rewards + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + + // set context height to zero + height := ctx.BlockHeight() + ctx = ctx.WithBlockHeight(0) + + // reinitialize all validators + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + panic(err) + } + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } + + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // reinitialize all delegations + for _, del := range dels { + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + panic(err) + } + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + panic(err) + } + 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 + ctx = ctx.WithBlockHeight(height) + + /* Handle staking state. */ + + // iterate through redelegations, reset creation height + err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + for i := range red.Entries { + red.Entries[i].CreationHeight = 0 + } + err := app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // iterate through unbonding delegations, reset creation height + err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + for i := range ubd.Entries { + ubd.Entries[i].CreationHeight = 0 + } + + if err := app.StakingKeeper.SetUnbondingDelegation(ctx, ubd); err != nil { + panic(err) + } + return false + }) + if err != nil { + panic(err) + } + + // Iterate through validators by power descending, reset bond heights, and + // update bond intra-tx counters. + store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + counter := int16(0) + + for ; iter.Valid(); iter.Next() { + addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { + panic(errors.New("expected validator, not found")) + } + + validator.UnbondingHeight = 0 + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + validator.Jailed = true + } + + if err := app.StakingKeeper.SetValidator(ctx, validator); err != nil { + panic(err) + } + counter++ + } + + iter.Close() + + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + log.Fatal(err) + } + + /* Handle slashing state. */ + + // reset start height on signing infos + err = app.SlashingKeeper.IterateValidatorSigningInfos( + ctx, + func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + info.StartHeight = 0 + if err := app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info); err != nil { + panic(err) + } + return false + }, + ) + if err != nil { + panic(err) + } +} diff --git a/modules/light-clients/08-wasm/testing/simapp/genesis.go b/modules/light-clients/08-wasm/testing/simapp/genesis.go new file mode 100644 index 00000000000..2667b97a4fc --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/genesis.go @@ -0,0 +1,14 @@ +package simapp + +import ( + "encoding/json" +) + +// The genesis state of the blockchain is represented here as a map of raw json +// messages key'd by a identifier string. +// The identifier is used to determine which module genesis information belongs +// to so it may be appropriately routed during init chain. +// Within this application default genesis information is retrieved from +// the ModuleBasicManager which populates json from each BasicModule +// object provided to it during init. +type GenesisState map[string]json.RawMessage diff --git a/modules/light-clients/08-wasm/testing/simapp/genesis_account.go b/modules/light-clients/08-wasm/testing/simapp/genesis_account.go new file mode 100644 index 00000000000..5c9c7f9a03f --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/genesis_account.go @@ -0,0 +1,47 @@ +package simapp + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +var _ authtypes.GenesisAccount = (*SimGenesisAccount)(nil) + +// SimGenesisAccount defines a type that implements the GenesisAccount interface +// to be used for simulation accounts in the genesis state. +type SimGenesisAccount struct { + *authtypes.BaseAccount + + // vesting account fields + OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization + DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation + DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation + StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) + EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) + + // module account fields + ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account + ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account +} + +// Validate checks for errors on the vesting and module account parameters +func (sga SimGenesisAccount) Validate() error { + if !sga.OriginalVesting.IsZero() { + if sga.StartTime >= sga.EndTime { + return errors.New("vesting start-time cannot be before end-time") + } + } + + if sga.ModuleName != "" { + ma := authtypes.ModuleAccount{ + BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions, + } + if err := ma.Validate(); err != nil { + return err + } + } + + return sga.BaseAccount.Validate() +} diff --git a/modules/light-clients/08-wasm/testing/simapp/params/amino.go b/modules/light-clients/08-wasm/testing/simapp/params/amino.go new file mode 100644 index 00000000000..d603987dd5f --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/params/amino.go @@ -0,0 +1,27 @@ +//go:build test_amino +// +build test_amino + +package params + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" +) + +// MakeTestEncodingConfig creates an EncodingConfig for an amino based test configuration. +// This function should be used only internally (in the SDK). +// App user should'nt create new codecs - use the app.AppCodec instead. +// [DEPRECATED] +func MakeTestEncodingConfig() EncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewAminoCodec(cdc) + + return EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: legacytx.StdTxConfig{Cdc: cdc}, + Amino: cdc, + } +} diff --git a/modules/light-clients/08-wasm/testing/simapp/params/doc.go b/modules/light-clients/08-wasm/testing/simapp/params/doc.go new file mode 100644 index 00000000000..a2f3620a835 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/params/doc.go @@ -0,0 +1,19 @@ +/* +Package params defines the simulation parameters in the simapp. + +It contains the default weights used for each transaction used on the module's +simulation. These weights define the chance for a transaction to be simulated at +any given operation. + +You can replace the default values for the weights by providing a params.json +file with the weights defined for each of the transaction operations: + + { + "op_weight_msg_send": 60, + "op_weight_msg_delegate": 100, + } + +In the example above, the `MsgSend` has 60% chance to be simulated, while the +`MsgDelegate` will always be simulated. +*/ +package params diff --git a/modules/light-clients/08-wasm/testing/simapp/params/encoding.go b/modules/light-clients/08-wasm/testing/simapp/params/encoding.go new file mode 100644 index 00000000000..8ff9ea04b39 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/params/encoding.go @@ -0,0 +1,16 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/modules/light-clients/08-wasm/testing/simapp/params/proto.go b/modules/light-clients/08-wasm/testing/simapp/params/proto.go new file mode 100644 index 00000000000..4270c2b0dbf --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/params/proto.go @@ -0,0 +1,27 @@ +//go:build !test_amino +// +build !test_amino + +package params + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +// MakeTestEncodingConfig creates an EncodingConfig for a non-amino based test configuration. +// This function should be used only internally (in the SDK). +// App user should'nt create new codecs - use the app.AppCodec instead. +// [DEPRECATED] +func MakeTestEncodingConfig() EncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + protoCdc := codec.NewProtoCodec(interfaceRegistry) + + return EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: protoCdc, + TxConfig: tx.NewTxConfig(protoCdc, tx.DefaultSignModes), + Amino: cdc, + } +} diff --git a/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go new file mode 100644 index 00000000000..615728f7baf --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go @@ -0,0 +1,428 @@ +package cmd + +import ( + "errors" + "fmt" + "io" + "os" + "runtime/debug" + "strings" + + wasmvm "github.com/CosmWasm/wasmvm" + dbm "github.com/cosmos/cosmos-db" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + sdkdebug "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + + cmtcfg "github.com/cometbft/cometbft/config" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp/params" +) + +// NewRootCmd creates a new root command for simd. It is called once in the +// main function. +func NewRootCmd() *cobra.Command { + // we "pre"-instantiate the application for getting the injected/configured encoding configuration + // note, this is not necessary when using app wiring, as depinject can be directly used (see root_v2.go) + tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(tempDir()), nil) + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: tempApp.InterfaceRegistry(), + Codec: tempApp.AppCodec(), + TxConfig: tempApp.TxConfig(), + Amino: tempApp.LegacyAmino(), + } + + initClientCtx := client.Context{}. + WithCodec(encodingConfig.Codec). + WithInterfaceRegistry(encodingConfig.InterfaceRegistry). + WithLegacyAmino(encodingConfig.Amino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(simapp.DefaultNodeHome). + WithViper("") // In simapp, we don't use any prefix for env variables. + + rootCmd := &cobra.Command{ + Use: "simd", + Short: "simulation app", + SilenceErrors: true, + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + if err != nil { + return err + } + + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + if err != nil { + return err + } + + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. + enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) //nolint:gocritic // we know we aren't appending to the same slice + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: enabledSignModes, + TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), + } + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + codec.NewProtoCodec(encodingConfig.InterfaceRegistry), + txConfigOpts, + ) + if err != nil { + return err + } + initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) + + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customCMTConfig := initCometBFTConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) + }, + } + + initRootCmd(rootCmd, encodingConfig, tempApp.BasicModuleManager) + + autoCliOpts, err := enrichAutoCliOpts(tempApp.AutoCliOpts(), initClientCtx) + if err != nil { + panic(err) + } + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + + return rootCmd +} + +func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) (autocli.AppOptions, error) { + autoCliOpts.AddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) + autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) + + var err error + clientCtx, err = config.ReadFromClientConfig(clientCtx) + if err != nil { + return autocli.AppOptions{}, err + } + + autoCliOpts.ClientCtx = clientCtx + + autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(clientCtx.Keyring) + if err != nil { + return autocli.AppOptions{}, err + } + + return autoCliOpts, nil +} + +// initCometBFTConfig helps to override default CometBFT Config values. +// return cmtcfg.DefaultConfig if no custom configuration is required for the application. +func initCometBFTConfig() *cmtcfg.Config { + cfg := cmtcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + + // WASMConfig defines configuration for the wasm module. + type WASMConfig struct { + // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + QueryGasLimit uint64 `mapstructure:"query_gas_limit"` + + // Address defines the gRPC-web server to listen on + LruSize uint64 `mapstructure:"lru_size"` + } + + type CustomAppConfig struct { + serverconfig.Config + + WASM WASMConfig `mapstructure:"wasm"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In simapp, we set the min gas prices to 0. + srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + WASM: WASMConfig{ + LruSize: 1, + QueryGasLimit: 300000, + }, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + ` +[wasm] +# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +query_gas_limit = 300000 +# This is the number of wasm vm instances we keep cached in memory for speed-up +# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +lru_size = 0` + + return customAppTemplate, customAppConfig +} + +func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, basicManager module.BasicManager) { + cfg := sdk.GetConfig() + cfg.Seal() + + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, simapp.DefaultNodeHome), + sdkdebug.Cmd(), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, simapp.DefaultNodeHome), + snapshot.Cmd(newApp), + server.QueryBlockResultsCmd(), + ) + + server.AddCommands(rootCmd, simapp.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + + // add keybase, auxiliary RPC, query, genesis, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(encodingConfig, basicManager), + txCommand(), + queryCommand(), + keys.Commands(), + ) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) + preCheck := func(cmd *cobra.Command, _ []string) error { + return CheckLibwasmVersion(getExpectedLibwasmVersion()) + } + startCmd.PreRunE = chainPreRuns(preCheck, startCmd.PreRunE) +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + rpc.ValidatorCommand(), + server.QueryBlockCmd(), + authcmd.QueryTxsByEventsCmd(), + server.QueryBlocksCmd(), + authcmd.QueryTxCmd(), + authcmd.GetSimulateCmd(), + ) + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + authcmd.GetSimulateCmd(), + ) + + return cmd +} + +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(encodingConfig params.EncodingConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(encodingConfig.TxConfig, basicManager, simapp.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) + + return simapp.NewSimApp( + logger, db, traceStore, true, + appOpts, nil, + baseappOptions..., + ) +} + +// appExport creates a new simapp (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var simApp *simapp.SimApp + + // this check is necessary as we use the flag in x/upgrade. + // we can exit more gracefully by checking the flag here. + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + if height != -1 { + simApp = simapp.NewSimApp(logger, db, traceStore, false, appOpts, nil) + + if err := simApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } else { + simApp = simapp.NewSimApp(logger, db, traceStore, true, appOpts, nil) + } + + return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} + +var tempDir = func() string { + dir, err := os.MkdirTemp("", "simapp") + if err != nil { + dir = simapp.DefaultNodeHome + } + defer os.RemoveAll(dir) + + return dir +} + +// CheckLibwasmVersion ensures that the libwasmvm version loaded at runtime matches the version +// of the github.com/CosmWasm/wasmvm dependency in go.mod. +// Ref: https://github.com/cosmos/ibc-go/issues/4821#issuecomment-1747240445 +func CheckLibwasmVersion(wasmExpectedVersion string) error { + if wasmExpectedVersion == "" { + return fmt.Errorf("wasmvm module not exist") + } + wasmVersion, err := wasmvm.LibwasmvmVersion() + if err != nil { + return fmt.Errorf("unable to retrieve libwasmversion %w", err) + } + if !strings.Contains(wasmExpectedVersion, wasmVersion) { + return fmt.Errorf("libwasmversion mismatch. got: %s; expected: %s", wasmVersion, wasmExpectedVersion) + } + return nil +} + +type preRunFn func(cmd *cobra.Command, args []string) error + +func chainPreRuns(pfns ...preRunFn) preRunFn { + return func(cmd *cobra.Command, args []string) error { + for _, pfn := range pfns { + if pfn != nil { + if err := pfn(cmd, args); err != nil { + return err + } + } + } + return nil + } +} + +func getExpectedLibwasmVersion() string { + buildInfo, ok := debug.ReadBuildInfo() + if !ok { + panic("can't read build info") + } + for _, d := range buildInfo.Deps { + if d.Path != "github.com/CosmWasm/wasmvm" { + continue + } + if d.Replace != nil { + return d.Replace.Version + } + return d.Version + } + return "" +} diff --git a/modules/light-clients/08-wasm/testing/simapp/simd/main.go b/modules/light-clients/08-wasm/testing/simapp/simd/main.go new file mode 100644 index 00000000000..6ef7da8fd40 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/simd/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + + "cosmossdk.io/log" + + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp/simd/cmd" +) + +func main() { + rootCmd := cmd.NewRootCmd() + if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { + log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err) + os.Exit(1) + } +} diff --git a/modules/light-clients/08-wasm/testing/simapp/test_helpers.go b/modules/light-clients/08-wasm/testing/simapp/test_helpers.go new file mode 100644 index 00000000000..d2c9e5cf678 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/test_helpers.go @@ -0,0 +1,113 @@ +package simapp + +import ( + "encoding/json" + "path/filepath" + "testing" + + dbm "github.com/cosmos/cosmos-db" + "github.com/stretchr/testify/require" + + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + "cosmossdk.io/store/snapshots" + snapshottypes "cosmossdk.io/store/snapshots/types" + + bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/server" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + 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" + + abci "github.com/cometbft/cometbft/abci/types" + cmttypes "github.com/cometbft/cometbft/types" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + "github.com/cosmos/ibc-go/v8/testing/mock" +) + +func setup(tb testing.TB, chainID string, withGenesis bool, invCheckPeriod uint, mockVM ibcwasm.WasmEngine) (*SimApp, GenesisState) { + tb.Helper() + + db := dbm.NewMemDB() + nodeHome := tb.TempDir() + snapshotDir := filepath.Join(nodeHome, "data", "snapshots") + + snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) + require.NoError(tb, err) + tb.Cleanup(func() { snapshotDB.Close() }) + snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) + require.NoError(tb, err) + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = nodeHome // ensure unique folder + appOptions[server.FlagInvCheckPeriod] = invCheckPeriod + app := NewSimApp(log.NewNopLogger(), db, nil, true, appOptions, mockVM, bam.SetChainID(chainID), bam.SetSnapshot(snapshotStore, snapshottypes.SnapshotOptions{KeepRecent: 2})) + + if withGenesis { + return app, app.DefaultGenesis() + } + + return app, GenesisState{} +} + +// SetupWithEmptyStore set up a simapp instance with empty DB +func SetupWithEmptyStore(tb testing.TB, mockVM ibcwasm.WasmEngine) *SimApp { + tb.Helper() + + app, _ := setup(tb, "", false, 0, mockVM) + return app +} + +// SetupWithGenesisValSet initializes a new SimApp 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 in the default token of the simapp from first genesis +// account. A Nop logger is set in SimApp. +func SetupWithGenesisValSetSnapshotter(t *testing.T, mockVM ibcwasm.WasmEngine, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { + t.Helper() + + app, genesisState := setup(t, "", true, 5, mockVM) + genesisState, err := simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, genAccs, balances...) + require.NoError(t, err) + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + + // init chain will set the validator set and initialize the genesis accounts + _, err = app.InitChain(&abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: simtestutil.DefaultConsensusParams, + AppStateBytes: stateBytes, + }) + require.NoError(t, err) + + return app +} + +// SetupWithSnapshotter initializes a new SimApp with a configured snapshot db. A Nop logger is set in SimApp. +func SetupWithSnapshotter(t *testing.T, mockVM ibcwasm.WasmEngine) *SimApp { + t.Helper() + + privVal := mock.NewPV() + pubKey, err := privVal.GetPubKey() + require.NoError(t, err) + + // create validator set with single validator + validator := cmttypes.NewValidator(pubKey, 1) + valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) + + // generate genesis account + senderPrivKey := secp256k1.GenPrivKey() + acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) + balance := banktypes.Balance{ + Address: acc.GetAddress().String(), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), + } + + app := SetupWithGenesisValSetSnapshotter(t, mockVM, valSet, []authtypes.GenesisAccount{acc}, balance) + + return app +} diff --git a/modules/light-clients/08-wasm/testing/simapp/upgrades.go b/modules/light-clients/08-wasm/testing/simapp/upgrades.go new file mode 100644 index 00000000000..b33d1849e3b --- /dev/null +++ b/modules/light-clients/08-wasm/testing/simapp/upgrades.go @@ -0,0 +1,45 @@ +package simapp + +import ( + "context" + + storetypes "cosmossdk.io/store/types" + circuittypes "cosmossdk.io/x/circuit/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/types/module" +) + +const ( + IBCWasmUpgrade = "ibcwasm-v8" +) + +// registerUpgradeHandlers registers all supported upgrade handlers +func (app *SimApp) registerUpgradeHandlers() { + app.UpgradeKeeper.SetUpgradeHandler( + IBCWasmUpgrade, + createWasmStoreUpgradeHandler(app.ModuleManager, app.configurator), + ) + + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(err) + } + + if upgradeInfo.Name == IBCWasmUpgrade && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{ + circuittypes.ModuleName, + }, + } + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } +} + +// createWasmStoreUpgradeHandler creates an upgrade handler for the 08-wasm ibc-go/v8 SimApp upgrade. +func createWasmStoreUpgradeHandler(mm *module.Manager, configurator module.Configurator) upgradetypes.UpgradeHandler { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/modules/light-clients/08-wasm/testing/values.go b/modules/light-clients/08-wasm/testing/values.go new file mode 100644 index 00000000000..e91fa5296a1 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/values.go @@ -0,0 +1,59 @@ +package testing + +import ( + "errors" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + testing "github.com/cosmos/ibc-go/v8/testing" +) + +var ( + // Represents the code of the wasm contract used in the tests with a mock vm. + WasmMagicNumber = []byte("\x00\x61\x73\x6D") + Code = append(WasmMagicNumber, []byte("0123456780123456780123456780")...) + MockClientStateBz = []byte("client-state-data") + MockConsensusStateBz = []byte("consensus-state-data") + MockTendermitClientState = CreateMockTendermintClientState(clienttypes.NewHeight(1, 10)) + MockTendermintClientHeader = &ibctm.Header{} + MockTendermintClientMisbehaviour = ibctm.NewMisbehaviour("client-id", MockTendermintClientHeader, MockTendermintClientHeader) + MockTendermintClientConsensusState = ibctm.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash")), []byte("nextValsHash")) + MockValidProofBz = []byte("valid proof") + MockInvalidProofBz = []byte("invalid proof") + MockUpgradedClientStateProofBz = []byte("upgraded client state proof") + MockUpgradedConsensusStateProofBz = []byte("upgraded consensus state proof") + + ErrMockContract = errors.New("mock contract error") + ErrMockVM = errors.New("mock vm error") +) + +// CreateMockTendermintClientState returns a valid Tendermint client state for use in tests. +func CreateMockTendermintClientState(height clienttypes.Height) *ibctm.ClientState { + return ibctm.NewClientState( + "chain-id", + ibctm.DefaultTrustLevel, + testing.TrustingPeriod, + testing.UnbondingPeriod, + testing.MaxClockDrift, + height, + commitmenttypes.GetSDKSpecs(), + testing.UpgradePath, + ) +} + +// CreateMockClientStateBz returns valid client state bytes for use in tests. +func CreateMockClientStateBz(cdc codec.BinaryCodec, checksum types.Checksum) []byte { + wrappedClientStateBz := clienttypes.MustMarshalClientState(cdc, MockTendermitClientState) + mockClientSate := types.NewClientState(wrappedClientStateBz, checksum, MockTendermitClientState.GetLatestHeight().(clienttypes.Height)) + return clienttypes.MustMarshalClientState(cdc, mockClientSate) +} + +// CreateMockContract returns a well formed (magic number prefixed) wasm contract the given code. +func CreateMockContract(code []byte) []byte { + return append(WasmMagicNumber, code...) +} diff --git a/modules/light-clients/08-wasm/testing/wasm_endpoint.go b/modules/light-clients/08-wasm/testing/wasm_endpoint.go new file mode 100644 index 00000000000..5d391e547a8 --- /dev/null +++ b/modules/light-clients/08-wasm/testing/wasm_endpoint.go @@ -0,0 +1,61 @@ +package testing + +import ( + "github.com/stretchr/testify/require" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibctesting "github.com/cosmos/ibc-go/v8/testing" +) + +// WasmEndpoint is a wrapper around the ibctesting pkg Endpoint struct. +// It will override any functions which require special handling for the wasm client. +type WasmEndpoint struct { + *ibctesting.Endpoint +} + +// NewWasmEndpoint returns a wasm endpoint with the default ibctesting pkg +// Endpoint embedded. +func NewWasmEndpoint(chain *ibctesting.TestChain) *WasmEndpoint { + return &WasmEndpoint{ + Endpoint: ibctesting.NewDefaultEndpoint(chain), + } +} + +// CreateClient creates an wasm client on a mock cometbft chain. +// The client and consensus states are represented by byte slices +// and the starting height is 1. +func (endpoint *WasmEndpoint) CreateClient() error { + checksum, err := types.CreateChecksum(Code) + require.NoError(endpoint.Chain.TB, err) + + wrappedClientStateBz := clienttypes.MustMarshalClientState(endpoint.Chain.App.AppCodec(), CreateMockTendermintClientState(clienttypes.NewHeight(1, 5))) + wrappedClientConsensusStateBz := clienttypes.MustMarshalConsensusState(endpoint.Chain.App.AppCodec(), MockTendermintClientConsensusState) + + clientState := types.NewClientState(wrappedClientStateBz, checksum, clienttypes.NewHeight(0, 1)) + consensusState := types.NewConsensusState(wrappedClientConsensusStateBz) + + msg, err := clienttypes.NewMsgCreateClient( + clientState, consensusState, endpoint.Chain.SenderAccount.GetAddress().String(), + ) + require.NoError(endpoint.Chain.TB, err) + + res, err := endpoint.Chain.SendMsgs(msg) + if err != nil { + return err + } + + endpoint.ClientID, err = ibctesting.ParseClientIDFromEvents(res.Events) + require.NoError(endpoint.Chain.TB, err) + + return nil +} + +// AllowWasmClients adds 08-wasm to the list of allowed clients +func AllowWasmClients(chain *ibctesting.TestChain) { + ctx := chain.GetContext() + clientKeeper := chain.App.GetIBCKeeper().ClientKeeper + params := clientKeeper.GetParams(ctx) + params.AllowedClients = append(params.AllowedClients, types.Wasm) + clientKeeper.SetParams(ctx, params) +} diff --git a/modules/light-clients/08-wasm/types/client_state.go b/modules/light-clients/08-wasm/types/client_state.go index 9a3d035e4bc..434eb9d9f1a 100644 --- a/modules/light-clients/08-wasm/types/client_state.go +++ b/modules/light-clients/08-wasm/types/client_state.go @@ -1,17 +1,17 @@ package types import ( + storetypes "cosmossdk.io/store/types" "encoding/json" "errors" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibcerrors "github.com/cosmos/ibc-go/v7/internal/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ exported.ClientState = (*ClientState)(nil) @@ -27,7 +27,7 @@ func NewClientState(data []byte, codeID []byte, height clienttypes.Height) *Clie // ClientType is wasm. func (cs ClientState) ClientType() string { - return exported.Wasm + return Wasm } // GetLatestHeight returns latest block height. @@ -38,11 +38,23 @@ func (cs ClientState) GetLatestHeight() exported.Height { // Validate performs a basic validation of the client state fields. func (cs ClientState) Validate() error { if len(cs.Data) == 0 { - return sdkerrors.Wrap(ErrInvalidData, "data cannot be empty") + return errorsmod.Wrap(ErrInvalidData, "data cannot be empty") } - if len(cs.CodeId) == 0 { - return sdkerrors.Wrap(ErrInvalidCodeId, "code ID cannot be empty") + if err := ValidateWasmChecksum(cs.CodeId); err != nil { + return err + } + return nil +} + +// ValidateBasic performs a basic validation of the client state fields. +func (cs ClientState) ValidateBasic() error { + if len(cs.Data) == 0 { + return errorsmod.Wrap(ErrInvalidData, "data cannot be empty") + } + + if err := ValidateWasmChecksum(cs.CodeId); err != nil { + return err } return nil @@ -64,7 +76,11 @@ type ( // // A frozen client will become expired, so the Frozen status // has higher precedence. -func (cs ClientState) Status(ctx sdk.Context, clientStore sdk.KVStore, _ codec.BinaryCodec) exported.Status { +func (cs ClientState) Status(ctx sdk.Context, clientStore storetypes.KVStore, _ codec.BinaryCodec) exported.Status { + // Return unauthorized if the checksum hasn't been previously stored via storeWasmCode. + if !HasChecksum(ctx, cs.CodeId) { + return exported.Unauthorized + } status := exported.Unknown payload := statusPayload{Status: statusPayloadInner{}} @@ -93,32 +109,38 @@ func (cs ClientState) ZeroCustomFields() exported.ClientState { func (c ClientState) GetTimestampAtHeight( _ sdk.Context, - clientStore sdk.KVStore, + clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, ) (uint64, error) { // get consensus state at height from clientStore to check for expiry consState, found := GetConsensusState(clientStore, cdc, height) if found != nil { - return 0, sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "height (%s)", height) + return 0, errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "height (%s)", height) } return consState.GetTimestamp(), nil } // Initialize checks that the initial consensus state is an 08-wasm consensus state and // sets the client state, consensus state in the provided client store. -func (cs ClientState) Initialize(context sdk.Context, marshaler codec.BinaryCodec, clientStore sdk.KVStore, state exported.ConsensusState) error { +func (cs ClientState) Initialize(context sdk.Context, marshaler codec.BinaryCodec, clientStore storetypes.KVStore, state exported.ConsensusState) error { consensusState, ok := state.(*ConsensusState) if !ok { - return sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T", + return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T", &ConsensusState{}, state) } setClientState(clientStore, marshaler, &cs) setConsensusState(clientStore, marshaler, consensusState, cs.GetLatestHeight()) - _, err := initContract(cs.CodeId, context, clientStore) + payload := InstantiateMessage{ + ClientState: cs.Data, + ConsensusState: consensusState.Data, + Checksum: cs.CodeId, + } + + _, err := initContract(cs.CodeId, context, clientStore, payload) if err != nil { - return sdkerrors.Wrapf(ErrUnableToInit, "err: %s", err) + return errorsmod.Wrapf(ErrUnableToInit, "err: %s", err) } return nil } @@ -142,7 +164,7 @@ type ( // If a zero proof height is passed in, it will fail to retrieve the associated consensus state. func (cs ClientState) VerifyMembership( ctx sdk.Context, - clientStore sdk.KVStore, + clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, delayTimePeriod uint64, @@ -197,7 +219,7 @@ type ( func (cs ClientState) VerifyNonMembership( ctx sdk.Context, - clientStore sdk.KVStore, + clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, delayTimePeriod uint64, @@ -236,21 +258,21 @@ func (cs ClientState) VerifyNonMembership( } // / Calls the contract with the given payload and writes the result to `output` -func call[T ContractResult](payload any, cs *ClientState, ctx sdk.Context, clientStore sdk.KVStore) (T, error) { +func call[T ContractResult](payload any, cs *ClientState, ctx sdk.Context, clientStore storetypes.KVStore) (T, error) { var output T encodedData, err := json.Marshal(payload) if err != nil { - return output, sdkerrors.Wrapf(ErrUnableToMarshalPayload, "err: %s", err) + return output, errorsmod.Wrapf(ErrUnableToMarshalPayload, "err: %s", err) } out, err := callContract(cs.CodeId, ctx, clientStore, encodedData) if err != nil { - return output, sdkerrors.Wrapf(ErrUnableToCall, "err: %s", err) + return output, errorsmod.Wrapf(ErrUnableToCall, "err: %s", err) } if err := json.Unmarshal(out.Data, &output); err != nil { - return output, sdkerrors.Wrapf(ErrUnableToUnmarshalPayload, "err: %s", err) + return output, errorsmod.Wrapf(ErrUnableToUnmarshalPayload, "err: %s", err) } if !output.Validate() { - return output, sdkerrors.Wrapf(errors.New(output.Error()), "error occurred while calling contract with code ID %s", cs.CodeId) + return output, errorsmod.Wrapf(errors.New(output.Error()), "error occurred while calling contract with code ID %s", cs.CodeId) } return output, nil } diff --git a/modules/light-clients/08-wasm/types/client_state_test.go b/modules/light-clients/08-wasm/types/client_state_test.go index 8723bdd5cb2..3a0f240b2d9 100644 --- a/modules/light-clients/08-wasm/types/client_state_test.go +++ b/modules/light-clients/08-wasm/types/client_state_test.go @@ -1,1174 +1,624 @@ package types_test import ( - "encoding/base64" + "encoding/json" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - tmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - ibcmock "github.com/cosmos/ibc-go/v7/testing/mock" + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + mock "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/mock" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctesting "github.com/cosmos/ibc-go/v8/testing" ) -func (suite *WasmTestSuite) TestStatusTendermint() { - var ( - path *ibctesting.Path - clientState *wasmtypes.ClientState - ) +func (suite *TypesTestSuite) TestStatus() { testCases := []struct { name string malleate func() expStatus exported.Status }{ - {"client is active", func() {}, exported.Active}, - {"client is frozen", func() { - var eClientState exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(clientState.Data, &eClientState) - suite.Require().NoError(err) - - tmClientState := eClientState.(*tmtypes.ClientState) - tmClientState.FrozenHeight = clienttypes.NewHeight(0, 1) - - wasmData, err := suite.chainA.Codec.MarshalInterface(tmClientState) - suite.Require().NoError(err) - - clientState.Data = wasmData - path.EndpointA.SetClientState(clientState) - }, exported.Frozen}, - {"client status without consensus state", func() { - latestHeight := clientState.LatestHeight.Increment().(clienttypes.Height) - var eClientState exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(clientState.Data, &eClientState) - suite.Require().NoError(err) - - tmClientState := eClientState.(*tmtypes.ClientState) - tmClientState.LatestHeight = latestHeight - wasmData, err := suite.chainA.Codec.MarshalInterface(tmClientState) - suite.Require().NoError(err) - - clientState.Data = wasmData - clientState.LatestHeight = latestHeight - path.EndpointA.SetClientState(clientState) - }, exported.Expired}, - {"client status is expired", func() { - var eClientState exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(clientState.Data, &eClientState) - suite.Require().NoError(err) - - suite.coordinator.IncrementTimeBy(eClientState.(*tmtypes.ClientState).TrustingPeriod) - }, exported.Expired}, + { + "client is active", + func() {}, + exported.Active, + }, + { + "client is frozen", + func() { + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.StatusResult{Status: exported.Frozen.String()}) + suite.Require().NoError(err) + return resp, wasmtesting.DefaultGasUsed, nil + }) + }, + exported.Frozen, + }, + { + "client status is expired", + func() { + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.StatusResult{Status: exported.Expired.String()}) + suite.Require().NoError(err) + return resp, wasmtesting.DefaultGasUsed, nil + }) + }, + exported.Expired, + }, + { + "client status is unknown: vm returns an error", + func() { + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) + }, + exported.Unknown, + }, + { + "client status is unauthorized: checksum is not stored", + func() { + err := ibcwasm.Checksums.Remove(suite.chainA.GetContext(), suite.checksum) + suite.Require().NoError(err) + }, + exported.Unauthorized, + }, } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) + suite.SetupWasmWithMockVM() - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - clientState = path.EndpointA.GetClientState().(*wasmtypes.ClientState) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() + suite.Require().NoError(err) tc.malleate() + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientState := endpoint.GetClientState() + status := clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()) suite.Require().Equal(tc.expStatus, status) }) } } -func (suite *WasmTestSuite) TestStatusGrandpa() { +func (suite *TypesTestSuite) TestGetTimestampAtHeight() { + var height exported.Height + + expectedTimestamp := uint64(time.Now().UnixNano()) + testCases := []struct { - name string - malleate func() - expStatus exported.Status + name string + malleate func() + expErr error }{ - {"client is active", func() {}, exported.Active}, - {"client is frozen", func() { - cs, err := base64.StdEncoding.DecodeString(suite.testData["client_state_frozen"]) - suite.Require().NoError(err) - - frozenClientState := wasmtypes.ClientState{ - Data: cs, - CodeId: suite.codeID, - LatestHeight: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 5, - }, - } + { + "success", + func() { + suite.mockVM.RegisterQueryCallback(types.TimestampAtHeightMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + var payload types.QueryMsg + err := json.Unmarshal(queryMsg, &payload) + suite.Require().NoError(err) - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", &frozenClientState) - }, exported.Frozen}, - {"client status without consensus state", func() { - cs, err := base64.StdEncoding.DecodeString(suite.testData["client_state_no_consensus"]) - suite.Require().NoError(err) + suite.Require().NotNil(payload.TimestampAtHeight) + suite.Require().Nil(payload.CheckForMisbehaviour) + suite.Require().Nil(payload.Status) + suite.Require().Nil(payload.ExportMetadata) + suite.Require().Nil(payload.VerifyClientMessage) - clientState := wasmtypes.ClientState{ - Data: cs, - CodeId: suite.codeID, - LatestHeight: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 36, // This doesn't matter, but the grandpa client state is set to this - }, - } + resp, err := json.Marshal(types.TimestampAtHeightResult{Timestamp: expectedTimestamp}) + suite.Require().NoError(err) - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", &clientState) - }, exported.Expired}, - // ics10-grandpa client state doesn't have a trusting period, so this might be removed - /*{"client status is expired", func() { - suite.coordinator.IncrementTimeBy(clientState.TrustingPeriod) - }, exported.Expired},*/ - {"no client state", func() { - suite.SetupWithEmptyClient() - }, exported.Unknown}, + return resp, wasmtesting.DefaultGasUsed, nil + }) + }, + nil, + }, + { + "failure: contract returns error", + func() { + suite.mockVM.RegisterQueryCallback(types.TimestampAtHeightMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) + }, + types.ErrWasmContractCallFailed, + }, + { + "error: invalid height", + func() { + height = mock.Height{} + }, + ibcerrors.ErrInvalidType, + }, } for _, tc := range testCases { tc := tc suite.Run(tc.name, func() { - suite.SetupWithChannel() + suite.SetupWasmWithMockVM() + + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() + suite.Require().NoError(err) + + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientState := endpoint.GetClientState().(*types.ClientState) + height = clientState.GetLatestHeight() + tc.malleate() - status := suite.clientState.Status(suite.ctx, suite.store, suite.chainA.App.AppCodec()) - suite.Require().Equal(tc.expStatus, status) + timestamp, err := clientState.GetTimestampAtHeight(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec(), height) + + expPass := tc.expErr == nil + if expPass { + suite.Require().NoError(err) + suite.Require().Equal(expectedTimestamp, timestamp) + } else { + suite.Require().ErrorIs(err, tc.expErr) + } }) } } -func (suite *WasmTestSuite) TestValidate() { +func (suite *TypesTestSuite) TestValidate() { testCases := []struct { name string - clientState *wasmtypes.ClientState + clientState *types.ClientState expPass bool }{ { name: "valid client", - clientState: wasmtypes.NewClientState([]byte{0}, []byte{0}, clienttypes.Height{}), + clientState: types.NewClientState([]byte{0}, wasmtesting.Code, clienttypes.ZeroHeight()), expPass: true, }, { name: "nil data", - clientState: wasmtypes.NewClientState(nil, []byte{0}, clienttypes.Height{}), + clientState: types.NewClientState(nil, wasmtesting.Code, clienttypes.ZeroHeight()), expPass: false, }, { name: "empty data", - clientState: wasmtypes.NewClientState([]byte{}, []byte{0}, clienttypes.Height{}), + clientState: types.NewClientState([]byte{}, wasmtesting.Code, clienttypes.ZeroHeight()), expPass: false, }, { - name: "nil code id", - clientState: wasmtypes.NewClientState([]byte{0}, nil, clienttypes.Height{}), + name: "nil checksum", + clientState: types.NewClientState([]byte{0}, nil, clienttypes.ZeroHeight()), expPass: false, }, { - name: "empty code id", - clientState: wasmtypes.NewClientState([]byte{0}, []byte{}, clienttypes.Height{}), + name: "empty checksum", + clientState: types.NewClientState([]byte{0}, []byte{}, clienttypes.ZeroHeight()), expPass: false, }, - } - - for _, tc := range testCases { - err := tc.clientState.Validate() - if tc.expPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - } - } -} - -func (suite *WasmTestSuite) TestInitializeGrandpa() { - testCases := []struct { - name string - consensusState exported.ConsensusState - expPass bool - }{ - { - name: "valid consensus", - consensusState: &suite.consensusState, - expPass: true, - }, { - name: "invalid consensus: consensus state is solomachine consensus", - consensusState: ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).ConsensusState(), - expPass: false, + name: "longer than 32 bytes checksum", + clientState: types.NewClientState( + []byte{0}, + []byte{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, + }, + clienttypes.ZeroHeight(), + ), + expPass: false, }, } for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithEmptyClient() // reset - - store := suite.store - err := suite.clientState.Initialize(suite.ctx, suite.chainA.Codec, store, tc.consensusState) - + err := tc.clientState.Validate() if tc.expPass { - suite.Require().NoError(err, "valid case returned an error") - suite.Require().True(store.Has(host.ClientStateKey())) - suite.Require().True(store.Has(host.ConsensusStateKey(suite.clientState.GetLatestHeight()))) + suite.Require().NoError(err, tc.name) } else { - suite.Require().Error(err, "invalid case didn't return an error") - suite.Require().False(store.Has(host.ClientStateKey())) - suite.Require().False(store.Has(host.ConsensusStateKey(suite.clientState.GetLatestHeight()))) + suite.Require().Error(err, tc.name) } }) } } -func (suite *WasmTestSuite) TestInitializeTendermint() { - testCases := []struct { - name string - consensusState exported.ConsensusState - expPass bool - }{ - { - name: "valid consensus", - consensusState: &wasmtypes.ConsensusState{ - Data: []byte{0}, - Timestamp: 1, - }, - expPass: true, - }, - { - name: "invalid consensus: consensus state is solomachine consensus", - consensusState: ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachine", "", 2).ConsensusState(), - expPass: false, - }, - } - - for _, tc := range testCases { - suite.SetupWasmTendermint() - path := ibctesting.NewPath(suite.chainA, suite.chainB) - - tmConfig, ok := path.EndpointB.ClientConfig.(*ibctesting.TendermintConfig) - suite.Require().True(ok) - - tmClientState := tmtypes.NewClientState( - path.EndpointB.Chain.ChainID, - tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift, - suite.chainB.LastHeader.GetTrustedHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, - ) - - wasmData, err := suite.chainA.Codec.MarshalInterface(tmClientState) - suite.Require().NoError(err) - - wasmClientState := wasmtypes.NewClientState(wasmData, suite.codeID, tmClientState.LatestHeight) - - store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - err = wasmClientState.Initialize(suite.chainA.GetContext(), suite.chainA.Codec, store, tc.consensusState) - - if tc.expPass { - suite.Require().NoError(err, "valid case returned an error") - suite.Require().True(store.Has(host.ClientStateKey())) - suite.Require().True(store.Has(host.ConsensusStateKey(suite.chainB.LastHeader.GetTrustedHeight()))) - } else { - suite.Require().Error(err, "invalid case didn't return an error") - suite.Require().False(store.Has(host.ClientStateKey())) - suite.Require().False(store.Has(host.ConsensusStateKey(suite.chainB.LastHeader.GetTrustedHeight()))) - } - } -} - -func (suite *WasmTestSuite) TestVerifyMembershipGrandpa() { +func (suite *TypesTestSuite) TestInitialize() { var ( - clientState exported.ClientState - err error - height exported.Height - path exported.Path - proof []byte - value []byte - delayTimePeriod uint64 - delayBlockPeriod uint64 + consensusState exported.ConsensusState + clientState exported.ClientState + clientStore storetypes.KVStore ) - clientID := "07-tendermint-0" - connectionID := "connection-0" - channelID := "channel-0" - portID := "transfer" - pathPrefix := "ibc/" testCases := []struct { - name string - setup func() - expPass bool + name string + malleate func() + expError error }{ { - "successful ClientState verification", - func() { - }, - true, + "success: new mock client", + func() {}, + nil, }, { - "successful Connection verification", + "success: validate contract address", func() { - clientState = suite.clientState + suite.mockVM.InstantiateFn = func(_ wasmvm.Checksum, env wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var payload types.InstantiateMessage + err := json.Unmarshal(initMsg, &payload) + suite.Require().NoError(err) - height = clienttypes.NewHeight(2000, 11) - key := host.ConnectionPath(connectionID) - merklePath := commitmenttypes.NewMerklePath(key) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - suite.Require().NoError(err) + suite.Require().Equal(env.Contract.Address, defaultWasmClientID) - proof, err = base64.StdEncoding.DecodeString(suite.testData["connection_proof_try"]) - suite.Require().NoError(err) + wrappedClientState := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), payload.ClientState) - value, err = suite.chainA.Codec.Marshal(&types.ConnectionEnd{ - ClientId: clientID, - Counterparty: types.Counterparty{ - ClientId: "08-wasm-0", - ConnectionId: connectionID, - Prefix: suite.chainA.GetPrefix(), - }, - DelayPeriod: 0, - State: types.TRYOPEN, - Versions: []*types.Version{types.DefaultIBCVersion}, - }) - suite.Require().NoError(err) - }, - true, - }, - { - "successful Channel verification", - func() { - clientState = suite.clientState + clientState := types.NewClientState(payload.ClientState, payload.Checksum, wrappedClientState.GetLatestHeight().(clienttypes.Height)) + clientStateBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), clientState) + store.Set(host.ClientStateKey(), clientStateBz) - height = clienttypes.NewHeight(2000, 20) - key := host.ChannelPath(portID, channelID) - merklePath := commitmenttypes.NewMerklePath(key) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) + consensusState := types.NewConsensusState(payload.ConsensusState) + consensusStateBz := clienttypes.MustMarshalConsensusState(suite.chainA.App.AppCodec(), consensusState) + store.Set(host.ConsensusStateKey(clientState.GetLatestHeight()), consensusStateBz) - proof, err = base64.StdEncoding.DecodeString(suite.testData["channel_proof_try"]) - suite.Require().NoError(err) + resp, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) - value, err = suite.chainA.Codec.Marshal(&channeltypes.Channel{ - State: channeltypes.TRYOPEN, - Ordering: channeltypes.UNORDERED, - Counterparty: channeltypes.Counterparty{ - PortId: portID, - ChannelId: channelID, - }, - ConnectionHops: []string{connectionID}, - Version: "ics20-1", - }) - suite.Require().NoError(err) + return &wasmvmtypes.Response{Data: resp}, 0, nil + } }, - true, + nil, }, { - "successful PacketCommitment verification", + "failure: clientStore prefix does not include clientID", func() { - clientState = suite.clientState - - data, err := base64.StdEncoding.DecodeString(suite.testData["packet_commitment_data"]) - suite.Require().NoError(err) - - height = clienttypes.NewHeight(2000, 32) - packet := channeltypes.NewPacket( - data, - 1, portID, channelID, portID, channelID, clienttypes.NewHeight(0, 3000), - 0, - ) - key := host.PacketCommitmentPath(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - merklePath := commitmenttypes.NewMerklePath(key) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["packet_commitment_proof"]) - suite.Require().NoError(err) - - value = channeltypes.CommitPacket(suite.chainA.App.GetIBCKeeper().Codec(), packet) + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), ibctesting.InvalidID) }, - true, + types.ErrWasmContractCallFailed, }, { - "successful Acknowledgement verification", + "failure: invalid consensus state", func() { - clientState = suite.clientState - - data, err := base64.StdEncoding.DecodeString(suite.testData["ack_data"]) - suite.Require().NoError(err) - - height = clienttypes.NewHeight(2000, 29) - packet := channeltypes.NewPacket( - data, - uint64(1), portID, channelID, portID, channelID, clienttypes.NewHeight(2000, 1022), - 1678733040575532477, - ) - key := host.PacketAcknowledgementKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["ack_proof"]) - suite.Require().NoError(err) - - value, err = base64.StdEncoding.DecodeString(suite.testData["ack"]) - suite.Require().NoError(err) - value = channeltypes.CommitAcknowledgement(value) - }, - true, - }, - { - "delay time period has passed", func() { - delayTimePeriod = uint64(time.Second.Nanoseconds()) - }, - true, - }, - { - "delay time period has not passed", func() { - delayTimePeriod = uint64(time.Hour.Nanoseconds()) - }, - true, - }, - { - "delay block period has passed", func() { - delayBlockPeriod = 1 + // set upgraded consensus state to solomachine consensus state + consensusState = &solomachine.ConsensusState{} }, - true, + clienttypes.ErrInvalidConsensus, }, { - "delay block period has not passed", func() { - delayBlockPeriod = 1000 + "failure: checksum has not been stored.", + func() { + clientState = types.NewClientState([]byte{1}, []byte("unknown"), clienttypes.NewHeight(0, 1)) }, - true, - }, - { - "latest client height < height", func() { - height = height.Increment() - }, false, + types.ErrInvalidChecksum, }, { - "invalid path type", + "failure: InstantiateFn returns error", func() { - path = ibcmock.KeyPath{} + suite.mockVM.InstantiateFn = func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + } }, - false, - }, - { - "failed to unmarshal merkle proof", func() { - proof = []byte("invalid proof") - }, false, - }, - { - "consensus state not found", func() { - height = clienttypes.ZeroHeight() - }, false, - }, - { - "proof verification failed", func() { - // change the value being proved - value = []byte("invalid value") - }, false, + types.ErrWasmContractCallFailed, }, } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { - suite.SetupWithChannel() // reset - clientState = suite.clientState - - delayTimePeriod = 0 - delayBlockPeriod = 0 - height = clienttypes.NewHeight(2000, 11) - key := host.FullClientStateKey(clientID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) + suite.SetupWasmWithMockVM() - proof, err = base64.StdEncoding.DecodeString(suite.testData["client_state_proof"]) - suite.Require().NoError(err) + wrappedClientStateBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), wasmtesting.MockTendermitClientState) + wrappedClientConsensusStateBz := clienttypes.MustMarshalConsensusState(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientConsensusState) + clientState = types.NewClientState(wrappedClientStateBz, suite.checksum, wasmtesting.MockTendermitClientState.GetLatestHeight().(clienttypes.Height)) + consensusState = types.NewConsensusState(wrappedClientConsensusStateBz) - value, err = suite.chainA.Codec.MarshalInterface(&tmtypes.ClientState{ - ChainId: "simd", - TrustLevel: tmtypes.Fraction{ - Numerator: 1, - Denominator: 3, - }, - TrustingPeriod: time.Second * 64000, - UnbondingPeriod: time.Second * 1814400, - MaxClockDrift: time.Second * 15, - FrozenHeight: clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: 0, - }, - LatestHeight: clienttypes.Height{ - RevisionNumber: 0, - RevisionHeight: 46, - }, - ProofSpecs: commitmenttypes.GetSDKSpecs(), - UpgradePath: []string{"upgrade", "upgradedIBCState"}, - AllowUpdateAfterExpiry: false, - AllowUpdateAfterMisbehaviour: false, - }) - suite.Require().NoError(err) + clientID := suite.chainA.App.GetIBCKeeper().ClientKeeper.GenerateClientIdentifier(suite.chainA.GetContext(), clientState.ClientType()) + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), clientID) - tc.setup() + tc.malleate() - err = clientState.VerifyMembership( - suite.ctx, suite.store, suite.chainA.Codec, - height, delayTimePeriod, delayBlockPeriod, - proof, path, value, - ) + err := clientState.Initialize(suite.chainA.GetContext(), suite.chainA.Codec, clientStore, consensusState) - if tc.expPass { + expPass := tc.expError == nil + if expPass { suite.Require().NoError(err) + + expClientState := clienttypes.MustMarshalClientState(suite.chainA.Codec, clientState) + suite.Require().Equal(expClientState, clientStore.Get(host.ClientStateKey())) + + expConsensusState := clienttypes.MustMarshalConsensusState(suite.chainA.Codec, consensusState) + suite.Require().Equal(expConsensusState, clientStore.Get(host.ConsensusStateKey(clientState.GetLatestHeight()))) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expError) } }) } } -func (suite *WasmTestSuite) TestVerifyMembershipTendermint() { +func (suite *TypesTestSuite) TestVerifyMembership() { var ( - testingpath *ibctesting.Path - delayTimePeriod uint64 - delayBlockPeriod uint64 - err error - proofHeight exported.Height - proof []byte + clientState exported.ClientState + expClientStateBz []byte path exported.Path + proof []byte + proofHeight exported.Height value []byte ) testCases := []struct { name string malleate func() - expPass bool + expError error }{ { - "successful ClientState verification", + "success", func() { - // default proof construction uses ClientState - }, - true, - }, - { - "successful ConsensusState verification", func() { - key := host.FullConsensusStateKey(testingpath.EndpointB.ClientID, testingpath.EndpointB.GetClientState().GetLatestHeight()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - - consensusState := testingpath.EndpointB.GetConsensusState(testingpath.EndpointB.GetClientState().GetLatestHeight()).(*wasmtypes.ConsensusState) - value, err = suite.chainB.Codec.MarshalInterface(consensusState) - suite.Require().NoError(err) - }, - true, - }, - { - "successful Connection verification", func() { - key := host.ConnectionKey(testingpath.EndpointB.ConnectionID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - - connection := testingpath.EndpointB.GetConnection() - value, err = suite.chainB.Codec.Marshal(&connection) - suite.Require().NoError(err) - }, - true, - }, - { - "successful Channel verification", func() { - key := host.ChannelKey(testingpath.EndpointB.ChannelConfig.PortID, testingpath.EndpointB.ChannelID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - - channel := testingpath.EndpointB.GetChannel() - value, err = suite.chainB.Codec.Marshal(&channel) - suite.Require().NoError(err) - }, - true, - }, - { - "successful PacketCommitment verification", func() { - // send from chainB to chainA since we are proving chainB sent a packet - sequence, err := testingpath.EndpointB.SendPacket(clienttypes.NewHeight(1, 100), 0, ibctesting.MockPacketData) - suite.Require().NoError(err) - - // make packet commitment proof - packet := channeltypes.NewPacket(ibctesting.MockPacketData, sequence, testingpath.EndpointB.ChannelConfig.PortID, testingpath.EndpointB.ChannelID, testingpath.EndpointA.ChannelConfig.PortID, testingpath.EndpointA.ChannelID, clienttypes.NewHeight(1, 100), 0) - key := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) - - value = channeltypes.CommitPacket(suite.chainA.App.GetIBCKeeper().Codec(), packet) - }, true, - }, - { - "successful Acknowledgement verification", func() { - // send from chainA to chainB since we are proving chainB wrote an acknowledgement - sequence, err := testingpath.EndpointA.SendPacket(clienttypes.NewHeight(1, 100), 0, ibctesting.MockPacketData) - suite.Require().NoError(err) - - // write receipt and ack - packet := channeltypes.NewPacket(ibctesting.MockPacketData, sequence, testingpath.EndpointA.ChannelConfig.PortID, testingpath.EndpointA.ChannelID, testingpath.EndpointB.ChannelConfig.PortID, testingpath.EndpointB.ChannelID, clienttypes.NewHeight(1, 100), 0) - err = testingpath.EndpointB.RecvPacket(packet) - suite.Require().NoError(err) - - key := host.PacketAcknowledgementKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) - - value = channeltypes.CommitAcknowledgement(ibcmock.MockAcknowledgement.Acknowledgement()) + expClientStateBz = GetSimApp(suite.chainA).GetIBCKeeper().ClientKeeper.MustMarshalClientState(clientState) + suite.mockVM.RegisterSudoCallback(types.VerifyMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, _ wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + suite.Require().NotNil(payload.VerifyMembership) + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyNonMembership) + suite.Require().Nil(payload.VerifyUpgradeAndUpdateState) + suite.Require().Equal(proofHeight, payload.VerifyMembership.Height) + suite.Require().Equal(path, payload.VerifyMembership.Path) + suite.Require().Equal(proof, payload.VerifyMembership.Proof) + suite.Require().Equal(value, payload.VerifyMembership.Value) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, }, { - "successful NextSequenceRecv verification", func() { - // send from chainA to chainB since we are proving chainB incremented the sequence recv - - // send packet - sequence, err := testingpath.EndpointA.SendPacket(clienttypes.NewHeight(1, 100), 0, ibctesting.MockPacketData) - suite.Require().NoError(err) - - // next seq recv incremented - packet := channeltypes.NewPacket(ibctesting.MockPacketData, sequence, testingpath.EndpointA.ChannelConfig.PortID, testingpath.EndpointA.ChannelID, testingpath.EndpointB.ChannelConfig.PortID, testingpath.EndpointB.ChannelID, clienttypes.NewHeight(1, 100), 0) - err = testingpath.EndpointB.RecvPacket(packet) - suite.Require().NoError(err) - - key := host.NextSequenceRecvKey(packet.GetSourcePort(), packet.GetSourceChannel()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) - - value = sdk.Uint64ToBigEndian(packet.GetSequence() + 1) + "success: with update client state", + func() { + suite.mockVM.RegisterSudoCallback(types.VerifyMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + suite.Require().NotNil(payload.VerifyMembership) + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyNonMembership) + suite.Require().Nil(payload.VerifyUpgradeAndUpdateState) + suite.Require().Equal(proofHeight, payload.VerifyMembership.Height) + suite.Require().Equal(path, payload.VerifyMembership.Path) + suite.Require().Equal(proof, payload.VerifyMembership.Proof) + suite.Require().Equal(value, payload.VerifyMembership.Value) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + expClientStateBz = wasmtesting.CreateMockClientStateBz(suite.chainA.Codec, suite.checksum) + store.Set(host.ClientStateKey(), expClientStateBz) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, }, { - "successful verification outside IBC store", func() { - key := transfertypes.PortKey - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(commitmenttypes.NewMerklePrefix([]byte(transfertypes.StoreKey)), merklePath) - suite.Require().NoError(err) - - clientState := testingpath.EndpointA.GetClientState() - proof, proofHeight = suite.chainB.QueryProofForStore(transfertypes.StoreKey, key, int64(clientState.GetLatestHeight().GetRevisionHeight())) + "wasm vm returns invalid proof error", + func() { + proof = wasmtesting.MockInvalidProofBz - value = []byte(suite.chainB.GetSimApp().TransferKeeper.GetPort(suite.chainB.GetContext())) - suite.Require().NoError(err) - }, - true, - }, - { - "delay time period has passed", func() { - delayTimePeriod = uint64(time.Second.Nanoseconds()) - }, - true, - }, - { - "delay time period has not passed", func() { - delayTimePeriod = uint64(time.Hour.Nanoseconds()) + suite.mockVM.RegisterSudoCallback(types.VerifyMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + return nil, wasmtesting.DefaultGasUsed, commitmenttypes.ErrInvalidProof + }) }, - false, + types.ErrWasmContractCallFailed, }, { - "delay block period has passed", func() { - delayBlockPeriod = 1 + "proof height greater than client state latest height", + func() { + proofHeight = clienttypes.NewHeight(1, 100) }, - true, + ibcerrors.ErrInvalidHeight, }, { - "delay block period has not passed", func() { - delayBlockPeriod = 1000 + "invalid path argument", + func() { + path = mock.KeyPath{} }, - false, - }, - { - "latest client height < height", func() { - proofHeight = testingpath.EndpointA.GetClientState().GetLatestHeight().Increment() - }, false, + ibcerrors.ErrInvalidType, }, { - "invalid path type", + "proof height is invalid type", func() { - path = ibcmock.KeyPath{} + proofHeight = mock.Height{} }, - false, - }, - { - "failed to unmarshal merkle proof", func() { - proof = []byte("invalid proof") - }, false, - }, - { - "consensus state not found", func() { - proofHeight = clienttypes.ZeroHeight() - }, false, - }, - { - "proof verification failed", func() { - // change the value being proved - value = []byte("invalid value") - }, false, - }, - { - "proof is empty", func() { - // change the inserted proof - proof = []byte{} - }, false, + ibcerrors.ErrInvalidType, }, } for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() // reset - testingpath = ibctesting.NewPath(suite.chainA, suite.chainB) - testingpath.SetChannelOrdered() - suite.coordinator.Setup(testingpath) - - // reset time and block delays to 0, malleate may change to a specific non-zero value. - delayTimePeriod = 0 - delayBlockPeriod = 0 - - // create default proof, merklePath, and value which passes - // may be overwritten by malleate() - key := host.FullClientStateKey(testingpath.EndpointB.ClientID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) + suite.SetupWasmWithMockVM() - clientState := testingpath.EndpointB.GetClientState().(*wasmtypes.ClientState) - value, err = suite.chainB.Codec.MarshalInterface(clientState) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() suite.Require().NoError(err) - tc.malleate() // make changes as necessary + path = commitmenttypes.NewMerklePath("/ibc/key/path") + proof = wasmtesting.MockValidProofBz + proofHeight = clienttypes.NewHeight(0, 1) + value = []byte("value") - clientState = testingpath.EndpointA.GetClientState().(*wasmtypes.ClientState) + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientState = endpoint.GetClientState() - ctx := suite.chainA.GetContext() - store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, testingpath.EndpointA.ClientID) + tc.malleate() - err = clientState.VerifyMembership( - ctx, store, suite.chainA.Codec, proofHeight, delayTimePeriod, delayBlockPeriod, - proof, path, value, - ) + err = clientState.VerifyMembership(suite.chainA.GetContext(), clientStore, suite.chainA.Codec, proofHeight, 0, 0, proof, path, value) - if tc.expPass { + expPass := tc.expError == nil + if expPass { suite.Require().NoError(err) + + clientStateBz := clientStore.Get(host.ClientStateKey()) + suite.Require().Equal(expClientStateBz, clientStateBz) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expError, "unexpected error in VerifyMembership") } }) } } -func (suite *WasmTestSuite) TestVerifyNonMembershipGrandpa() { +func (suite *TypesTestSuite) TestVerifyNonMembership() { var ( clientState exported.ClientState - err error - height exported.Height + expClientStateBz []byte path exported.Path proof []byte - delayTimePeriod uint64 - delayBlockPeriod uint64 - ) - clientID := "07-tendermint-0" - portID := "transfer" - invalidClientID := "09-tendermint-0" - invalidConnectionID := "connection-100" - invalidChannelID := "channel-800" - pathPrefix := "ibc/" - - testCases := []struct { - name string - setup func() - expPass bool - }{ - { - "successful ClientState verification of non membership", - func() { - }, - true, - }, - { - "successful ConsensusState verification of non membership", func() { - height = clienttypes.NewHeight(2000, 11) - key := host.FullConsensusStateKey(invalidClientID, suite.clientState.GetLatestHeight()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["client_state_proof"]) - suite.Require().NoError(err) - }, - true, - }, - { - "successful Connection verification of non membership", func() { - height = clienttypes.NewHeight(2000, 11) - key := host.ConnectionKey(invalidConnectionID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["connection_proof_try"]) - suite.Require().NoError(err) - }, - true, - }, - { - "successful Channel verification of non membership", func() { - height = clienttypes.NewHeight(2000, 20) - key := host.ChannelKey(portID, invalidChannelID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["channel_proof_try"]) - suite.Require().NoError(err) - }, - true, - }, - { - "successful PacketCommitment verification of non membership", func() { - height = clienttypes.NewHeight(2000, 32) - key := host.PacketCommitmentKey(portID, invalidChannelID, 1) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["packet_commitment_proof"]) - suite.Require().NoError(err) - }, true, - }, - { - "successful Acknowledgement verification of non membership", func() { - height = clienttypes.NewHeight(2000, 29) - key := host.PacketAcknowledgementKey(portID, invalidChannelID, 1) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["ack_proof"]) - suite.Require().NoError(err) - }, - true, - }, - { - "delay time period has passed", func() { - delayTimePeriod = uint64(time.Second.Nanoseconds()) - }, - true, - }, - { - "delay time period has not passed", func() { - delayTimePeriod = uint64(time.Hour.Nanoseconds()) - }, - true, - }, - { - "delay block period has passed", func() { - delayBlockPeriod = 1 - }, - true, - }, - { - "delay block period has not passed", func() { - delayBlockPeriod = 1000 - }, - true, - }, - { - "latest client height < height", func() { - height = clientState.GetLatestHeight().Increment() - }, false, - }, - { - "invalid path type", - func() { - path = ibcmock.KeyPath{} - }, - false, - }, - { - "failed to unmarshal merkle proof", func() { - proof = []byte("invalid proof") - }, false, - }, - { - "consensus state not found", func() { - height = clienttypes.ZeroHeight() - }, false, - }, - { - "verify non membership fails as path exists", func() { - height = clienttypes.NewHeight(2000, 11) - // change the value being proved - key := host.FullClientStateKey(clientID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - - proof, err = base64.StdEncoding.DecodeString(suite.testData["client_state_proof"]) - suite.Require().NoError(err) - }, false, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithChannel() // reset - - clientState = suite.clientState - delayTimePeriod = 0 - delayBlockPeriod = 0 - height = clienttypes.NewHeight(2000, 11) - key := host.FullClientStateKey(invalidClientID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path = commitmenttypes.NewMerklePath(append([]string{pathPrefix}, merklePath.KeyPath...)...) - proof, err = base64.StdEncoding.DecodeString(suite.testData["client_state_proof"]) - suite.Require().NoError(err) - tc.setup() - - err = clientState.VerifyNonMembership( - suite.ctx, suite.store, suite.chainA.Codec, - height, delayTimePeriod, delayBlockPeriod, - proof, path, - ) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *WasmTestSuite) TestVerifyNonMembershipTendermint() { - var ( - testingpath *ibctesting.Path - delayTimePeriod uint64 - delayBlockPeriod uint64 - err error - proofHeight exported.Height - path exported.Path - proof []byte - invalidClientID = "09-tendermint" - invalidConnectionID = "connection-100" - invalidChannelID = "channel-800" - invalidPortID = "invalid-port" + proofHeight exported.Height ) testCases := []struct { name string malleate func() - expPass bool + expError error }{ { - "successful ClientState verification of non membership", + "success", func() { - // default proof construction uses ClientState - }, - true, - }, - { - "successful ConsensusState verification of non membership", func() { - key := host.FullConsensusStateKey(invalidClientID, testingpath.EndpointB.GetClientState().GetLatestHeight()) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - }, - true, - }, - { - "successful Connection verification of non membership", func() { - key := host.ConnectionKey(invalidConnectionID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - }, - true, - }, - { - "successful Channel verification of non membership", func() { - key := host.ChannelKey(testingpath.EndpointB.ChannelConfig.PortID, invalidChannelID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - }, - true, - }, - { - "successful PacketCommitment verification of non membership", func() { - // make packet commitment proof - key := host.PacketCommitmentKey(invalidPortID, invalidChannelID, 1) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) - }, true, - }, - { - "successful Acknowledgement verification of non membership", func() { - key := host.PacketAcknowledgementKey(invalidPortID, invalidChannelID, 1) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) + expClientStateBz = GetSimApp(suite.chainA).GetIBCKeeper().ClientKeeper.MustMarshalClientState(clientState) + suite.mockVM.RegisterSudoCallback(types.VerifyNonMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, _ wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + suite.Require().NotNil(payload.VerifyNonMembership) + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyMembership) + suite.Require().Nil(payload.VerifyUpgradeAndUpdateState) + suite.Require().Equal(proofHeight, payload.VerifyNonMembership.Height) + suite.Require().Equal(path, payload.VerifyNonMembership.Path) + suite.Require().Equal(proof, payload.VerifyNonMembership.Proof) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, }, { - "successful NextSequenceRecv verification of non membership", func() { - key := host.NextSequenceRecvKey(invalidPortID, invalidChannelID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = testingpath.EndpointB.QueryProof(key) + "success: with update client state", + func() { + suite.mockVM.RegisterSudoCallback(types.VerifyNonMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + suite.Require().NotNil(payload.VerifyNonMembership) + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyMembership) + suite.Require().Nil(payload.VerifyUpgradeAndUpdateState) + suite.Require().Equal(proofHeight, payload.VerifyNonMembership.Height) + suite.Require().Equal(path, payload.VerifyNonMembership.Path) + suite.Require().Equal(proof, payload.VerifyNonMembership.Proof) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + expClientStateBz = wasmtesting.CreateMockClientStateBz(suite.chainA.Codec, suite.checksum) + store.Set(host.ClientStateKey(), expClientStateBz) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, }, { - "successful verification of non membership outside IBC store", func() { - key := []byte{0x08} - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(commitmenttypes.NewMerklePrefix([]byte(transfertypes.StoreKey)), merklePath) - suite.Require().NoError(err) + "wasm vm returns invalid proof error", + func() { + proof = wasmtesting.MockInvalidProofBz - clientState := testingpath.EndpointA.GetClientState() - proof, proofHeight = suite.chainB.QueryProofForStore(transfertypes.StoreKey, key, int64(clientState.GetLatestHeight().GetRevisionHeight())) - }, - true, - }, - { - "delay time period has passed", func() { - delayTimePeriod = uint64(time.Second.Nanoseconds()) - }, - true, - }, - { - "delay time period has not passed", func() { - delayTimePeriod = uint64(time.Hour.Nanoseconds()) + suite.mockVM.RegisterSudoCallback(types.VerifyNonMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + return nil, wasmtesting.DefaultGasUsed, commitmenttypes.ErrInvalidProof + }) }, - false, + types.ErrWasmContractCallFailed, }, { - "delay block period has passed", func() { - delayBlockPeriod = 1 + "proof height greater than client state latest height", + func() { + proofHeight = clienttypes.NewHeight(1, 100) }, - true, + ibcerrors.ErrInvalidHeight, }, { - "delay block period has not passed", func() { - delayBlockPeriod = 1000 + "invalid path argument", + func() { + path = mock.KeyPath{} }, - false, - }, - { - "latest client height < height", func() { - proofHeight = testingpath.EndpointA.GetClientState().GetLatestHeight().Increment() - }, false, + ibcerrors.ErrInvalidType, }, { - "invalid path type", + "proof height is invalid type", func() { - path = ibcmock.KeyPath{} + proofHeight = mock.Height{} }, - false, - }, - { - "failed to unmarshal merkle proof", func() { - proof = []byte("invalid proof") - }, false, - }, - { - "consensus state not found", func() { - proofHeight = clienttypes.ZeroHeight() - }, false, - }, - { - "verify non membership fails as path exists", func() { - // change the value being proved - key := host.FullClientStateKey(testingpath.EndpointB.ClientID) - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) - suite.Require().NoError(err) - - proof, proofHeight = suite.chainB.QueryProof(key) - }, false, - }, - { - "proof is empty", func() { - // change the inserted proof - proof = []byte{} - }, false, + ibcerrors.ErrInvalidType, }, } for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() // reset - testingpath = ibctesting.NewPath(suite.chainA, suite.chainB) - testingpath.SetChannelOrdered() - suite.coordinator.Setup(testingpath) + suite.SetupWasmWithMockVM() - // reset time and block delays to 0, malleate may change to a specific non-zero value. - delayTimePeriod = 0 - delayBlockPeriod = 0 - - // create default proof, merklePath, and value which passes - // may be overwritten by malleate() - key := host.FullClientStateKey("invalid-client-id") - - merklePath := commitmenttypes.NewMerklePath(string(key)) - path, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() suite.Require().NoError(err) - proof, proofHeight = suite.chainB.QueryProof(key) - - tc.malleate() // make changes as necessary + path = commitmenttypes.NewMerklePath("/ibc/key/path") + proof = wasmtesting.MockInvalidProofBz + proofHeight = clienttypes.NewHeight(0, 1) - clientState := testingpath.EndpointA.GetClientState().(*wasmtypes.ClientState) + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientState = endpoint.GetClientState() - ctx := suite.chainA.GetContext() - store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, testingpath.EndpointA.ClientID) + tc.malleate() - err = clientState.VerifyNonMembership( - ctx, store, suite.chainA.Codec, proofHeight, delayTimePeriod, delayBlockPeriod, - proof, path, - ) + err = clientState.VerifyNonMembership(suite.chainA.GetContext(), clientStore, suite.chainA.Codec, proofHeight, 0, 0, proof, path) - if tc.expPass { + expPass := tc.expError == nil + if expPass { suite.Require().NoError(err) + + clientStateBz := clientStore.Get(host.ClientStateKey()) + suite.Require().Equal(expClientStateBz, clientStateBz) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expError, "unexpected error in VerifyNonMembership") } }) } diff --git a/modules/light-clients/08-wasm/types/codec.go b/modules/light-clients/08-wasm/types/codec.go index 6ca0d3c8e6c..1c792a7a7d3 100644 --- a/modules/light-clients/08-wasm/types/codec.go +++ b/modules/light-clients/08-wasm/types/codec.go @@ -6,10 +6,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -61,10 +58,4 @@ func init() { RegisterLegacyAminoCodec(amino) cryptocodec.RegisterCrypto(amino) sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) } diff --git a/modules/light-clients/08-wasm/types/config.go b/modules/light-clients/08-wasm/types/config.go new file mode 100644 index 00000000000..da4ac531cd0 --- /dev/null +++ b/modules/light-clients/08-wasm/types/config.go @@ -0,0 +1,42 @@ +package types + +import "path/filepath" + +const ( + // ContractMemoryLimit is the memory limit of each contract execution (in MiB) + // constant value so all nodes run with the same limit. + ContractMemoryLimit = 32 + // MemoryCacheSize is the size of the wasm vm cache (in MiB), it is set to 0 to reduce unnecessary memory usage. + // See: https://github.com/CosmWasm/cosmwasm/pull/1925 + MemoryCacheSize = 0 + + defaultDataDir string = "ibc_08-wasm_client_data" + defaultSupportedCapabilities string = "iterator" + defaultContractDebugMode = false +) + +// WasmConfig defines configuration parameters for the 08-wasm wasm virtual machine instance. +// It includes the `dataDir` intended to be used for wasm blobs and internal caches, as well as a comma separated list +// of features or capabilities the user wishes to enable. A boolean flag is provided to enable debug mode. +type WasmConfig struct { + // DataDir is the directory for Wasm blobs and various caches + DataDir string + // SupportedCapabilities is a comma separated list of capabilities supported by the chain + // See https://github.com/CosmWasm/wasmd/blob/e5049ba686ab71164a01f6e71e54347710a1f740/app/wasm.go#L3-L15 + // for more information. + SupportedCapabilities string + // ContractDebugMode is a flag to log what contracts print. It must be false on all + // production nodes, and only enabled in test environments or debug non-validating nodes. + ContractDebugMode bool +} + +// DefaultWasmConfig returns the default settings for WasmConfig. +// The homePath is the path to the directory where the data directory for +// Wasm blobs and caches will be stored. +func DefaultWasmConfig(homePath string) WasmConfig { + return WasmConfig{ + DataDir: filepath.Join(homePath, defaultDataDir), + SupportedCapabilities: defaultSupportedCapabilities, + ContractDebugMode: defaultContractDebugMode, + } +} diff --git a/modules/light-clients/08-wasm/types/consensus_state.go b/modules/light-clients/08-wasm/types/consensus_state.go index 0198c5e58d5..857374d5ab0 100644 --- a/modules/light-clients/08-wasm/types/consensus_state.go +++ b/modules/light-clients/08-wasm/types/consensus_state.go @@ -1,31 +1,31 @@ package types import ( - "fmt" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ exported.ConsensusState = (*ConsensusState)(nil) func (m ConsensusState) ClientType() string { - return exported.Wasm + return Wasm } func (m ConsensusState) GetTimestamp() uint64 { - return m.Timestamp + return 0 } func (m ConsensusState) ValidateBasic() error { - if m.Timestamp == 0 { - return sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "timestamp cannot be zero Unix time") - } - - if m.Data == nil || len(m.Data) == 0 { - return fmt.Errorf("data cannot be empty") + if len(m.Data) == 0 { + return errorsmod.Wrap(ErrInvalidData, "data cannot be empty") } return nil } + +// NewConsensusState creates a new ConsensusState instance. +func NewConsensusState(data []byte) *ConsensusState { + return &ConsensusState{ + Data: data, + } +} diff --git a/modules/light-clients/08-wasm/types/consensus_state_test.go b/modules/light-clients/08-wasm/types/consensus_state_test.go index 467b3f3b88a..76a75be6525 100644 --- a/modules/light-clients/08-wasm/types/consensus_state_test.go +++ b/modules/light-clients/08-wasm/types/consensus_state_test.go @@ -1,11 +1,10 @@ package types_test import ( - "github.com/cosmos/ibc-go/v7/modules/core/exported" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ) -func (suite *WasmTestSuite) TestConsensusStateValidateBasic() { +func (suite *TypesTestSuite) TestConsensusStateValidateBasic() { testCases := []struct { name string consensusState *types.ConsensusState @@ -13,49 +12,32 @@ func (suite *WasmTestSuite) TestConsensusStateValidateBasic() { }{ { "success", - &types.ConsensusState{ - Timestamp: uint64(suite.now.Unix()), - Data: []byte("data"), - }, + types.NewConsensusState([]byte("data")), true, }, - { - "timestamp is zero", - &types.ConsensusState{ - Timestamp: 0, - Data: []byte("data"), - }, - false, - }, { "data is nil", - &types.ConsensusState{ - Timestamp: uint64(suite.now.Unix()), - Data: nil, - }, + types.NewConsensusState(nil), false, }, { "data is empty", - &types.ConsensusState{ - Timestamp: uint64(suite.now.Unix()), - Data: []byte(""), - }, + types.NewConsensusState([]byte{}), false, }, } - for i, tc := range testCases { - tc := tc - - // check just to increase coverage - suite.Require().Equal(exported.Wasm, tc.consensusState.ClientType()) + for _, tc := range testCases { + suite.Run(tc.name, func() { + // check just to increase coverage + suite.Require().Equal(types.Wasm, tc.consensusState.ClientType()) - err := tc.consensusState.ValidateBasic() - if tc.expectPass { - suite.Require().NoError(err, "valid test case %d failed: %s", i, tc.name) - } else { - suite.Require().Error(err, "invalid test case %d passed: %s", i, tc.name) - } + err := tc.consensusState.ValidateBasic() + if tc.expectPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + }) } } diff --git a/modules/light-clients/08-wasm/types/contract_api.go b/modules/light-clients/08-wasm/types/contract_api.go new file mode 100644 index 00000000000..993b17d4abf --- /dev/null +++ b/modules/light-clients/08-wasm/types/contract_api.go @@ -0,0 +1,129 @@ +package types + +import ( + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" +) + +// InstantiateMessage is the message that is sent to the contract's instantiate entry point. +type InstantiateMessage struct { + ClientState []byte `json:"client_state"` + ConsensusState []byte `json:"consensus_state"` + Checksum []byte `json:"checksum"` +} + +// QueryMsg is used to encode messages that are sent to the contract's query entry point. +// The json omitempty tag is mandatory since it omits any empty (default initialized) fields from the encoded JSON, +// this is required in order to be compatible with Rust's enum matching as used in the contract. +// Only one field should be set at a time. +type QueryMsg struct { + Status *StatusMsg `json:"status,omitempty"` + ExportMetadata *ExportMetadataMsg `json:"export_metadata,omitempty"` + TimestampAtHeight *TimestampAtHeightMsg `json:"timestamp_at_height,omitempty"` + VerifyClientMessage *VerifyClientMessageMsg `json:"verify_client_message,omitempty"` + CheckForMisbehaviour *CheckForMisbehaviourMsg `json:"check_for_misbehaviour,omitempty"` +} + +// StatusMsg is a queryMsg sent to the contract to query the status of the wasm client. +type StatusMsg struct{} + +// ExportMetadataMsg is a queryMsg sent to the contract to query the exported metadata of the wasm client. +type ExportMetadataMsg struct{} + +// TimestampAtHeightMsg is a queryMsg sent to the contract to query the timestamp at a given height. +type TimestampAtHeightMsg struct { + Height clienttypes.Height `json:"height"` +} + +// VerifyClientMessageMsg is a queryMsg sent to the contract to verify a client message. +type VerifyClientMessageMsg struct { + ClientMessage []byte `json:"client_message"` +} + +// CheckForMisbehaviourMsg is a queryMsg sent to the contract to check for misbehaviour. +type CheckForMisbehaviourMsg struct { + ClientMessage []byte `json:"client_message"` +} + +// SudoMsg is used to encode messages that are sent to the contract's sudo entry point. +// The json omitempty tag is mandatory since it omits any empty (default initialized) fields from the encoded JSON, +// this is required in order to be compatible with Rust's enum matching as used in the contract. +// Only one field should be set at a time. +type SudoMsg struct { + UpdateState *UpdateStateMsg `json:"update_state,omitempty"` + UpdateStateOnMisbehaviour *UpdateStateOnMisbehaviourMsg `json:"update_state_on_misbehaviour,omitempty"` + VerifyUpgradeAndUpdateState *VerifyUpgradeAndUpdateStateMsg `json:"verify_upgrade_and_update_state,omitempty"` + VerifyMembership *VerifyMembershipMsg `json:"verify_membership,omitempty"` + VerifyNonMembership *VerifyNonMembershipMsg `json:"verify_non_membership,omitempty"` + MigrateClientStore *MigrateClientStoreMsg `json:"migrate_client_store,omitempty"` +} + +// UpdateStateMsg is a sudoMsg sent to the contract to update the client state. +type UpdateStateMsg struct { + ClientMessage []byte `json:"client_message"` +} + +// UpdateStateOnMisbehaviourMsg is a sudoMsg sent to the contract to update its state on misbehaviour. +type UpdateStateOnMisbehaviourMsg struct { + ClientMessage []byte `json:"client_message"` +} + +// VerifyMembershipMsg is a sudoMsg sent to the contract to verify a membership proof. +type VerifyMembershipMsg struct { + Height clienttypes.Height `json:"height"` + DelayTimePeriod uint64 `json:"delay_time_period"` + DelayBlockPeriod uint64 `json:"delay_block_period"` + Proof []byte `json:"proof"` + Path commitmenttypes.MerklePath `json:"path"` + Value []byte `json:"value"` +} + +// VerifyNonMembershipMsg is a sudoMsg sent to the contract to verify a non-membership proof. +type VerifyNonMembershipMsg struct { + Height clienttypes.Height `json:"height"` + DelayTimePeriod uint64 `json:"delay_time_period"` + DelayBlockPeriod uint64 `json:"delay_block_period"` + Proof []byte `json:"proof"` + Path commitmenttypes.MerklePath `json:"path"` +} + +// VerifyUpgradeAndUpdateStateMsg is a sudoMsg sent to the contract to verify an upgrade and update its state. +type VerifyUpgradeAndUpdateStateMsg struct { + UpgradeClientState []byte `json:"upgrade_client_state"` + UpgradeConsensusState []byte `json:"upgrade_consensus_state"` + ProofUpgradeClient []byte `json:"proof_upgrade_client"` + ProofUpgradeConsensusState []byte `json:"proof_upgrade_consensus_state"` +} + +// MigrateClientStore is a sudoMsg sent to the contract to verify a given substitute client and update to its state. +type MigrateClientStoreMsg struct{} + +// EmptyResult is the default return type of any contract call that does not require a custom return type. +type EmptyResult struct{} + +// StatusResult is the expected return type of the statusMsg query. It returns the status of the wasm client. +type StatusResult struct { + Status string `json:"status"` +} + +// ExportMetadataResult is the expected return type of the exportMetadataMsg query. It returns the exported metadata of the wasm client. +type ExportMetadataResult struct { + GenesisMetadata []clienttypes.GenesisMetadata `json:"genesis_metadata"` +} + +// TimestampAtHeightResult is the expected return type of the timestampAtHeightMsg query. It returns the timestamp for a light client +// at a given height. +type TimestampAtHeightResult struct { + Timestamp uint64 `json:"timestamp"` +} + +// CheckForMisbehaviourResult is the expected return type of the checkForMisbehaviourMsg query. It returns a boolean indicating +// if misbehaviour was detected. +type CheckForMisbehaviourResult struct { + FoundMisbehaviour bool `json:"found_misbehaviour"` +} + +// UpdateStateResult is the expected return type of the updateStateMsg sudo call. It returns the updated consensus heights. +type UpdateStateResult struct { + Heights []clienttypes.Height `json:"heights"` +} diff --git a/modules/light-clients/08-wasm/types/errors.go b/modules/light-clients/08-wasm/types/errors.go index 9a7e525fd43..7ea46fb5c8e 100644 --- a/modules/light-clients/08-wasm/types/errors.go +++ b/modules/light-clients/08-wasm/types/errors.go @@ -1,25 +1,31 @@ package types -import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +import ( + errorsmod "cosmossdk.io/errors" +) var ( - ErrInvalidData = sdkerrors.Register(ModuleName, 1, "invalid data") - ErrInvalidCodeId = sdkerrors.Register(ModuleName, 2, "invalid code ID") - ErrInvalidHeader = sdkerrors.Register(ModuleName, 3, "invalid header") - ErrUnableToUnmarshalPayload = sdkerrors.Register(ModuleName, 4, "unable to unmarshal wasm contract return value") - ErrUnableToInit = sdkerrors.Register(ModuleName, 5, "unable to initialize wasm contract") - ErrUnableToCall = sdkerrors.Register(ModuleName, 6, "unable to call wasm contract") - ErrUnableToQuery = sdkerrors.Register(ModuleName, 7, "unable to query wasm contract") - ErrUnableToMarshalPayload = sdkerrors.Register(ModuleName, 8, "unable to marshal wasm contract payload") + ErrInvalidData = errorsmod.Register(ModuleName, 1, "invalid data") + ErrInvalidCodeId = errorsmod.Register(ModuleName, 2, "invalid code ID") + ErrInvalidHeader = errorsmod.Register(ModuleName, 3, "invalid header") + ErrUnableToUnmarshalPayload = errorsmod.Register(ModuleName, 4, "unable to unmarshal wasm contract return value") + ErrUnableToInit = errorsmod.Register(ModuleName, 5, "unable to initialize wasm contract") + ErrUnableToCall = errorsmod.Register(ModuleName, 6, "unable to call wasm contract") + ErrUnableToQuery = errorsmod.Register(ModuleName, 7, "unable to query wasm contract") + ErrUnableToMarshalPayload = errorsmod.Register(ModuleName, 8, "unable to marshal wasm contract payload") // Wasm specific - ErrWasmEmptyCode = sdkerrors.Register(ModuleName, 9, "empty wasm code") - ErrWasmEmptyCodeHash = sdkerrors.Register(ModuleName, 10, "empty wasm code hash") - ErrWasmCodeTooLarge = sdkerrors.Register(ModuleName, 11, "wasm code too large") - ErrWasmCodeExists = sdkerrors.Register(ModuleName, 12, "wasm code already exists") - ErrWasmCodeValidation = sdkerrors.Register(ModuleName, 13, "unable to validate wasm code") - ErrWasmInvalidCode = sdkerrors.Register(ModuleName, 14, "invalid wasm code") - ErrWasmInvalidCodeID = sdkerrors.Register(ModuleName, 15, "invalid wasm code id") - ErrWasmCodeIDNotFound = sdkerrors.Register(ModuleName, 16, "wasm code id not found") - ErrInvalid = sdkerrors.Register(ModuleName, 17, "invalid") - ErrCreateFailed = sdkerrors.Register(ModuleName, 18, "create wasm contract failed") + ErrWasmEmptyCode = errorsmod.Register(ModuleName, 9, "empty wasm code") + ErrWasmChecksumNotFound = errorsmod.Register(ModuleName, 10, "wasm checksum not found") + ErrWasmCodeTooLarge = errorsmod.Register(ModuleName, 11, "wasm code too large") + ErrWasmCodeExists = errorsmod.Register(ModuleName, 12, "wasm code already exists") + ErrWasmCodeValidation = errorsmod.Register(ModuleName, 13, "unable to validate wasm code") + ErrWasmInvalidCode = errorsmod.Register(ModuleName, 14, "invalid wasm code") + ErrWasmInvalidCodeID = errorsmod.Register(ModuleName, 15, "invalid wasm code id") + ErrWasmCodeIDNotFound = errorsmod.Register(ModuleName, 16, "wasm code id not found") + ErrInvalid = errorsmod.Register(ModuleName, 17, "invalid") + ErrCreateFailed = errorsmod.Register(ModuleName, 18, "create wasm contract failed") + + ErrWasmContractCallFailed = errorsmod.Register(ModuleName, 19, "wasm contract call failed") + ErrInvalidChecksum = errorsmod.Register(ModuleName, 20, "invalid checksum") + ErrRetrieveClientID = errorsmod.Register(ModuleName, 21, "failed to retrieve client id") ) diff --git a/modules/light-clients/08-wasm/types/events.go b/modules/light-clients/08-wasm/types/events.go new file mode 100644 index 00000000000..9c62babe4cb --- /dev/null +++ b/modules/light-clients/08-wasm/types/events.go @@ -0,0 +1,11 @@ +package types + +// IBC 08-wasm events +const ( + EventTypePushWasmCode = "push_wasm_code" + EventTypeUpdateWasmCodeId = "update_wasm_code_id" +) + +const ( + AttributeKeyWasmCodeID = "wasm_code_id" +) diff --git a/modules/light-clients/08-wasm/types/gas_register.go b/modules/light-clients/08-wasm/types/gas_register.go index 9365c1bb94a..d719dfef25b 100644 --- a/modules/light-clients/08-wasm/types/gas_register.go +++ b/modules/light-clients/08-wasm/types/gas_register.go @@ -1,13 +1,14 @@ package types import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "math" + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Copied subset of gas features from wasmd @@ -70,31 +71,31 @@ func DefaultPerByteUncompressCost() wasmvmtypes.UFraction { // GasRegister abstract source for gas costs type GasRegister interface { // NewContractInstanceCosts costs to create a new contract instance from code - NewContractInstanceCosts(msgLen int) sdk.Gas + NewContractInstanceCosts(msgLen int) storetypes.Gas // CompileCosts costs to persist and "compile" a new wasm contract - CompileCosts(byteLength int) sdk.Gas + CompileCosts(byteLength int) storetypes.Gas // InstantiateContractCosts costs when interacting with a wasm contract - InstantiateContractCosts(msgLen int) sdk.Gas + InstantiateContractCosts(msgLen int) storetypes.Gas // ToWasmVMGas converts from sdk gas to wasmvm gas - ToWasmVMGas(source sdk.Gas) uint64 + ToWasmVMGas(source storetypes.Gas) uint64 // FromWasmVMGas converts from wasmvm gas to sdk gas - FromWasmVMGas(source uint64) sdk.Gas + FromWasmVMGas(source uint64) storetypes.Gas } // WasmGasRegisterConfig config type type WasmGasRegisterConfig struct { // InstanceCost costs when interacting with a wasm contract - InstanceCost sdk.Gas + InstanceCost storetypes.Gas // CompileCosts costs to persist and "compile" a new wasm contract - CompileCost sdk.Gas + CompileCost storetypes.Gas // UncompressCost costs per byte to unpack a contract UncompressCost wasmvmtypes.UFraction // GasMultiplier is how many cosmwasm gas points = 1 sdk gas point // SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/02c6c9fafd58da88550ab4d7d494724a477c8a68/store/types/gas.go#L153-L164 - GasMultiplier sdk.Gas + GasMultiplier storetypes.Gas // ContractMessageDataCost SDK gas charged *per byte* of the message that goes to the contract // This is used with len(msg) - ContractMessageDataCost sdk.Gas + ContractMessageDataCost storetypes.Gas } // DefaultGasRegisterConfig default values @@ -121,7 +122,7 @@ func NewDefaultWasmGasRegister() WasmGasRegister { // NewWasmGasRegister constructor func NewWasmGasRegister(c WasmGasRegisterConfig) WasmGasRegister { if c.GasMultiplier == 0 { - panic(sdkerrors.Wrap(sdkerrors.ErrLogic, "GasMultiplier can not be 0")) + panic(errorsmod.Wrap(sdkerrors.ErrLogic, "GasMultiplier can not be 0")) } return WasmGasRegister{ c: c, @@ -136,25 +137,25 @@ func (g WasmGasRegister) NewContractInstanceCosts(msgLen int) storetypes.Gas { // CompileCosts costs to persist and "compile" a new wasm contract func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas { if byteLength < 0 { - panic(sdkerrors.Wrap(ErrInvalid, "negative length")) + panic(errorsmod.Wrap(ErrInvalid, "negative length")) } return g.c.CompileCost * uint64(byteLength) } // UncompressCosts costs to unpack a new wasm contract -func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas { +func (g WasmGasRegister) UncompressCosts(byteLength int) storetypes.Gas { if byteLength < 0 { - panic(sdkerrors.Wrap(ErrInvalid, "negative length")) + panic(errorsmod.Wrap(ErrInvalid, "negative length")) } return g.c.UncompressCost.Mul(uint64(byteLength)).Floor() } // InstantiateContractCosts costs when interacting with a wasm contract -func (g WasmGasRegister) InstantiateContractCosts(msgLen int) sdk.Gas { +func (g WasmGasRegister) InstantiateContractCosts(msgLen int) storetypes.Gas { if msgLen < 0 { - panic(sdkerrors.Wrap(ErrInvalid, "negative length")) + panic(errorsmod.Wrap(ErrInvalid, "negative length")) } - dataCosts := sdk.Gas(msgLen) * g.c.ContractMessageDataCost + dataCosts := storetypes.Gas(msgLen) * g.c.ContractMessageDataCost return g.c.InstanceCost + dataCosts } @@ -162,13 +163,13 @@ func (g WasmGasRegister) InstantiateContractCosts(msgLen int) sdk.Gas { func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64 { x := source * g.c.GasMultiplier if x < source { - panic(sdk.ErrorOutOfGas{Descriptor: "overflow"}) + panic(storetypes.ErrorOutOfGas{Descriptor: "overflow"}) } return x } // FromWasmVMGas converts to SDK gas unit -func (g WasmGasRegister) FromWasmVMGas(source uint64) sdk.Gas { +func (g WasmGasRegister) FromWasmVMGas(source uint64) storetypes.Gas { return source / g.c.GasMultiplier } @@ -189,22 +190,22 @@ func (g WasmGasRegister) consumeRuntimeGas(ctx sdk.Context, gas uint64) { ctx.GasMeter().ConsumeGas(consumed, "wasm contract") // throw OutOfGas error if we ran out (got exactly to zero due to better limit enforcing) if ctx.GasMeter().IsOutOfGas() { - panic(sdk.ErrorOutOfGas{Descriptor: "Wasmer function execution"}) + panic(storetypes.ErrorOutOfGas{Descriptor: "Wasmer function execution"}) } } // MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier type MultipliedGasMeter struct { - originalMeter sdk.GasMeter + originalMeter storetypes.GasMeter GasRegister GasRegister } -func NewMultipliedGasMeter(originalMeter sdk.GasMeter, gr GasRegister) MultipliedGasMeter { +func NewMultipliedGasMeter(originalMeter storetypes.GasMeter, gr GasRegister) MultipliedGasMeter { return MultipliedGasMeter{originalMeter: originalMeter, GasRegister: gr} } var _ wasmvm.GasMeter = MultipliedGasMeter{} -func (m MultipliedGasMeter) GasConsumed() sdk.Gas { +func (m MultipliedGasMeter) GasConsumed() storetypes.Gas { return m.GasRegister.ToWasmVMGas(m.originalMeter.GasConsumed()) } diff --git a/modules/light-clients/08-wasm/types/genesis.go b/modules/light-clients/08-wasm/types/genesis.go index 462b02b5dcb..4d77aa4f3cf 100644 --- a/modules/light-clients/08-wasm/types/genesis.go +++ b/modules/light-clients/08-wasm/types/genesis.go @@ -1,12 +1,14 @@ package types import ( + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "encoding/json" "time" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) type ExportMetadataPayload struct { @@ -16,7 +18,7 @@ type ExportMetadataPayload struct { type ExportMetadataInnerPayload struct{} // ExportMetadata is a no-op since wasm client does not store any metadata in client store -func (c ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetadata { +func (c ClientState) ExportMetadata(store storetypes.KVStore) []exported.GenesisMetadata { payload := ExportMetadataPayload{} encodedData, err := json.Marshal(payload) @@ -42,3 +44,15 @@ func (c ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetadat return genesisMetadata } + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + for _, contract := range gs.Contracts { + if err := ValidateWasmCode(contract.ContractCode); err != nil { + return errorsmod.Wrap(err, "wasm bytecode validation failed") + } + } + + return nil +} diff --git a/modules/light-clients/08-wasm/types/genesis_test.go b/modules/light-clients/08-wasm/types/genesis_test.go index 3c5abe3c668..342d50af783 100644 --- a/modules/light-clients/08-wasm/types/genesis_test.go +++ b/modules/light-clients/08-wasm/types/genesis_test.go @@ -1,94 +1,126 @@ package types_test import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "encoding/json" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + errorsmod "cosmossdk.io/errors" + + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) -func (suite *WasmTestSuite) TestExportGenesisGrandpa() { - suite.SetupWithEmptyClient() - gm := suite.clientState.ExportMetadata(suite.store) - suite.Require().NotNil(gm, "client returned nil") - suite.Require().Len(gm, 0, "exported metadata has unexpected length") +func (suite *TypesTestSuite) TestValidateGenesis() { + testCases := []struct { + name string + genState *types.GenesisState + expPass bool + }{ + { + "valid genesis", + &types.GenesisState{ + Contracts: []types.GenesisContract{{ContractCode: []byte{1}}}, + }, + true, + }, + { + "invalid genesis", + &types.GenesisState{ + Contracts: []types.GenesisContract{{ContractCode: []byte{}}}, + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + err := tc.genState.Validate() + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + } } -// expected export ordering: -// processed height and processed time per height -// then all iteration keys -func (suite *WasmTestSuite) TestExportMetadataTendermint() { - suite.SetupWasmTendermint() - // test intializing client and exporting metadata - path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - clientState := path.EndpointA.GetClientState() - height := clientState.GetLatestHeight() - - initIteration := ibctm.GetIterationKey(clientStore, height) - suite.Require().NotEqual(0, len(initIteration)) - initProcessedTime, found := ibctm.GetProcessedTime(clientStore, height) - suite.Require().True(found) - initProcessedHeight, found := GetProcessedHeight(clientStore, height) - suite.Require().True(found) - - gm := clientState.ExportMetadata(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)) - suite.Require().NotNil(gm, "client with metadata returned nil exported metadata") - suite.Require().Len(gm, 3, "exported metadata has unexpected length") - - suite.Require().Equal(ibctm.ProcessedHeightKey(height), gm[0].GetKey(), "metadata has unexpected key") - actualProcessedHeight := sdk.BigEndianToUint64(gm[0].GetValue()) - suite.Require().Equal(initProcessedHeight, actualProcessedHeight, "metadata has unexpected value") - - suite.Require().Equal(ibctm.ProcessedTimeKey(height), gm[1].GetKey(), "metadata has unexpected key") - suite.Require().Equal(initProcessedTime, sdk.BigEndianToUint64(gm[1].GetValue()), "metadata has unexpected value") - - suite.Require().Equal(ibctm.IterationKey(height), gm[2].GetKey(), "metadata has unexpected key") - suite.Require().Equal(initIteration, gm[2].GetValue(), "metadata has unexpected value") - - // test updating client and exporting metadata - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - clientState = path.EndpointA.GetClientState() - updateHeight := clientState.GetLatestHeight() - - iteration := ibctm.GetIterationKey(clientStore, updateHeight) - suite.Require().NotEqual(0, len(initIteration)) - processedTime, found := ibctm.GetProcessedTime(clientStore, updateHeight) - suite.Require().True(found) - processedHeight, found := GetProcessedHeight(clientStore, updateHeight) - suite.Require().True(found) - - gm = clientState.ExportMetadata(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)) - suite.Require().NotNil(gm, "client with metadata returned nil exported metadata") - suite.Require().Len(gm, 6, "exported metadata has unexpected length") - - // expected ordering: - // initProcessedHeight, initProcessedTime, processedHeight, processedTime, initIteration, iteration - - // check init processed height and time - suite.Require().Equal(ibctm.ProcessedHeightKey(height), gm[0].GetKey(), "metadata has unexpected key") - actualProcessedHeight = sdk.BigEndianToUint64(gm[0].GetValue()) - suite.Require().Equal(initProcessedHeight, actualProcessedHeight, "metadata has unexpected value") - - suite.Require().Equal(ibctm.ProcessedTimeKey(height), gm[1].GetKey(), "metadata has unexpected key") - suite.Require().Equal(initProcessedTime, sdk.BigEndianToUint64(gm[1].GetValue()), "metadata has unexpected value") - - // check processed height and time after update - suite.Require().Equal(ibctm.ProcessedHeightKey(updateHeight), gm[2].GetKey(), "metadata has unexpected key") - actualProcessedHeight = sdk.BigEndianToUint64(gm[2].GetValue()) - suite.Require().NoError(err) - suite.Require().Equal(processedHeight, actualProcessedHeight, "metadata has unexpected value") - - suite.Require().Equal(ibctm.ProcessedTimeKey(updateHeight), gm[3].GetKey(), "metadata has unexpected key") - suite.Require().Equal(processedTime, sdk.BigEndianToUint64(gm[3].GetValue()), "metadata has unexpected value") - - // check iteration keys - suite.Require().Equal(ibctm.IterationKey(height), gm[4].GetKey(), "metadata has unexpected key") - suite.Require().Equal(initIteration, gm[4].GetValue(), "metadata has unexpected value") - - suite.Require().Equal(ibctm.IterationKey(updateHeight), gm[5].GetKey(), "metadata has unexpected key") - suite.Require().Equal(iteration, gm[5].GetValue(), "metadata has unexpected value") +func (suite *TypesTestSuite) TestExportMetatada() { + mockMetadata := clienttypes.NewGenesisMetadata([]byte("key"), []byte("value")) + + testCases := []struct { + name string + malleate func() + expPanic error + expMetadata []exported.GenesisMetadata + }{ + { + "success", + func() { + suite.mockVM.RegisterQueryCallback(types.ExportMetadataMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + var msg types.QueryMsg + + err := json.Unmarshal(queryMsg, &msg) + suite.Require().NoError(err) + + suite.Require().NotNil(msg.ExportMetadata) + suite.Require().Nil(msg.VerifyClientMessage) + suite.Require().Nil(msg.Status) + suite.Require().Nil(msg.CheckForMisbehaviour) + suite.Require().Nil(msg.TimestampAtHeight) + + resp, err := json.Marshal(types.ExportMetadataResult{ + GenesisMetadata: []clienttypes.GenesisMetadata{mockMetadata}, + }) + suite.Require().NoError(err) + + return resp, wasmtesting.DefaultGasUsed, nil + }) + }, + nil, + []exported.GenesisMetadata{mockMetadata}, + }, + { + "failure: contract returns an error", + func() { + suite.mockVM.RegisterQueryCallback(types.ExportMetadataMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) + }, + errorsmod.Wrapf(types.ErrWasmContractCallFailed, wasmtesting.ErrMockContract.Error()), + nil, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupWasmWithMockVM() + + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() + suite.Require().NoError(err) + + clientState := endpoint.GetClientState() + + tc.malleate() + + store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + + var metadata []exported.GenesisMetadata + exportMetadata := func() { + metadata = clientState.ExportMetadata(store) + } + + if tc.expPanic == nil { + exportMetadata() + + suite.Require().Equal(tc.expMetadata, metadata) + } else { + suite.Require().PanicsWithError(tc.expPanic.Error(), exportMetadata) + } + }) + } } diff --git a/modules/light-clients/08-wasm/types/header.go b/modules/light-clients/08-wasm/types/header.go index 9fe5d1d8929..e91e0436cef 100644 --- a/modules/light-clients/08-wasm/types/header.go +++ b/modules/light-clients/08-wasm/types/header.go @@ -3,13 +3,13 @@ package types import ( "fmt" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ exported.ClientMessage = &Header{} func (m Header) ClientType() string { - return exported.Wasm + return Wasm } func (m Header) ValidateBasic() error { diff --git a/modules/light-clients/08-wasm/types/header_test.go b/modules/light-clients/08-wasm/types/header_test.go deleted file mode 100644 index 682e11cc5cf..00000000000 --- a/modules/light-clients/08-wasm/types/header_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package types_test - -import ( - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" -) - -func (suite *WasmTestSuite) TestHeaderValidateBasic() { - testCases := []struct { - name string - header *types.Header - expPass bool - }{ - { - "valid header", - &types.Header{ - Data: []byte("data"), - Height: clienttypes.NewHeight(0, 0), - }, - true, - }, - { - "data is nil", - &types.Header{ - Data: nil, - Height: clienttypes.NewHeight(0, 0), - }, - false, - }, - { - "data is empty", - &types.Header{ - Data: []byte(""), - Height: clienttypes.NewHeight(0, 0), - }, - false, - }, - } - - for _, tc := range testCases { - tc := tc - header := tc.header - - suite.Require().Equal(exported.Wasm, header.ClientType()) - err := header.ValidateBasic() - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - } -} diff --git a/modules/light-clients/08-wasm/types/keys.go b/modules/light-clients/08-wasm/types/keys.go index 0918c44ca6f..706815c230a 100644 --- a/modules/light-clients/08-wasm/types/keys.go +++ b/modules/light-clients/08-wasm/types/keys.go @@ -13,6 +13,8 @@ const ( // StoreKey is the store key string for 08-wasm StoreKey = ModuleName + Wasm = ModuleName + LastInstanceIDKey = "lastInstanceId" ) diff --git a/modules/light-clients/08-wasm/types/misbehaviour.go b/modules/light-clients/08-wasm/types/misbehaviour.go index 66ce2abe2da..7eaea571ae6 100644 --- a/modules/light-clients/08-wasm/types/misbehaviour.go +++ b/modules/light-clients/08-wasm/types/misbehaviour.go @@ -3,13 +3,13 @@ package types import ( "fmt" - exported "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ exported.ClientMessage = &Misbehaviour{} func (m Misbehaviour) ClientType() string { - return exported.Wasm + return Wasm } func (m Misbehaviour) ValidateBasic() error { diff --git a/modules/light-clients/08-wasm/types/misbehaviour_handle.go b/modules/light-clients/08-wasm/types/misbehaviour_handle.go index a04d9c509de..b3e8b43c38a 100644 --- a/modules/light-clients/08-wasm/types/misbehaviour_handle.go +++ b/modules/light-clients/08-wasm/types/misbehaviour_handle.go @@ -1,9 +1,10 @@ package types import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) type checkForMisbehaviourPayload struct { @@ -13,7 +14,7 @@ type checkForMisbehaviourInnerPayload struct { ClientMessage clientMessageConcretePayloadClientMessage `json:"client_message"` } -func (c ClientState) CheckForMisbehaviour(ctx sdk.Context, _ codec.BinaryCodec, clientStore sdk.KVStore, msg exported.ClientMessage) bool { +func (c ClientState) CheckForMisbehaviour(ctx sdk.Context, _ codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { clientMsgConcrete := clientMessageConcretePayloadClientMessage{ Header: nil, Misbehaviour: nil, diff --git a/modules/light-clients/08-wasm/types/misbehaviour_handle_test.go b/modules/light-clients/08-wasm/types/misbehaviour_handle_test.go index cee9a17dc48..bbe114b9945 100644 --- a/modules/light-clients/08-wasm/types/misbehaviour_handle_test.go +++ b/modules/light-clients/08-wasm/types/misbehaviour_handle_test.go @@ -1,861 +1,93 @@ package types_test import ( - "encoding/base64" - "fmt" - "strings" - "time" + "encoding/json" + "errors" - tmtypes "github.com/cometbft/cometbft/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - ibctestingmock "github.com/cosmos/ibc-go/v7/testing/mock" + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ) -func (suite *WasmTestSuite) TestVerifyMisbehaviourGrandpa() { - var ( - clientMsg exported.ClientMessage - clientState exported.ClientState - ) +func (suite *TypesTestSuite) TestCheckForMisbehaviour() { + var clientMessage exported.ClientMessage testCases := []struct { - name string - setup func() - expPass bool + name string + malleate func() + expFoundMisbehaviour bool }{ { - "successful misbehaviour verification", - func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } - // VerifyClientMessage must be run first - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - suite.Require().NoError(err) - clientState.UpdateState(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - // Reset client state to the previous for the test - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", clientState) - - data, err = base64.StdEncoding.DecodeString(suite.testData["misbehaviour"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Misbehaviour{ - Data: data, - } - }, - true, - }, - { - "trusted consensus state does not exist", + "success: no misbehaviour", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["misbehaviour"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Misbehaviour{ - Data: data, - } + suite.mockVM.RegisterQueryCallback(types.CheckForMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.CheckForMisbehaviourResult{FoundMisbehaviour: false}) + suite.Require().NoError(err) + return resp, wasmtesting.DefaultGasUsed, nil + }) }, false, }, { - "invalid wasm misbehaviour", - func() { - clientMsg = &solomachine.Misbehaviour{} - }, - false, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithChannel() - clientState = suite.clientState - tc.setup() - - err := clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *WasmTestSuite) TestVerifyMisbehaviourTendermint() { - // Setup different validators and signers for testing different types of updates - altPrivVal := ibctestingmock.NewPV() - altPubKey, err := altPrivVal.GetPubKey() - suite.Require().NoError(err) - - // create modified heights to use for test-cases - altVal := tmtypes.NewValidator(altPubKey, 100) - - // Create alternative validator set with only altVal, invalid update (too much change in valSet) - altValSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{altVal}) - altSigners := getAltSigners(altVal, altPrivVal) - - var ( - path *ibctesting.Path - misbehaviour exported.ClientMessage - ) - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "valid fork misbehaviour", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "valid time misbehaviour", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+3, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "valid time misbehaviour, header 1 time stricly less than header 2 time", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+3, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "valid misbehavior at height greater than last consensusState", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, true, - }, - { - "valid misbehaviour with different trusted heights", func() { - trustedHeight1 := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals1, found := suite.chainB.GetValsAtHeight(int64(trustedHeight1.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - trustedHeight2 := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals2, found := suite.chainB.GetValsAtHeight(int64(trustedHeight2.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight1, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals1, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight2, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals2, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "valid misbehaviour at a previous revision", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - - // increment revision number - err = path.EndpointB.UpgradeChain() - suite.Require().NoError(err) - }, - true, - }, - { - "valid misbehaviour at a future revision", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - futureRevision := fmt.Sprintf("%s-%d", strings.TrimSuffix(suite.chainB.ChainID, fmt.Sprintf("-%d", clienttypes.ParseChainID(suite.chainB.ChainID))), height.GetRevisionNumber()+1) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(futureRevision, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Second), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(futureRevision, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } + "success: misbehaviour found", func() { + suite.mockVM.RegisterQueryCallback(types.CheckForMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.CheckForMisbehaviourResult{FoundMisbehaviour: true}) + suite.Require().NoError(err) + return resp, wasmtesting.DefaultGasUsed, nil + }) }, true, }, { - "valid misbehaviour with trusted heights at a previous revision", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // increment revision of chainID - err := path.EndpointB.UpgradeChain() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "consensus state's valset hash different from misbehaviour should still pass", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - // Create bothValSet with both suite validator and altVal - bothValSet := tmtypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altValSet.Proposer)) - bothSigners := suite.chainB.Signers - bothSigners[altValSet.Proposer.Address.String()] = altPrivVal - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), bothValSet, suite.chainB.NextVals, trustedVals, bothSigners), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, bothValSet, suite.chainB.NextVals, trustedVals, bothSigners), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, true, - }, - { - "invalid misbehaviour: misbehaviour from different chain", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "misbehaviour trusted validators does not match validator hash in trusted consensus state", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "trusted consensus state does not exist", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight.Increment().(clienttypes.Height), suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "invalid tendermint misbehaviour", func() { - misbehaviour = &solomachine.Misbehaviour{} - }, false, - }, - { - "trusting period expired", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - suite.chainA.ExpireClient(path.EndpointA.ClientConfig.(*ibctesting.TendermintConfig).TrustingPeriod) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "header 1 valset has too much change", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight+1), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "header 2 valset has too much change", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight+1), trustedHeight, suite.chainB.CurrentHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "both header 1 and header 2 valsets have too much change", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight+1), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners), - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight+1), trustedHeight, suite.chainB.CurrentHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners), - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - misbehaviour = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - err := path.EndpointA.CreateClient() - suite.Require().NoError(err) - - tc.malleate() - - clientState := path.EndpointA.GetClientState() - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - - err = clientState.VerifyClientMessage(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, misbehaviour) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *WasmTestSuite) TestCheckForMisbehaviourGrandpa() { - var ( - clientMsg exported.ClientMessage - clientState exported.ClientState - ) - - testCases := []struct { - name string - setup func() - expPass bool - }{ - { - "valid update no misbehaviour", - func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } - - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - suite.Require().NoError(err) + "success: contract error, resp cannot be marshalled", func() { + suite.mockVM.RegisterQueryCallback(types.CheckForMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp := "cannot be unmarshalled" + return []byte(resp), wasmtesting.DefaultGasUsed, nil + }) }, false, }, { - "valid fork misbehaviour returns true", - func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } - // VerifyClientMessage must be run first - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - suite.Require().NoError(err) - clientState.UpdateState(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - // Reset client state to the previous for the test - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", clientState) - - data, err = base64.StdEncoding.DecodeString(suite.testData["misbehaviour"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Misbehaviour{ - Data: data, - } - - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - suite.Require().NoError(err) - }, - true, - }, - { - "invalid wasm misbehaviour", - func() { - clientMsg = &solomachine.Misbehaviour{} + "success: vm returns error, ", func() { + suite.mockVM.RegisterQueryCallback(types.CheckForMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + return nil, 0, errors.New("invalid block ID") + }) }, false, }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithChannel() - clientState = suite.clientState - tc.setup() - foundMisbehaviour := clientState.CheckForMisbehaviour(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - if tc.expPass { - suite.Require().True(foundMisbehaviour) - } else { - suite.Require().False(foundMisbehaviour) - } - }) - } -} - -func (suite *WasmTestSuite) TestCheckForMisbehaviourTendermint() { - var ( - path *ibctesting.Path - clientMessage exported.ClientMessage - ) - - testCases := []struct { - name string - malleate func() - expPass bool - }{ { - "valid update no misbehaviour", - func() {}, - false, - }, - { - "consensus state already exists, already updated", - func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - var wasmData exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(wasmHeader.Data, &wasmData) - suite.Require().NoError(err) - - tmHeader, ok := wasmData.(*ibctm.Header) - suite.Require().True(ok) - - tmConsensusState := &ibctm.ConsensusState{ - Timestamp: tmHeader.GetTime(), - Root: commitmenttypes.NewMerkleRoot(tmHeader.Header.GetAppHash()), - NextValidatorsHash: tmHeader.Header.NextValidatorsHash, - } - - wasmDataCS, err := suite.chainA.Codec.MarshalInterface(tmConsensusState) - suite.Require().NoError(err) - wasmConsensusState := &wasmtypes.ConsensusState{ - Data: wasmDataCS, - Timestamp: tmConsensusState.GetTimestamp(), - } - - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState( - suite.chainA.GetContext(), path.EndpointA.ClientID, tmHeader.GetHeight(), wasmConsensusState) + "success: invalid client message", func() { + clientMessage = &ibctm.Header{} + // we will not register the callback here because this test case does not reach the VM }, false, }, - { - "invalid fork misbehaviour: identical headers", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - height := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - misbehaviourHeader := suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: misbehaviourHeader, - Header2: misbehaviourHeader, - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - clientMessage = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "invalid time misbehaviour: monotonically increasing time", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - header1 := suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+3, trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - header2 := suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: header1, - Header2: header2, - } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - clientMessage = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, false, - }, - { - "consensus state already exists, app hash mismatch", - func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - var wasmData exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(wasmHeader.Data, &wasmData) - suite.Require().NoError(err) - - tmHeader, ok := wasmData.(*ibctm.Header) - suite.Require().True(ok) - - tmConsensusState := &ibctm.ConsensusState{ - Timestamp: tmHeader.GetTime(), - Root: commitmenttypes.NewMerkleRoot([]byte{}), // empty bytes - NextValidatorsHash: tmHeader.Header.NextValidatorsHash, - } - - wasmDataCS, err := suite.chainA.Codec.MarshalInterface(tmConsensusState) - suite.Require().NoError(err) - wasmConsensusState := &wasmtypes.ConsensusState{ - Data: wasmDataCS, - Timestamp: tmConsensusState.GetTimestamp(), - } - - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState( - suite.chainA.GetContext(), path.EndpointA.ClientID, tmHeader.GetHeight(), wasmConsensusState) - }, - true, - }, - { - "previous consensus state exists and header time is before previous consensus state time", - func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - var wasmData exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(wasmHeader.Data, &wasmData) - suite.Require().NoError(err) - - tmHeader, ok := wasmData.(*ibctm.Header) - suite.Require().True(ok) - - // offset header timestamp before previous consensus state timestamp - tmHeader.Header.Time = tmHeader.GetTime().Add(-time.Hour) - - wasmHeader.Data, err = suite.chainA.Codec.MarshalInterface(tmHeader) - suite.Require().NoError(err) - }, - true, - }, - { - "next consensus state exists and header time is after next consensus state time", - func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - var wasmData exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(wasmHeader.Data, &wasmData) - suite.Require().NoError(err) - - tmHeader, ok := wasmData.(*ibctm.Header) - suite.Require().True(ok) - - // offset header timestamp before previous consensus state timestamp - tmHeader.Header.Time = tmHeader.GetTime().Add(time.Hour) - - wasmHeader.Data, err = suite.chainA.Codec.MarshalInterface(tmHeader) - suite.Require().NoError(err) - // commit block and update client, adding a new consensus state - suite.coordinator.CommitBlock(suite.chainB) - - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - }, - true, - }, - { - "valid fork misbehaviour returns true", - func() { - header1, err := path.EndpointA.Chain.ConstructUpdateTMClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - - // commit block and update client - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - header2, err := path.EndpointA.Chain.ConstructUpdateTMClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - - // assign the same height, each header will have a different commit hash - header1.Header.Height = header2.Header.Height - header1.Commit.Height = header2.Commit.Height - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: header1, - Header2: header2, - } - - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - clientMessage = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, - true, - }, - { - "valid time misbehaviour: not monotonically increasing time", func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - tmMisbehaviour := &ibctm.Misbehaviour{ - Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+3, trustedHeight, suite.chainB.CurrentHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers), - } - - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - clientMessage = &wasmtypes.Misbehaviour{ - Data: wasmData, - } - }, true, - }, } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { // reset suite to create fresh application state - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - err := path.EndpointA.CreateClient() - suite.Require().NoError(err) - - // ensure counterparty state is committed - suite.coordinator.CommitBlock(suite.chainB) - clientMessage, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) + suite.SetupWasmWithMockVM() + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() suite.Require().NoError(err) - tc.malleate() + clientState := endpoint.GetClientState() + clientMessage = &types.ClientState{ + Data: clienttypes.MustMarshalClientMessage(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientMisbehaviour), + } - clientState := path.EndpointA.GetClientState() - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) - foundMisbehaviour := clientState.CheckForMisbehaviour( - suite.chainA.GetContext(), - suite.chainA.App.AppCodec(), - clientStore, // pass in clientID prefixed clientStore - clientMessage, - ) + tc.malleate() - if tc.expPass { - suite.Require().True(foundMisbehaviour) - } else { - suite.Require().False(foundMisbehaviour) - } + foundMisbehaviour := clientState.CheckForMisbehaviour(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, clientMessage) + suite.Require().Equal(tc.expFoundMisbehaviour, foundMisbehaviour) }) } } diff --git a/modules/light-clients/08-wasm/types/misbehaviour_test.go b/modules/light-clients/08-wasm/types/misbehaviour_test.go deleted file mode 100644 index 2fed5e02412..00000000000 --- a/modules/light-clients/08-wasm/types/misbehaviour_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package types_test - -import ( - "github.com/cosmos/ibc-go/v7/modules/core/exported" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" -) - -func (suite *WasmTestSuite) TestMisbehaviourValidateBasic() { - testCases := []struct { - name string - misbehaviour *wasmtypes.Misbehaviour - expPass bool - }{ - { - "valid misbehaviour", - &wasmtypes.Misbehaviour{ - Data: []byte{0}, - }, - true, - }, - { - "data is nil", - &wasmtypes.Misbehaviour{ - Data: nil, - }, - false, - }, - { - "data is empty", - &wasmtypes.Misbehaviour{ - Data: []byte{}, - }, - false, - }, - } - for i, tc := range testCases { - tc := tc - - suite.Require().Equal(exported.Wasm, tc.misbehaviour.ClientType()) - - if tc.expPass { - suite.Require().NoError(tc.misbehaviour.ValidateBasic(), "valid test case %d failed: %s", i, tc.name) - } else { - suite.Require().Error(tc.misbehaviour.ValidateBasic(), "invalid test case %d passed: %s", i, tc.name) - } - } -} diff --git a/modules/light-clients/08-wasm/types/msgs.go b/modules/light-clients/08-wasm/types/msgs.go index 15607e180ce..5a1e08c027b 100644 --- a/modules/light-clients/08-wasm/types/msgs.go +++ b/modules/light-clients/08-wasm/types/msgs.go @@ -1,27 +1,18 @@ package types import ( + errorsmod "cosmossdk.io/errors" "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ) -var TypeMsgPushNewWasmCode = "push_wasm_code" -var _ sdk.Msg = &MsgPushNewWasmCode{} - -var TypeMsgUpdateWasmCodeId = "update_wasm_code_id" -var _ sdk.Msg = &MsgUpdateWasmCodeId{} - -// NewMsgPushNewWasmCode creates a new MsgPushNewWasmCode instance -// -//nolint:interfacer - -// Route Implements Msg. -func (msg MsgPushNewWasmCode) Route() string { return ModuleName } - -// Type Implements Msg. -func (msg MsgPushNewWasmCode) Type() string { return TypeMsgPushNewWasmCode } +var ( + _ sdk.Msg = (*MsgPushNewWasmCode)(nil) + _ sdk.HasValidateBasic = (*MsgPushNewWasmCode)(nil) + _ sdk.Msg = (*MsgUpdateWasmCodeId)(nil) + _ sdk.HasValidateBasic = (*MsgUpdateWasmCodeId)(nil) +) func NewMsgPushNewWasmCode(signer string, code []byte) *MsgPushNewWasmCode { return &MsgPushNewWasmCode{ @@ -32,7 +23,7 @@ func NewMsgPushNewWasmCode(signer string, code []byte) *MsgPushNewWasmCode { func (m MsgPushNewWasmCode) ValidateBasic() error { if len(m.Code) == 0 { - return sdkerrors.Wrapf(ErrWasmEmptyCode, + return errorsmod.Wrapf(ErrWasmEmptyCode, "empty wasm code", ) } @@ -40,29 +31,6 @@ func (m MsgPushNewWasmCode) ValidateBasic() error { return nil } -func (m MsgPushNewWasmCode) GetSigners() []sdk.AccAddress { - signer, err := sdk.AccAddressFromBech32(m.Signer) - if err != nil { - panic(err) - } - return []sdk.AccAddress{signer} -} - -// GetSignBytes implements the LegacyMsg interface. -func (msg MsgPushNewWasmCode) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// NewMsgUpdateWasmCodeId creates a new MsgUpdateWasmCodeId instance -// -//nolint:interfacer - -// Route Implements Msg. -func (msg MsgUpdateWasmCodeId) Route() string { return ModuleName } - -// Type Implements Msg. -func (msg MsgUpdateWasmCodeId) Type() string { return TypeMsgUpdateWasmCodeId } - func NewMsgUpdateWasmCodeId(signer string, codeId []byte, clientId string) *MsgUpdateWasmCodeId { return &MsgUpdateWasmCodeId{ Signer: signer, @@ -73,7 +41,7 @@ func NewMsgUpdateWasmCodeId(signer string, codeId []byte, clientId string) *MsgU func (m MsgUpdateWasmCodeId) ValidateBasic() error { if len(m.CodeId) != tmhash.Size { - return sdkerrors.Wrapf(ErrWasmEmptyCode, + return errorsmod.Wrapf(ErrWasmEmptyCode, "invalid code id length (expected 32, got %d)", len(m.CodeId), ) } diff --git a/modules/light-clients/08-wasm/types/proposal_handle.go b/modules/light-clients/08-wasm/types/proposal_handle.go index 150757bf7db..5b74ed59c12 100644 --- a/modules/light-clients/08-wasm/types/proposal_handle.go +++ b/modules/light-clients/08-wasm/types/proposal_handle.go @@ -1,12 +1,13 @@ package types import ( + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "fmt" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) type checkSubstituteAndUpdateStatePayload struct { @@ -17,7 +18,7 @@ type CheckSubstituteAndUpdateStatePayload struct{} func (c ClientState) CheckSubstituteAndUpdateState( ctx sdk.Context, _ codec.BinaryCodec, subjectClientStore, - substituteClientStore sdk.KVStore, substituteClient exported.ClientState, + substituteClientStore storetypes.KVStore, substituteClient exported.ClientState, ) error { var ( SubjectPrefix = []byte("subject/") @@ -26,7 +27,7 @@ func (c ClientState) CheckSubstituteAndUpdateState( _, ok := substituteClient.(*ClientState) if !ok { - return sdkerrors.Wrapf( + return errorsmod.Wrapf( ErrUnableToCall, fmt.Sprintf("substitute client state, expected type %T, got %T", &ClientState{}, substituteClient), ) diff --git a/modules/light-clients/08-wasm/types/proposal_handle_test.go b/modules/light-clients/08-wasm/types/proposal_handle_test.go index 12f5f57cc1b..9ff9b1eee3b 100644 --- a/modules/light-clients/08-wasm/types/proposal_handle_test.go +++ b/modules/light-clients/08-wasm/types/proposal_handle_test.go @@ -1,306 +1,130 @@ package types_test import ( - "encoding/base64" - "time" + "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" -) - -var frozenHeight = clienttypes.NewHeight(0, 1) - -// TestCheckSubstituteAndUpdateState only test the interface to the contract, not the full logic of the contract. -func (suite *WasmTestSuite) TestCheckSubstituteAndUpdateStateGrandpa() { - var ( - subjectClientState exported.ClientState - subjectClientStore sdk.KVStore - substituteClientState exported.ClientState - substituteClientStore sdk.KVStore - ) - testCases := []struct { - name string - setup func() - expPass bool - }{ - { - "success", - func() {}, - true, - }, - } - for _, tc := range testCases { - tc := tc - - suite.SetupWithChannel() - subjectClientState = suite.clientState - subjectClientStore = suite.store - - // Create a new client - clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_data"]) - suite.Require().NoError(err) - - substituteClientState = &wasmtypes.ClientState{ - Data: clientStateData, - CodeId: suite.codeID, - LatestHeight: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 4, - }, - } - consensusStateData, err := base64.StdEncoding.DecodeString(suite.testData["consensus_state_data"]) - suite.Require().NoError(err) - substituteConsensusState := wasmtypes.ConsensusState{ - Data: consensusStateData, - Timestamp: uint64(1678732170022000000), - } + cosmwasm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" - substituteClientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.ctx, "08-wasm-1") - err = substituteClientState.Initialize(suite.ctx, suite.chainA.Codec, substituteClientStore, &substituteConsensusState) - suite.Require().NoError(err) - - tc.setup() - - err = subjectClientState.CheckSubstituteAndUpdateState( - suite.ctx, - suite.chainA.Codec, - subjectClientStore, - substituteClientStore, - substituteClientState, - ) - if tc.expPass { - suite.Require().NoError(err) - - // Verify that the substitute client state is in the subject client store - clientStateBz := subjectClientStore.Get(host.ClientStateKey()) - suite.Require().NotEmpty(clientStateBz) - newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz) - suite.Require().Equal(substituteClientState.GetLatestHeight(), newClientState.GetLatestHeight()) + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" +) - // Verify that the substitute consensus state is in the subject client store - // Contract will increment timestamp by 1, verifying it can read from the substitute store and write to the subject store - newConsensusState, ok := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(suite.ctx, "08-wasm-0", newClientState.GetLatestHeight()) - suite.Require().True(ok) - suite.Require().Equal(substituteConsensusState.GetTimestamp()+1, newConsensusState.GetTimestamp()) +var SubjectPrefix = []byte("subject/") - } else { - suite.Require().Error(err) - } - } -} +func (suite *TypesTestSuite) TestCheckSubstituteAndUpdateState() { + var substituteClientState exported.ClientState + var expectedClientStateBz []byte -func (suite *WasmTestSuite) TestCheckSubstituteUpdateStateBasicTendermint() { - var ( - substituteClientState exported.ClientState - substitutePath *ibctesting.Path - ) testCases := []struct { name string malleate func() + expErr error }{ { - "solo machine used for substitute", func() { - substituteClientState = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solo machine", "", 1).ClientState() + "success", + func() { + suite.mockVM.RegisterSudoCallback( + types.MigrateClientStoreMsg{}, + func(_ cosmwasm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store cosmwasm.KVStore, _ cosmwasm.GoAPI, _ cosmwasm.Querier, _ cosmwasm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + suite.Require().NotNil(payload.MigrateClientStore) + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyMembership) + suite.Require().Nil(payload.VerifyNonMembership) + suite.Require().Nil(payload.VerifyUpgradeAndUpdateState) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + prefixedKey := SubjectPrefix + prefixedKey = append(prefixedKey, host.ClientStateKey()...) + expectedClientStateBz = wasmtesting.CreateMockClientStateBz(suite.chainA.Codec, suite.checksum) + store.Set(prefixedKey, expectedClientStateBz) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }, + ) }, + nil, }, { - "non-matching substitute", func() { - suite.coordinator.SetupClients(substitutePath) - substituteWasmClientState := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*wasmtypes.ClientState) - - var clientStateData exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(substituteWasmClientState.Data, &clientStateData) - suite.Require().NoError(err) - tmClientState := clientStateData.(*ibctm.ClientState) - - // change unbonding period so that test should fail - tmClientState.UnbondingPeriod = time.Hour * 24 * 7 - - tmClientStateBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmClientState) - suite.Require().NoError(err) - - substituteWasmClientState.Data = tmClientStateBz - - substituteClientState = substituteWasmClientState - substitutePath.EndpointA.SetClientState(substituteClientState) + "failure: invalid substitute client state", + func() { + substituteClientState = &ibctm.ClientState{} }, + clienttypes.ErrInvalidClient, }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() // reset - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - substitutePath = ibctesting.NewPath(suite.chainA, suite.chainB) - - suite.coordinator.SetupClients(subjectPath) - subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*wasmtypes.ClientState) - - var clientStateData exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(subjectClientState.Data, &clientStateData) - suite.Require().NoError(err) - tmClientState := clientStateData.(*ibctm.ClientState) - - // expire subject client - suite.coordinator.IncrementTimeBy(tmClientState.TrustingPeriod) - suite.coordinator.CommitBlock(suite.chainA, suite.chainB) - - tc.malleate() - - subjectClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID) - substituteClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substitutePath.EndpointA.ClientID) - - err = subjectClientState.CheckSubstituteAndUpdateState(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), subjectClientStore, substituteClientStore, substituteClientState) - suite.Require().Error(err) - }) - } -} - -func (suite *WasmTestSuite) TestCheckSubstituteAndUpdateStateTendermint() { - testCases := []struct { - name string - FreezeClient bool - expPass bool - }{ { - name: "PASS: update checks are deprecated, client is not frozen", - FreezeClient: false, - expPass: true, + "failure: checksums do not match", + func() { + substituteClientState = &types.ClientState{ + CodeId: []byte("invalid"), + } + }, + clienttypes.ErrInvalidClient, }, { - name: "PASS: update checks are deprecated, client is frozen", - FreezeClient: true, - expPass: true, + "failure: contract returns error", + func() { + suite.mockVM.RegisterSudoCallback( + types.MigrateClientStoreMsg{}, + func(_ cosmwasm.Checksum, _ wasmvmtypes.Env, _ []byte, _ cosmwasm.KVStore, _ cosmwasm.GoAPI, _ cosmwasm.Querier, _ cosmwasm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + return nil, wasmtesting.DefaultGasUsed, wasmtesting.ErrMockContract + }, + ) + }, + types.ErrWasmContractCallFailed, }, } for _, tc := range testCases { tc := tc - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() // reset - - // construct subject using test case parameters - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) - subjectWasmClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*wasmtypes.ClientState) - - var subjectWasmClientStateData exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(subjectWasmClientState.Data, &subjectWasmClientStateData) - suite.Require().NoError(err) - subjectTmClientState := subjectWasmClientStateData.(*ibctm.ClientState) - - if tc.FreezeClient { - subjectTmClientState.FrozenHeight = frozenHeight - } - - subjectTmClientStateBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), subjectTmClientState) - suite.Require().NoError(err) - subjectWasmClientState.Data = subjectTmClientStateBz - subjectPath.EndpointA.SetClientState(subjectWasmClientState) + suite.SetupWasmWithMockVM() + expectedClientStateBz = nil - // construct the substitute to match the subject client - - substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) - substituteWasmClientState := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*wasmtypes.ClientState) - - var substituteWasmClientStateData exported.ClientState - err = suite.chainA.Codec.UnmarshalInterface(substituteWasmClientState.Data, &substituteWasmClientStateData) - suite.Require().NoError(err) - substituteTmClientState := substituteWasmClientStateData.(*ibctm.ClientState) - - // update trusting period of substitute client state - substituteTmClientState.TrustingPeriod = time.Hour * 24 * 7 - - substituteTmClientStateBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), substituteTmClientState) - suite.Require().NoError(err) - substituteWasmClientState.Data = substituteTmClientStateBz - substitutePath.EndpointA.SetClientState(substituteWasmClientState) - - // update substitute a few times - for i := 0; i < 3; i++ { - err := substitutePath.EndpointA.UpdateClient() - suite.Require().NoError(err) - // skip a block - suite.coordinator.CommitBlock(suite.chainA, suite.chainB) - } - - // get updated substitute - substituteWasmClientState = suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*wasmtypes.ClientState) - err = suite.chainA.Codec.UnmarshalInterface(substituteWasmClientState.Data, &substituteWasmClientStateData) + endpointA := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpointA.CreateClient() suite.Require().NoError(err) - substituteTmClientState = substituteWasmClientStateData.(*ibctm.ClientState) - // test that subject gets updated chain-id - newChainID := "new-chain-id" - substituteTmClientState.ChainId = newChainID + subjectClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpointA.ClientID) + subjectClientState := endpointA.GetClientState() - substituteTmClientStateBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), substituteTmClientState) + substituteEndpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err = substituteEndpoint.CreateClient() suite.Require().NoError(err) - substituteWasmClientState.Data = substituteTmClientStateBz - substitutePath.EndpointA.SetClientState(substituteWasmClientState) - subjectClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID) - substituteClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substitutePath.EndpointA.ClientID) + substituteClientState = substituteEndpoint.GetClientState() + substituteClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substituteEndpoint.ClientID) - expectedConsState := substitutePath.EndpointA.GetConsensusState(substituteWasmClientState.GetLatestHeight()) - expectedProcessedTime, found := ibctm.GetProcessedTime(substituteClientStore, substituteWasmClientState.GetLatestHeight()) - suite.Require().True(found) - expectedProcessedHeight, found := GetProcessedHeight(substituteClientStore, substituteWasmClientState.GetLatestHeight()) - suite.Require().True(found) - expectedIterationKey := ibctm.GetIterationKey(substituteClientStore, substituteWasmClientState.GetLatestHeight()) - - err = subjectWasmClientState.CheckSubstituteAndUpdateState(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), subjectClientStore, substituteClientStore, substituteWasmClientState) + tc.malleate() - if tc.expPass { - suite.Require().NoError(err) + err = subjectClientState.CheckSubstituteAndUpdateState( + suite.chainA.GetContext(), + suite.chainA.Codec, + subjectClientStore, + substituteClientStore, + substituteClientState, + ) - updatedWasmClient := subjectPath.EndpointA.GetClientState().(*wasmtypes.ClientState) - var clientStateData exported.ClientState - err := suite.chainA.Codec.UnmarshalInterface(updatedWasmClient.Data, &clientStateData) + expPass := tc.expErr == nil + if expPass { suite.Require().NoError(err) - updatedTmClientState := clientStateData.(*ibctm.ClientState) - suite.Require().Equal(clienttypes.ZeroHeight(), updatedTmClientState.FrozenHeight) - - subjectClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID) - - // check that the correct consensus state was copied over - suite.Require().Equal(substituteWasmClientState.GetLatestHeight(), updatedWasmClient.GetLatestHeight()) - subjectConsState := subjectPath.EndpointA.GetConsensusState(updatedWasmClient.GetLatestHeight()) - subjectProcessedTime, found := ibctm.GetProcessedTime(subjectClientStore, updatedWasmClient.GetLatestHeight()) - suite.Require().True(found) - subjectProcessedHeight, found := GetProcessedHeight(subjectClientStore, updatedWasmClient.GetLatestHeight()) - suite.Require().True(found) - subjectIterationKey := ibctm.GetIterationKey(subjectClientStore, updatedWasmClient.GetLatestHeight()) - suite.Require().Equal(expectedConsState, subjectConsState) - suite.Require().Equal(expectedProcessedTime, subjectProcessedTime) - suite.Require().Equal(expectedProcessedHeight, subjectProcessedHeight) - suite.Require().Equal(expectedIterationKey, subjectIterationKey) - - suite.Require().Equal(newChainID, updatedTmClientState.ChainId) - suite.Require().Equal(time.Hour*24*7, updatedTmClientState.TrustingPeriod) + clientStateBz := subjectClientStore.Get(host.ClientStateKey()) + suite.Require().Equal(expectedClientStateBz, clientStateBz) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) } }) } } - -func GetProcessedHeight(clientStore sdk.KVStore, height exported.Height) (uint64, bool) { - key := ibctm.ProcessedHeightKey(height) - bz := clientStore.Get(key) - if len(bz) == 0 { - return 0, false - } - - return sdk.BigEndianToUint64(bz), true -} diff --git a/modules/light-clients/08-wasm/types/querier.go b/modules/light-clients/08-wasm/types/querier.go new file mode 100644 index 00000000000..c204fd42c7c --- /dev/null +++ b/modules/light-clients/08-wasm/types/querier.go @@ -0,0 +1,178 @@ +package types + +import ( + "encoding/json" + "fmt" + "slices" + + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" +) + +/* +`queryHandler` is a contextual querier which references the global `ibcwasm.QueryPluginsI` +to handle queries. The global `ibcwasm.QueryPluginsI` points to a `types.QueryPlugins` which +contains two sub-queriers: `types.CustomQuerier` and `types.StargateQuerier`. These sub-queriers +can be replaced by the user through the options api in the keeper. + +In addition, the `types.StargateQuerier` references a global `ibcwasm.QueryRouter` which points +to `baseapp.GRPCQueryRouter`. + +This design is based on wasmd's (v0.50.0) querier plugin design. +*/ + +var ( + _ wasmvmtypes.Querier = (*queryHandler)(nil) + _ ibcwasm.QueryPluginsI = (*QueryPlugins)(nil) +) + +// queryHandler is a wrapper around the sdk.Context and the CallerID that calls +// into the query plugins. +type queryHandler struct { + Ctx sdk.Context + CallerID string +} + +// newQueryHandler returns a default querier that can be used in the contract. +func newQueryHandler(ctx sdk.Context, callerID string) *queryHandler { + return &queryHandler{ + Ctx: ctx, + CallerID: callerID, + } +} + +// GasConsumed implements the wasmvmtypes.Querier interface. +func (q *queryHandler) GasConsumed() uint64 { + return VMGasRegister.ToWasmVMGas(q.Ctx.GasMeter().GasConsumed()) +} + +// Query implements the wasmvmtypes.Querier interface. +func (q *queryHandler) Query(request wasmvmtypes.QueryRequest, gasLimit uint64) ([]byte, error) { + sdkGas := VMGasRegister.FromWasmVMGas(gasLimit) + + // discard all changes/events in subCtx by not committing the cached context + subCtx, _ := q.Ctx.WithGasMeter(storetypes.NewGasMeter(sdkGas)).CacheContext() + + // make sure we charge the higher level context even on panic + defer func() { + q.Ctx.GasMeter().ConsumeGas(subCtx.GasMeter().GasConsumed(), "contract sub-query") + }() + + res, err := ibcwasm.GetQueryPlugins().HandleQuery(subCtx, q.CallerID, request) + if err == nil { + return res, nil + } + + fmt.Println("Redacting query error", "cause", err) + return nil, redactError(err) +} + +type ( + CustomQuerier func(ctx sdk.Context, request json.RawMessage) ([]byte, error) + StargateQuerier func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) + + // QueryPlugins is a list of queriers that can be used to extend the default querier. + QueryPlugins struct { + Custom CustomQuerier + Stargate StargateQuerier + } +) + +// Merge merges the query plugin with a provided one. +func (e QueryPlugins) Merge(x *QueryPlugins) QueryPlugins { + // only update if this is non-nil and then only set values + if x == nil { + return e + } + + if x.Custom != nil { + e.Custom = x.Custom + } + + if x.Stargate != nil { + e.Stargate = x.Stargate + } + + return e +} + +// HandleQuery implements the ibcwasm.QueryPluginsI interface. +func (e QueryPlugins) HandleQuery(ctx sdk.Context, caller string, request wasmvmtypes.QueryRequest) ([]byte, error) { + if request.Stargate != nil { + return e.Stargate(ctx, request.Stargate) + } + + if request.Custom != nil { + return e.Custom(ctx, request.Custom) + } + + return nil, wasmvmtypes.UnsupportedRequest{Kind: "Unsupported query request"} +} + +// NewDefaultQueryPlugins returns the default set of query plugins +func NewDefaultQueryPlugins() *QueryPlugins { + return &QueryPlugins{ + Custom: RejectCustomQuerier(), + Stargate: AcceptListStargateQuerier([]string{}), + } +} + +// AcceptListStargateQuerier allows all queries that are in the provided accept list. +// This function returns protobuf encoded responses in bytes. +func AcceptListStargateQuerier(acceptedQueries []string) func(sdk.Context, *wasmvmtypes.StargateQuery) ([]byte, error) { + return func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { + // A default list of accepted queries can be added here. + // accepted = append(defaultAcceptList, accepted...) + + isAccepted := slices.Contains(acceptedQueries, request.Path) + if !isAccepted { + return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("'%s' path is not allowed from the contract", request.Path)} + } + + route := ibcwasm.GetQueryRouter().Route(request.Path) + if route == nil { + return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("No route to query '%s'", request.Path)} + } + + res, err := route(ctx, &abci.RequestQuery{ + Data: request.Data, + Path: request.Path, + }) + if err != nil { + return nil, err + } + if res == nil || res.Value == nil { + return nil, wasmvmtypes.InvalidResponse{Err: "Query response is empty"} + } + + return res.Value, nil + } +} + +// RejectCustomQuerier rejects all custom queries +func RejectCustomQuerier() func(sdk.Context, json.RawMessage) ([]byte, error) { + return func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { + return nil, wasmvmtypes.UnsupportedRequest{Kind: "Custom queries are not allowed"} + } +} + +// Wasmd Issue [#759](https://github.com/CosmWasm/wasmd/issues/759) +// Don't return error string for worries of non-determinism +func redactError(err error) error { + // Do not redact system errors + // SystemErrors must be created in 08-wasm and we can ensure determinism + if wasmvmtypes.ToSystemError(err) != nil { + return err + } + + codespace, code, _ := errorsmod.ABCIInfo(err, false) + return fmt.Errorf("codespace: %s, code: %d", codespace, code) +} diff --git a/modules/light-clients/08-wasm/types/store.go b/modules/light-clients/08-wasm/types/store.go index e642eefa58a..047317b4c06 100644 --- a/modules/light-clients/08-wasm/types/store.go +++ b/modules/light-clients/08-wasm/types/store.go @@ -2,31 +2,32 @@ package types import ( "bytes" + "context" + errorsmod "cosmossdk.io/errors" + wasmvm "github.com/CosmWasm/wasmvm" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" "io" + "cosmossdk.io/store/cachekv" + "cosmossdk.io/store/tracekv" + storetypes "cosmossdk.io/store/types" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/cachekv" - "github.com/cosmos/cosmos-sdk/store/listenkv" - "github.com/cosmos/cosmos-sdk/store/tracekv" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) // WrappedStore combines two KVStores into one while transparently routing the calls based on key prefix type WrappedStore struct { - first sdk.KVStore - second sdk.KVStore + first storetypes.KVStore + second storetypes.KVStore firstPrefix []byte secondPrefix []byte } -func NewWrappedStore(first, second sdk.KVStore, firstPrefix, secondPrefix []byte) WrappedStore { +func NewWrappedStore(first, second storetypes.KVStore, firstPrefix, secondPrefix []byte) WrappedStore { return WrappedStore{ first: first, second: second, @@ -55,11 +56,11 @@ func (ws WrappedStore) GetStoreType() storetypes.StoreType { return ws.first.GetStoreType() } -func (ws WrappedStore) Iterator(start, end []byte) sdk.Iterator { +func (ws WrappedStore) Iterator(start, end []byte) storetypes.Iterator { return ws.getStore(start).Iterator(ws.trimPrefix(start), ws.trimPrefix(end)) } -func (ws WrappedStore) ReverseIterator(start, end []byte) sdk.Iterator { +func (ws WrappedStore) ReverseIterator(start, end []byte) storetypes.Iterator { return ws.getStore(start).ReverseIterator(ws.trimPrefix(start), ws.trimPrefix(end)) } @@ -71,10 +72,6 @@ func (ws WrappedStore) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContex return cachekv.NewStore(tracekv.NewStore(ws, w, tc)) } -func (ws WrappedStore) CacheWrapWithListeners(storeKey storetypes.StoreKey, listeners []storetypes.WriteListener) storetypes.CacheWrap { - return cachekv.NewStore(listenkv.NewStore(ws, storeKey, listeners)) -} - func (ws WrappedStore) trimPrefix(key []byte) []byte { if bytes.HasPrefix(key, ws.firstPrefix) { key = bytes.TrimPrefix(key, ws.firstPrefix) @@ -85,7 +82,7 @@ func (ws WrappedStore) trimPrefix(key []byte) []byte { return key } -func (ws WrappedStore) getStore(key []byte) sdk.KVStore { +func (ws WrappedStore) getStore(key []byte) storetypes.KVStore { if bytes.HasPrefix(key, ws.firstPrefix) { return ws.first } @@ -94,14 +91,14 @@ func (ws WrappedStore) getStore(key []byte) sdk.KVStore { } // setClientState stores the client state -func setClientState(clientStore sdk.KVStore, cdc codec.BinaryCodec, clientState *ClientState) { +func setClientState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, clientState *ClientState) { key := host.ClientStateKey() val := clienttypes.MustMarshalClientState(cdc, clientState) clientStore.Set(key, val) } // setConsensusState stores the consensus state at the given height. -func setConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, consensusState *ConsensusState, height exported.Height) { +func setConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryCodec, consensusState *ConsensusState, height exported.Height) { key := host.ConsensusStateKey(height) val := clienttypes.MustMarshalConsensusState(cdc, consensusState) clientStore.Set(key, val) @@ -109,10 +106,10 @@ func setConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, consensus // GetConsensusState retrieves the consensus state from the client prefixed // store. An error is returned if the consensus state does not exist. -func GetConsensusState(store sdk.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, error) { +func GetConsensusState(store storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, error) { bz := store.Get(host.ConsensusStateKey(height)) if bz == nil { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( clienttypes.ErrConsensusStateNotFound, "consensus state does not exist for height %s", height, ) @@ -120,12 +117,12 @@ func GetConsensusState(store sdk.KVStore, cdc codec.BinaryCodec, height exported consensusStateI, err := clienttypes.UnmarshalConsensusState(cdc, bz) if err != nil { - return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "unmarshal error: %v", err) + return nil, errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "unmarshal error: %v", err) } consensusState, ok := consensusStateI.(*ConsensusState) if !ok { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( clienttypes.ErrInvalidConsensus, "invalid consensus type %T, expected %T", consensusState, &ConsensusState{}, ) @@ -138,11 +135,11 @@ var _ wasmvmtypes.KVStore = &StoreAdapter{} // StoreAdapter adapter to bridge SDK store impl to wasmvm type StoreAdapter struct { - parent sdk.KVStore + parent storetypes.KVStore } // NewStoreAdapter constructor -func NewStoreAdapter(s sdk.KVStore) *StoreAdapter { +func NewStoreAdapter(s storetypes.KVStore) *StoreAdapter { if s == nil { panic("store must not be nil") } @@ -168,3 +165,47 @@ func (s StoreAdapter) Iterator(start, end []byte) wasmvmtypes.Iterator { func (s StoreAdapter) ReverseIterator(start, end []byte) wasmvmtypes.Iterator { return s.parent.ReverseIterator(start, end) } + +// Checksum is a type alias used for wasm byte code checksums. +type Checksum = wasmvmtypes.Checksum + +// CreateChecksum creates a sha256 checksum from the given wasm code, it forwards the +// call to the wasmvm package. The code is checked for the following conditions: +// - code length is zero. +// - code length is less than 4 bytes (magic number length). +// - code does not start with the wasm magic number. +func CreateChecksum(code []byte) (Checksum, error) { + return wasmvm.CreateChecksum(code) +} + +// GetAllChecksums is a helper to get all checksums from the store. +// It returns an empty slice if no checksums are found +func GetAllChecksums(ctx context.Context) ([]Checksum, error) { + iterator, err := ibcwasm.Checksums.Iterate(ctx, nil) + if err != nil { + return nil, err + } + + keys, err := iterator.Keys() + if err != nil { + return nil, err + } + + checksums := []Checksum{} + for _, key := range keys { + checksums = append(checksums, key) + } + + return checksums, nil +} + +// HasChecksum returns true if the given checksum exists in the store and +// false otherwise. +func HasChecksum(ctx context.Context, checksum Checksum) bool { + found, err := ibcwasm.Checksums.Has(ctx, checksum) + if err != nil { + return false + } + + return found +} diff --git a/modules/light-clients/08-wasm/types/types_test.go b/modules/light-clients/08-wasm/types/types_test.go index 2292a2e9378..63f69b5254a 100644 --- a/modules/light-clients/08-wasm/types/types_test.go +++ b/modules/light-clients/08-wasm/types/types_test.go @@ -1,321 +1,130 @@ package types_test import ( - "encoding/base64" - "encoding/hex" + storetypes "cosmossdk.io/store/types" "encoding/json" - "os" + "errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "testing" - "time" - dbm "github.com/cometbft/cometbft-db" - tmjson "github.com/cometbft/cometbft/libs/json" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + dbm "github.com/cosmos/cosmos-db" + testifysuite "github.com/stretchr/testify/suite" + + "cosmossdk.io/log" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - tmclient "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - "github.com/cosmos/ibc-go/v7/testing/simapp" - "github.com/stretchr/testify/suite" + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + simapp "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing/simapp" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctesting "github.com/cosmos/ibc-go/v8/testing" ) const ( - chainID = "gaia" - chainIDRevision0 = "gaia-revision-0" - chainIDRevision1 = "gaia-revision-1" - clientID = "gaiamainnet" - trustingPeriod time.Duration = time.Hour * 24 * 7 * 2 - ubdPeriod time.Duration = time.Hour * 24 * 7 * 3 - maxClockDrift time.Duration = time.Second * 10 + tmClientID = "07-tendermint-0" + defaultWasmClientID = "08-wasm-0" ) -var ( - height = clienttypes.NewHeight(0, 4) - newClientHeight = clienttypes.NewHeight(1, 1) - upgradePath = []string{"upgrade", "upgradedIBCState"} -) +type TypesTestSuite struct { + testifysuite.Suite + coordinator *ibctesting.Coordinator + chainA *ibctesting.TestChain + mockVM *wasmtesting.MockWasmEngine -type WasmTestSuite struct { - suite.Suite - coordinator *ibctesting.Coordinator - chainA *ibctesting.TestChain - chainB *ibctesting.TestChain - ctx sdk.Context - now time.Time - store sdk.KVStore - clientState exported.ClientState - consensusState wasmtypes.ConsensusState - codeID []byte - testData map[string]string - wasmKeeper keeper.Keeper + checksum types.Checksum } -func (suite *WasmTestSuite) SetupWasmTendermint() { - ibctesting.DefaultTestingAppInit = ibctesting.SetupTestingApp - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) - suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) - suite.chainA.SetWasm(true) - suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) - suite.chainB.SetWasm(true) - - // commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1) - suite.coordinator.CommitNBlocks(suite.chainA, 2) - suite.coordinator.CommitNBlocks(suite.chainB, 2) - - suite.ctx = suite.chainA.GetContext().WithBlockGasMeter(sdk.NewInfiniteGasMeter()) - suite.store = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.ctx, "08-wasm-0") - - err := os.MkdirAll("tmp", 0o755) - suite.Require().NoError(err) - suite.wasmKeeper = suite.chainA.App.GetWasmKeeper() - wasmContract, err := os.ReadFile("test_data/ics07_tendermint_cw.wasm.gz") - suite.Require().NoError(err) - - msg := wasmtypes.NewMsgPushNewWasmCode(authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmContract) - response, err := suite.wasmKeeper.PushNewWasmCode(suite.chainA.GetContext(), msg) - suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId - - response, err = suite.chainB.App.GetWasmKeeper().PushNewWasmCode(suite.chainB.GetContext(), msg) - suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId - - suite.coordinator.SetCodeID(suite.codeID) - suite.coordinator.CommitNBlocks(suite.chainA, 2) - suite.coordinator.CommitNBlocks(suite.chainB, 2) +func TestWasmTestSuite(t *testing.T) { + testifysuite.Run(t, new(TypesTestSuite)) } -func SetupTestingWithChannel() (ibctesting.TestingApp, map[string]json.RawMessage) { - db := dbm.NewMemDB() - encCdc := simapp.MakeTestEncodingConfig() - app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 5, encCdc, simtestutil.EmptyAppOptions{}) - genesisState := simapp.NewDefaultGenesisState(encCdc.Marshaler) - - bytes, err := os.ReadFile("test_data/genesis.json") - if err != nil { - panic(err) - } - - var genesis tmtypes.GenesisDoc - // NOTE: Tendermint uses a custom JSON decoder for GenesisDoc - err = tmjson.Unmarshal(bytes, &genesis) - if err != nil { - panic(err) - } - - var appState map[string]json.RawMessage - err = json.Unmarshal(genesis.AppState, &appState) - if err != nil { - panic(err) - } +func (suite *TypesTestSuite) SetupTest() { + ibctesting.DefaultTestingAppInit = setupTestingApp - if appState[exported.ModuleName] != nil { - genesisState[exported.ModuleName] = appState[exported.ModuleName] - } - - return app, genesisState + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1) + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) } -func (suite *WasmTestSuite) SetupWithChannel() { - ibctesting.DefaultTestingAppInit = SetupTestingWithChannel - suite.CommonSetupTest() - clientState, ok := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.ctx, "08-wasm-0") - if ok { - suite.clientState = clientState - // Update with current contract hash - suite.clientState.(*wasmtypes.ClientState).CodeId = suite.codeID - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", suite.clientState) - } +func init() { + ibctesting.DefaultTestingAppInit = setupTestingApp } -func (suite *WasmTestSuite) SetupWithEmptyClient() { - ibctesting.DefaultTestingAppInit = ibctesting.SetupTestingApp - suite.CommonSetupTest() - - clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_data"]) - suite.Require().NoError(err) - - wasmClientState := wasmtypes.ClientState{ - Data: clientStateData, - CodeId: suite.codeID, - LatestHeight: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 4, - }, - } - suite.clientState = &wasmClientState - - consensusStateData, err := base64.StdEncoding.DecodeString(suite.testData["consensus_state_data"]) - suite.Require().NoError(err) - wasmConsensusState := wasmtypes.ConsensusState{ - Data: consensusStateData, - Timestamp: uint64(1678304292), +// GetSimApp returns the duplicated SimApp from within the 08-wasm directory. +// This must be used instead of chain.GetSimApp() for tests within this directory. +func GetSimApp(chain *ibctesting.TestChain) *simapp.SimApp { + app, ok := chain.App.(*simapp.SimApp) + if !ok { + panic(errors.New("chain is not a simapp.SimApp")) } - suite.consensusState = wasmConsensusState + return app } -func (suite *WasmTestSuite) CommonSetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1) - suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) - - // commit some blocks so that QueryProof returns valid proof (cannot return valid query if height <= 1) - suite.coordinator.CommitNBlocks(suite.chainA, 2) - - testData, err := os.ReadFile("test_data/data.json") - suite.Require().NoError(err) - err = json.Unmarshal(testData, &suite.testData) - suite.Require().NoError(err) - - suite.ctx = suite.chainA.GetContext().WithBlockGasMeter(sdk.NewInfiniteGasMeter()) - suite.store = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.ctx, "08-wasm-0") - - err = os.MkdirAll("tmp", 0o755) - suite.Require().NoError(err) - suite.wasmKeeper = suite.chainA.App.GetWasmKeeper() - wasmContract, err := os.ReadFile("test_data/ics10_grandpa_cw.wasm.gz") - suite.Require().NoError(err) - - msg := wasmtypes.NewMsgPushNewWasmCode(authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmContract) - response, err := suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) - suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId -} - -func (suite *WasmTestSuite) TestPushNewWasmCodeWithErrors() { - suite.SetupWithEmptyClient() - signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() - data, err := os.ReadFile("test_data/ics10_grandpa_cw.wasm.gz") - suite.Require().NoError(err) - - // test wasmcode duplication - msg := wasmtypes.NewMsgPushNewWasmCode(signer, data) - _, err = suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) - suite.Require().Error(err) - - // test invalid wasm code - msg = wasmtypes.NewMsgPushNewWasmCode(signer, []byte{}) - _, err = suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) - suite.Require().Error(err) +// setupTestingApp provides the duplicated simapp which is specific to the 08-wasm module on chain creation. +func setupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) { + db := dbm.NewMemDB() + app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, nil) + return app, app.DefaultGenesis() } -func (suite *WasmTestSuite) TestUpdateWasmCodeId() { - suite.SetupWithChannel() - signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() - data, err := os.ReadFile("test_data/ics07_tendermint_cw.wasm.gz") - suite.Require().NoError(err) - - msg := wasmtypes.NewMsgPushNewWasmCode(signer, data) - response, err := suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) - suite.Require().NoError(err) - newCodeId := response.CodeId +// SetupWasmWithMockVM sets up mock cometbft chain with a mock vm. +func (suite *TypesTestSuite) SetupWasmWithMockVM() { + ibctesting.DefaultTestingAppInit = suite.setupWasmWithMockVM - msgUpdate := wasmtypes.NewMsgUpdateWasmCodeId(signer, newCodeId, "08-wasm-0") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().NoError(err) + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1) + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) + suite.checksum = storeWasmCode(suite, wasmtesting.Code) - cs, ok := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.ctx, "08-wasm-0") - suite.Require().True(ok) - wasmCs, ok := cs.(*wasmtypes.ClientState) - suite.Require().True(ok) - suite.Require().Equal(newCodeId, wasmCs.CodeId) + wasmtesting.AllowWasmClients(suite.chainA) } -func (suite *WasmTestSuite) TestUpdateWasmCodeIdWithErrors() { - suite.SetupWithEmptyClient() - signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() - data, err := os.ReadFile("test_data/ics07_tendermint_cw.wasm.gz") - suite.Require().NoError(err) - - msg := wasmtypes.NewMsgPushNewWasmCode(signer, data) - response, err := suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) - suite.Require().NoError(err) - newCodeId := response.CodeId - - // test invalid signer - msgUpdate := wasmtypes.NewMsgUpdateWasmCodeId("invalid", newCodeId, "08-wasm-0") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().Error(err) - - // test invalid code id - msgUpdate = wasmtypes.NewMsgUpdateWasmCodeId(signer, []byte{}, "08-wasm-0") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().Error(err) - - // test non-existing code id - nonExistingCodeId := make([]byte, 32) - msgUpdate = wasmtypes.NewMsgUpdateWasmCodeId(signer, nonExistingCodeId, "08-wasm-0") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().Error(err) - - // test invalid client id - msgUpdate = wasmtypes.NewMsgUpdateWasmCodeId(signer, newCodeId, "invalid\n") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().Error(err) - - // test non-existing client id - msgUpdate = wasmtypes.NewMsgUpdateWasmCodeId(signer, newCodeId, "00-nonexist") - _, err = suite.wasmKeeper.UpdateWasmCodeId(suite.ctx, msgUpdate) - suite.Require().Error(err) -} +func (suite *TypesTestSuite) setupWasmWithMockVM() (ibctesting.TestingApp, map[string]json.RawMessage) { + suite.mockVM = wasmtesting.NewMockWasmEngine() -func (suite *WasmTestSuite) TestQueryWasmCode() { - // test invalid query request - _, err := suite.wasmKeeper.WasmCode(suite.ctx, &wasmtypes.WasmCodeQuery{}) - suite.Require().Error(err) + suite.mockVM.InstantiateFn = func(checksum 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) { + var payload types.InstantiateMessage + err := json.Unmarshal(initMsg, &payload) + suite.Require().NoError(err) - _, err = suite.wasmKeeper.WasmCode(suite.ctx, &wasmtypes.WasmCodeQuery{CodeId: "test"}) - suite.Require().Error(err) + wrappedClientState := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), payload.ClientState) - // test valid query request - res, err := suite.wasmKeeper.WasmCode(suite.ctx, &wasmtypes.WasmCodeQuery{CodeId: hex.EncodeToString(suite.codeID)}) - suite.Require().NoError(err) - suite.Require().NotNil(res.Code) -} + clientState := types.NewClientState(payload.ClientState, payload.Checksum, wrappedClientState.GetLatestHeight().(clienttypes.Height)) + clientStateBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), clientState) + store.Set(host.ClientStateKey(), clientStateBz) -func (suite *WasmTestSuite) TestQueryAllWasmCode() { - // test valid query request - res, err := suite.wasmKeeper.AllWasmCodeID(suite.ctx, &wasmtypes.AllWasmCodeIDQuery{}) - suite.Require().NoError(err) - suite.Require().NotNil(res.CodeIds) -} + consensusState := types.NewConsensusState(payload.ConsensusState) + consensusStateBz := clienttypes.MustMarshalConsensusState(suite.chainA.App.AppCodec(), consensusState) + store.Set(host.ConsensusStateKey(clientState.GetLatestHeight()), consensusStateBz) -func TestWasmTestSuite(t *testing.T) { - suite.Run(t, new(WasmTestSuite)) -} + resp, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) -func NewTendermintClientState(endpoint *ibctesting.Endpoint, height exported.Height) tmclient.ClientState { - tmConfig, ok := endpoint.ClientConfig.(*ibctesting.TendermintConfig) - if !ok { - panic("Panic casting ClientConfig to TendermindConfig") + return &wasmvmtypes.Response{Data: resp}, 0, nil } - clientHeight := height.(clienttypes.Height) + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(checksum wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.StatusResult{Status: exported.Active.String()}) + suite.Require().NoError(err) + return resp, wasmtesting.DefaultGasUsed, nil + }) - clientState := tmclient.NewClientState( - endpoint.Counterparty.ClientID, - tmConfig.TrustLevel, - tmConfig.TrustingPeriod, - tmConfig.UnbondingPeriod, - tmConfig.MaxClockDrift, - clientHeight, - commitmenttypes.GetSDKSpecs(), - ibctesting.UpgradePath, - ) + db := dbm.NewMemDB() + app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}, suite.mockVM) - return *clientState + // reset DefaultTestingAppInit to its original value + ibctesting.DefaultTestingAppInit = setupTestingApp + return app, app.DefaultGenesis() } -func getAltSigners(altVal *tmtypes.Validator, altPrivVal tmtypes.PrivValidator) map[string]tmtypes.PrivValidator { - return map[string]tmtypes.PrivValidator{altVal.Address.String(): altPrivVal} +// storeWasmCode stores the wasm code on chain and returns the checksum. +func storeWasmCode(suite *TypesTestSuite, wasmCode []byte) types.Checksum { + ctx := suite.chainA.GetContext().WithBlockGasMeter(storetypes.NewInfiniteGasMeter()) + msg := types.NewMsgPushNewWasmCode(authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmCode) + response, err := GetSimApp(suite.chainA).WasmClientKeeper.PushNewWasmCode(ctx, msg) + suite.Require().NoError(err) + suite.Require().NotNil(response.CodeId) + return response.CodeId } diff --git a/modules/light-clients/08-wasm/types/update.go b/modules/light-clients/08-wasm/types/update.go index 4ec92059836..33c1618afb4 100644 --- a/modules/light-clients/08-wasm/types/update.go +++ b/modules/light-clients/08-wasm/types/update.go @@ -1,11 +1,12 @@ package types import ( + storetypes "cosmossdk.io/store/types" "fmt" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ exported.ClientState = (*ClientState)(nil) @@ -26,7 +27,7 @@ type verifyClientMessageInnerPayload struct { // It must handle each type of ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState, and UpdateStateOnMisbehaviour // will assume that the content of the ClientMessage has been verified and can be trusted. An error should be returned // if the ClientMessage fails to verify. -func (c ClientState) VerifyClientMessage(ctx sdk.Context, _ codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) error { +func (c ClientState) VerifyClientMessage(ctx sdk.Context, _ codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) error { clientMsgConcrete := clientMessageConcretePayloadClientMessage{ Header: nil, Misbehaviour: nil, @@ -60,12 +61,12 @@ type clientMessageConcretePayload struct { } // Client state and new consensus states are updated in the store by the contract -func (c ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, store sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height { +func (c ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, store storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { header, ok := clientMsg.(*Header) if !ok { panic(fmt.Errorf("expected type %T, got %T", &Header{}, clientMsg)) } - + payload := updateStatePayload{ UpdateState: updateStateInnerPayload{ ClientMessage: clientMessageConcretePayload{ @@ -91,7 +92,7 @@ type updateStateOnMisbehaviourInnerPayload struct { // UpdateStateOnMisbehaviour should perform appropriate state changes on a client state given that misbehaviour has been detected and verified // Client state is updated in the store by contract -func (c ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, _ codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) { +func (c ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, _ codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) { clientMsgConcrete := clientMessageConcretePayloadClientMessage{ Header: nil, Misbehaviour: nil, diff --git a/modules/light-clients/08-wasm/types/update_test.go b/modules/light-clients/08-wasm/types/update_test.go index 863915b06e5..f60658669bc 100644 --- a/modules/light-clients/08-wasm/types/update_test.go +++ b/modules/light-clients/08-wasm/types/update_test.go @@ -1,898 +1,291 @@ package types_test import ( - "encoding/base64" - "time" - - tmtypes "github.com/cometbft/cometbft/types" - sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - ibctestingmock "github.com/cosmos/ibc-go/v7/testing/mock" + "encoding/json" + "fmt" + + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v8/testing" ) -func (suite *WasmTestSuite) TestVerifyHeaderGrandpa() { - var ( - clientMsg exported.ClientMessage - clientState exported.ClientState - ) - - testCases := []struct { - name string - setup func() - expPass bool - }{ - { - "successful verify header", func() {}, - true, - }, - { - "unsuccessful verify header: para id mismatch", func() { - cs, err := base64.StdEncoding.DecodeString(suite.testData["client_state_para_id_mismatch"]) - suite.Require().NoError(err) - - clientState = &wasmtypes.ClientState{ - Data: cs, - CodeId: suite.codeID, - LatestHeight: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 36, - }, - } - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, "08-wasm-0", clientState) - }, - false, - }, - { - "unsuccessful verify header: head height < consensus height", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header_old"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 29, - }, - } - }, - false, - }, - } +func (suite *TypesTestSuite) TestUpdateState() { + mockHeight := clienttypes.NewHeight(1, 50) - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupWithChannel() - clientState = suite.clientState - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } - - tc.setup() - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *WasmTestSuite) TestVerifyHeaderTendermint() { var ( - path *ibctesting.Path - header *wasmtypes.Header + clientMsg exported.ClientMessage + clientStore storetypes.KVStore + expectedClientStateBz []byte ) - // Setup different validators and signers for testing different types of updates - altPrivVal := ibctestingmock.NewPV() - altPubKey, err := altPrivVal.GetPubKey() - suite.Require().NoError(err) - - revisionHeight := int64(height.RevisionHeight) - - // create modified heights to use for test-cases - altVal := tmtypes.NewValidator(altPubKey, 100) - // Create alternative validator set with only altVal, invalid update (too much change in valSet) - altValSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{altVal}) - altSigners := getAltSigners(altVal, altPrivVal) - testCases := []struct { - name string - malleate func() - expPass bool + name string + malleate func() + expPanic error + expHeights []exported.Height }{ { - name: "success", - malleate: func() {}, - expPass: true, - }, - { - name: "successful verify header for header with a previous height", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // passing the CurrentHeader.Height as the block height as it will become a previous height once we commit N blocks - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - - // commit some blocks so that the created Header now has a previous height as the BlockHeight - suite.coordinator.CommitNBlocks(suite.chainB, 5) - - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - }, - expPass: true, - }, - { - name: "successful verify header: header with future height and different validator set", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // Create bothValSet with both suite validator and altVal - bothValSet := tmtypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal)) - bothSigners := suite.chainB.Signers - bothSigners[altVal.Address.String()] = altPrivVal - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+5, trustedHeight, suite.chainB.CurrentHeader.Time, bothValSet, suite.chainB.NextVals, trustedVals, bothSigners) - }, - expPass: true, - }, - { - name: "successful verify header: header with next height and different validator set", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // Create bothValSet with both suite validator and altVal - bothValSet := tmtypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal)) - bothSigners := suite.chainB.Signers - bothSigners[altVal.Address.String()] = altPrivVal - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, bothValSet, suite.chainB.NextVals, trustedVals, bothSigners) - }, - expPass: true, - }, - { - name: "unsuccessful updates, passed in incorrect trusted validators for given consensus state", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - // Create bothValSet with both suite validator and altVal - bothValSet := tmtypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal)) - bothSigners := suite.chainB.Signers - bothSigners[altVal.Address.String()] = altPrivVal - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, bothValSet, bothValSet, bothValSet, bothSigners) - }, - expPass: false, - }, - { - name: "unsuccessful verify header with next height: update header mismatches nextValSetHash", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // this will err as altValSet.Hash() != consState.NextValidatorsHash - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, altValSet, altValSet, trustedVals, altSigners) - }, - expPass: false, - }, - { - name: "unsuccessful update with future height: too much change in validator set", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, altValSet, altValSet, trustedVals, altSigners) - }, - expPass: false, - }, - { - name: "unsuccessful verify header: header height revision and trusted height revision mismatch", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - header = suite.chainB.CreateWasmClientHeader(chainIDRevision1, 3, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - }, - expPass: false, - }, - { - name: "unsuccessful verify header: header height < consensus height", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - heightMinus1 := clienttypes.NewHeight(trustedHeight.RevisionNumber, trustedHeight.RevisionHeight-1) - - // Make new header at height less than latest client state - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, int64(heightMinus1.RevisionHeight), trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - }, - expPass: false, - }, - { - name: "unsuccessful verify header: header basic validation failed", - malleate: func() { - var wasmData exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(header.Data, &wasmData) - suite.Require().NoError(err) - - tmHeader, ok := wasmData.(*ibctm.Header) - suite.Require().True(ok) - - // cause header to fail validatebasic by changing commit height to mismatch header height - tmHeader.SignedHeader.Commit.Height = revisionHeight - 1 - - header.Data, err = suite.chainA.Codec.MarshalInterface(tmHeader) - suite.Require().NoError(err) - }, - expPass: false, - }, - { - name: "unsuccessful verify header: header timestamp is not past last client timestamp", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight)) - suite.Require().True(found) - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time.Add(-time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - }, - expPass: false, - }, - { - name: "unsuccessful verify header: header with incorrect header chain-id", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight)) - suite.Require().True(found) - - header = suite.chainB.CreateWasmClientHeader(chainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - }, - expPass: false, - }, - { - name: "unsuccessful update: trusting period has passed since last client timestamp", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight)) - suite.Require().True(found) - - header = suite.chainA.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height+1, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - - suite.chainB.ExpireClient(ibctesting.TrustingPeriod) - }, - expPass: false, - }, - { - name: "unsuccessful update for a previous revision", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // passing the CurrentHeader.Height as the block height as it will become an update to previous revision once we upgrade the client - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - - // increment the revision of the chain - err := path.EndpointB.UpgradeChain() - suite.Require().NoError(err) - }, - expPass: false, - }, - { - name: "successful update with identical header to a previous update", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // passing the CurrentHeader.Height as the block height as it will become a previous height once we commit N blocks - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - - // update client so the header constructed becomes a duplicate - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) + "success: no update", + func() { + suite.mockVM.RegisterSudoCallback(types.UpdateStateMsg{}, func(_ wasmvm.Checksum, env wasmvmtypes.Env, sudoMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var msg types.SudoMsg + err := json.Unmarshal(sudoMsg, &msg) + suite.Require().NoError(err) + + suite.Require().NotNil(msg.UpdateState) + suite.Require().NotNil(msg.UpdateState.ClientMessage) + suite.Require().Equal(msg.UpdateState.ClientMessage, clienttypes.MustMarshalClientMessage(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientHeader)) + suite.Require().Nil(msg.VerifyMembership) + suite.Require().Nil(msg.VerifyNonMembership) + suite.Require().Nil(msg.UpdateStateOnMisbehaviour) + suite.Require().Nil(msg.VerifyUpgradeAndUpdateState) + + suite.Require().Equal(env.Contract.Address, defaultWasmClientID) + + updateStateResp := types.UpdateStateResult{ + Heights: []clienttypes.Height{}, + } + + resp, err := json.Marshal(updateStateResp) + if err != nil { + return nil, 0, err + } + + return &wasmvmtypes.Response{ + Data: resp, + }, wasmtesting.DefaultGasUsed, nil + }) }, - expPass: true, + nil, + []exported.Height{}, }, { - name: "unsuccessful update to a future revision", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID+"-1", suite.chainB.CurrentHeader.Height+5, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) + "success: update client", + func() { + suite.mockVM.RegisterSudoCallback(types.UpdateStateMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var msg types.SudoMsg + err := json.Unmarshal(sudoMsg, &msg) + suite.Require().NoError(err) + + bz := store.Get(host.ClientStateKey()) + suite.Require().NotEmpty(bz) + clientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, bz).(*types.ClientState) + clientState.LatestHeight = mockHeight + expectedClientStateBz = clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), clientState) + store.Set(host.ClientStateKey(), expectedClientStateBz) + + updateStateResp := types.UpdateStateResult{ + Heights: []clienttypes.Height{mockHeight}, + } + + resp, err := json.Marshal(updateStateResp) + if err != nil { + return nil, 0, err + } + + return &wasmvmtypes.Response{ + Data: resp, + }, wasmtesting.DefaultGasUsed, nil + }) }, - expPass: false, + nil, + []exported.Height{mockHeight}, }, { - name: "unsuccessful update: header height revision and trusted height revision mismatch", - malleate: func() { - trustedHeight := path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - trustedVals, found := suite.chainB.GetValsAtHeight(int64(trustedHeight.RevisionHeight) + 1) - suite.Require().True(found) - - // increment the revision of the chain - err := path.EndpointB.UpgradeChain() - suite.Require().NoError(err) - - header = suite.chainB.CreateWasmClientHeader(suite.chainB.ChainID, suite.chainB.CurrentHeader.Height, trustedHeight, suite.chainB.CurrentHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers) - }, - expPass: false, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - err := path.EndpointA.CreateClient() - suite.Require().NoError(err) - - // ensure counterparty state is committed - suite.coordinator.CommitBlock(suite.chainB) - header, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - - tc.malleate() - - clientState := path.EndpointA.GetClientState() - - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - - err = clientState.VerifyClientMessage(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, header) - - if tc.expPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err) - } - }) - } -} - -func (suite *WasmTestSuite) TestUpdateStateTendermint() { - var ( - path *ibctesting.Path - clientMessage exported.ClientMessage - clientStore sdk.KVStore - consensusHeights []exported.Height - pruneHeight clienttypes.Height - prevClientState exported.ClientState - prevConsensusState exported.ConsensusState - ) - - testCases := []struct { - name string - malleate func() - expResult func() - expPass bool - }{ - { - "success with height later than latest height", func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - suite.Require().True(path.EndpointA.GetClientState().GetLatestHeight().LT(wasmHeader.Height)) - }, + "failure: clientStore prefix does not include clientID", func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - clientState := path.EndpointA.GetClientState() - suite.Require().True(clientState.GetLatestHeight().EQ(wasmHeader.Height)) // new update, updated client state should have changed - suite.Require().True(clientState.GetLatestHeight().EQ(consensusHeights[0])) - }, true, - }, - - { - "success with height earlier than latest height", func() { - // commit a block so the pre-created ClientMessage - // isn't used to update the client to a newer height - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - suite.Require().True(path.EndpointA.GetClientState().GetLatestHeight().GT(wasmHeader.Height)) - - prevClientState = path.EndpointA.GetClientState() + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), ibctesting.InvalidID) }, - func() { - clientState := path.EndpointA.GetClientState() - suite.Require().Equal(clientState, prevClientState) // fill in height, no change to client state - suite.Require().True(clientState.GetLatestHeight().GT(consensusHeights[0])) - }, true, + errorsmod.Wrap(types.ErrWasmContractCallFailed, errorsmod.Wrap(errorsmod.Wrapf(types.ErrRetrieveClientID, "prefix does not contain a valid clientID: %s", errorsmod.Wrapf(host.ErrInvalidID, "invalid client identifier %s", ibctesting.InvalidID)), "failed to retrieve clientID for wasm contract call").Error()), + nil, }, { - "success with duplicate header", func() { - // update client in advance - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // use the same header which just updated the client - clientMessage, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - suite.Require().Equal(path.EndpointA.GetClientState().GetLatestHeight(), wasmHeader.Height) - - prevClientState = path.EndpointA.GetClientState() - prevConsensusState = path.EndpointA.GetConsensusState(wasmHeader.Height) - }, + "failure: invalid ClientMessage type", func() { - clientState := path.EndpointA.GetClientState() - suite.Require().Equal(clientState, prevClientState) - suite.Require().True(clientState.GetLatestHeight().EQ(consensusHeights[0])) - - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - suite.Require().Equal(path.EndpointA.GetConsensusState(wasmHeader.Height), prevConsensusState) - }, true, - }, - { - "success with pruned consensus state", func() { - // this height will be expired and pruned - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - pruneHeight = path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - // Increment the time by a week - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - - // create the consensus state that can be used as trusted height for next update - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // Increment the time by another week, then update the client. - // This will cause the first two consensus states to become expired. - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // ensure counterparty state is committed - suite.coordinator.CommitBlock(suite.chainB) - clientMessage, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) + // SudoCallback left nil because clientMsg is checked by 08-wasm before callbackFn is called. + clientMsg = &ibctm.Misbehaviour{} }, - func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - clientState := path.EndpointA.GetClientState() - suite.Require().True(clientState.GetLatestHeight().EQ(wasmHeader.Height)) // new update, updated client state should have changed - suite.Require().True(clientState.GetLatestHeight().EQ(consensusHeights[0])) - - // ensure consensus state was pruned - _, found := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, pruneHeight) - suite.Require().False(found) - }, true, + fmt.Errorf("expected type %T, got %T", (*types.ClientState)(nil), (*ibctm.Misbehaviour)(nil)), + nil, }, { - "success with pruned consensus state using duplicate header", func() { - // this height will be expired and pruned - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - pruneHeight = path.EndpointA.GetClientState().GetLatestHeight().(clienttypes.Height) - - // assert that a consensus state exists at the prune height - consensusState, found := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, pruneHeight) - suite.Require().True(found) - suite.Require().NotNil(consensusState) - - // Increment the time by a week - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - - // create the consensus state that can be used as trusted height for next update - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // Increment the time by another week, then update the client. - // This will cause the first two consensus states to become expired. - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // use the same header which just updated the client - clientMessage, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - }, + "failure: callbackFn returns error", func() { - wasmHeader, ok := clientMessage.(*wasmtypes.Header) - suite.Require().True(ok) - - clientState := path.EndpointA.GetClientState() - suite.Require().True(clientState.GetLatestHeight().EQ(wasmHeader.Height)) // new update, updated client state should have changed - suite.Require().True(clientState.GetLatestHeight().EQ(consensusHeights[0])) - - // ensure consensus state was pruned - _, found := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, pruneHeight) - suite.Require().False(found) - }, true, - }, - { - "invalid ClientMessage type", func() { - clientMessage = &ibctm.Misbehaviour{} + suite.mockVM.RegisterSudoCallback(types.UpdateStateMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) }, - func() {}, - false, + errorsmod.Wrap(types.ErrWasmContractCallFailed, wasmtesting.ErrMockContract.Error()), + nil, }, } + for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { - suite.SetupWasmTendermint() // reset - path = ibctesting.NewPath(suite.chainA, suite.chainB) + suite.SetupWasmWithMockVM() // reset + expectedClientStateBz = nil - err := path.EndpointA.CreateClient() - suite.Require().NoError(err) + clientMsg = &types.ClientState{ + Data: clienttypes.MustMarshalClientMessage(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientHeader), + } - // ensure counterparty state is committed - suite.coordinator.CommitBlock(suite.chainB) - clientMessage, err = path.EndpointA.Chain.ConstructUpdateWasmClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() suite.Require().NoError(err) + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) tc.malleate() - clientState := path.EndpointA.GetClientState() - clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - - if tc.expPass { - consensusHeights = clientState.UpdateState(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, clientMessage) - - header := clientMessage.(*wasmtypes.Header) - var eHeader exported.ClientMessage - err := suite.chainA.Codec.UnmarshalInterface(header.Data, &eHeader) - tmHeader := eHeader.(*ibctm.Header) - suite.Require().NoError(err) - expTmConsensusState := &ibctm.ConsensusState{ - Timestamp: tmHeader.GetTime(), - Root: commitmenttypes.NewMerkleRoot(tmHeader.Header.GetAppHash()), - NextValidatorsHash: tmHeader.Header.NextValidatorsHash, - } - wasmData, err := suite.chainA.Codec.MarshalInterface(expTmConsensusState) - suite.Require().NoError(err) - expWasmConsensusState := &wasmtypes.ConsensusState{ - Data: wasmData, - Timestamp: expTmConsensusState.GetTimestamp(), - } + clientState := endpoint.GetClientState() - bz := clientStore.Get(host.ConsensusStateKey(header.Height)) - updatedConsensusState := clienttypes.MustUnmarshalConsensusState(suite.chainA.App.AppCodec(), bz) + var heights []exported.Height + updateState := func() { + heights = clientState.UpdateState(suite.chainA.GetContext(), suite.chainA.Codec, clientStore, clientMsg) + } - suite.Require().Equal(expWasmConsensusState, updatedConsensusState) + if tc.expPanic == nil { + updateState() + suite.Require().Equal(tc.expHeights, heights) + if expectedClientStateBz != nil { + clientStateBz := clientStore.Get(host.ClientStateKey()) + suite.Require().Equal(expectedClientStateBz, clientStateBz) + } } else { - suite.Require().Panics(func() { - clientState.UpdateState(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, clientMessage) - }) + suite.Require().PanicsWithError(tc.expPanic.Error(), updateState) } - - // perform custom checks - tc.expResult() }) } } -func (suite *WasmTestSuite) TestPruneConsensusStateTendermint() { - suite.SetupWasmTendermint() - // create path and setup clients - path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) - - // get the first height as it will be pruned first. - var pruneHeight exported.Height - getFirstHeightCb := func(height exported.Height) bool { - pruneHeight = height - return true - } - ctx := path.EndpointA.Chain.GetContext() - clientStore := path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID) - ibctm.IterateConsensusStateAscending(clientStore, getFirstHeightCb) - - // this height will be expired but not pruned - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - expiredHeight := path.EndpointA.GetClientState().GetLatestHeight() - - // expected values that must still remain in store after pruning - expectedConsState, ok := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, expiredHeight) - suite.Require().True(ok) - ctx = path.EndpointA.Chain.GetContext() - clientStore = path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID) - expectedProcessTime, ok := ibctm.GetProcessedTime(clientStore, expiredHeight) - suite.Require().True(ok) - expectedProcessHeight, ok := GetProcessedHeight(clientStore, expiredHeight) - suite.Require().True(ok) - expectedConsKey := ibctm.GetIterationKey(clientStore, expiredHeight) - suite.Require().NotNil(expectedConsKey) - - // Increment the time by a week - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - - // create the consensus state that can be used as trusted height for next update - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // Increment the time by another week, then update the client. - // This will cause the first two consensus states to become expired. - suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - ctx = path.EndpointA.Chain.GetContext() - clientStore = path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID) - - // check that the first expired consensus state got deleted along with all associated metadata - consState, ok := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, pruneHeight) - suite.Require().Nil(consState, "expired consensus state not pruned") - suite.Require().False(ok) - // check processed time metadata is pruned - processTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight) - suite.Require().Equal(uint64(0), processTime, "processed time metadata not pruned") - suite.Require().False(ok) - processHeight, ok := GetProcessedHeight(clientStore, pruneHeight) - suite.Require().Zero(processHeight, "processed height metadata not pruned") - suite.Require().False(ok) - - // check iteration key metadata is pruned - consKey := ibctm.GetIterationKey(clientStore, pruneHeight) - suite.Require().Nil(consKey, "iteration key not pruned") - - // check that second expired consensus state doesn't get deleted - // this ensures that there is a cap on gas cost of UpdateClient - consState, ok = path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, expiredHeight) - suite.Require().Equal(expectedConsState, consState, "consensus state incorrectly pruned") - suite.Require().True(ok) - // check processed time metadata is not pruned - processTime, ok = ibctm.GetProcessedTime(clientStore, expiredHeight) - suite.Require().Equal(expectedProcessTime, processTime, "processed time metadata incorrectly pruned") - suite.Require().True(ok) - - // check processed height metadata is not pruned - processHeight, ok = GetProcessedHeight(clientStore, expiredHeight) - suite.Require().Equal(expectedProcessHeight, processHeight, "processed height metadata incorrectly pruned") - suite.Require().True(ok) - - // check iteration key metadata is not pruned - consKey = ibctm.GetIterationKey(clientStore, expiredHeight) - suite.Require().Equal(expectedConsKey, consKey, "iteration key incorrectly pruned") -} +func (suite *TypesTestSuite) TestUpdateStateOnMisbehaviour() { + mockHeight := clienttypes.NewHeight(1, 50) -func (suite *WasmTestSuite) TestUpdateStateGrandpa() { - var ( - clientMsg exported.ClientMessage - clientState exported.ClientState - ) + var clientMsg exported.ClientMessage + + var expectedClientStateBz []byte testCases := []struct { - name string - setup func() - expPass bool + name string + malleate func() + panicErr error + updatedClientState []byte }{ { - "success with height later than latest height", + "success: no update", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } - // VerifyClientMessage must be run first - err = clientState.VerifyClientMessage(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - suite.Require().NoError(err) + suite.mockVM.RegisterSudoCallback(types.UpdateStateOnMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var msg types.SudoMsg + + err := json.Unmarshal(sudoMsg, &msg) + suite.Require().NoError(err) + + suite.Require().NotNil(msg.UpdateStateOnMisbehaviour) + suite.Require().NotNil(msg.UpdateStateOnMisbehaviour.ClientMessage) + suite.Require().Nil(msg.UpdateState) + suite.Require().Nil(msg.UpdateState) + suite.Require().Nil(msg.VerifyMembership) + suite.Require().Nil(msg.VerifyNonMembership) + suite.Require().Nil(msg.VerifyUpgradeAndUpdateState) + + resp, err := json.Marshal(types.EmptyResult{}) + if err != nil { + return nil, 0, err + } + + return &wasmvmtypes.Response{ + Data: resp, + }, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, + nil, }, { - "success with not verifying client message", + "success: client state updated on valid misbehaviour", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["header"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Header{ - Data: data, - Height: clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, - } + suite.mockVM.RegisterSudoCallback(types.UpdateStateOnMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var msg types.SudoMsg + err := json.Unmarshal(sudoMsg, &msg) + suite.Require().NoError(err) + + // set new client state in store + bz := store.Get(host.ClientStateKey()) + suite.Require().NotEmpty(bz) + clientState := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), bz).(*types.ClientState) + clientState.LatestHeight = mockHeight + expectedClientStateBz = clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), clientState) + store.Set(host.ClientStateKey(), expectedClientStateBz) + + resp, err := json.Marshal(types.EmptyResult{}) + if err != nil { + return nil, 0, err + } + + return &wasmvmtypes.Response{Data: resp}, wasmtesting.DefaultGasUsed, nil + }) }, - true, + nil, + clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), wasmtesting.CreateMockTendermintClientState(mockHeight)), }, { - "invalid ClientMessage type", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["misbehaviour"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Misbehaviour{ - Data: data, - } + "failure: invalid client message", + func() { + clientMsg = &ibctm.Header{} + // we will not register the callback here because this test case does not reach the VM }, - false, + fmt.Errorf("expected type %T, got %T", (*types.ClientState)(nil), (*ibctm.Header)(nil)), + nil, }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithChannel() - clientState = suite.clientState - tc.setup() - - if tc.expPass { - consensusHeights := clientState.UpdateState(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - - clientStateBz := suite.store.Get(host.ClientStateKey()) - suite.Require().NotEmpty(clientStateBz) - - newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz) - - suite.Require().Len(consensusHeights, 1) - suite.Require().Equal(clienttypes.Height{ - RevisionNumber: 2000, - RevisionHeight: 39, - }, consensusHeights[0]) - suite.Require().Equal(consensusHeights[0], newClientState.(*wasmtypes.ClientState).LatestHeight) - } else { - suite.Require().Panics(func() { - clientState.UpdateState(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - }) - } - }) - } -} - -func (suite *WasmTestSuite) TestUpdateStateOnMisbehaviourGrandpa() { - var ( - clientMsg exported.ClientMessage - clientState exported.ClientState - ) - - testCases := []struct { - name string - setup func() - expPass bool - }{ { - "successful update", + "failure: err return from contract vm", func() { - data, err := base64.StdEncoding.DecodeString(suite.testData["misbehaviour"]) - suite.Require().NoError(err) - clientMsg = &wasmtypes.Misbehaviour{ - Data: data, - } - clientState = suite.clientState - }, - true, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupWithChannel() - tc.setup() - - if tc.expPass { - suite.Require().NotPanics(func() { - clientState.UpdateStateOnMisbehaviour(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) + suite.mockVM.RegisterSudoCallback(types.UpdateStateOnMisbehaviourMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract }) - clientStateBz := suite.store.Get(host.ClientStateKey()) - suite.Require().NotEmpty(clientStateBz) - - newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz) - status := newClientState.Status(suite.ctx, suite.store, suite.chainA.Codec) - suite.Require().Equal(exported.Frozen, status) - } else { - suite.Require().Panics(func() { - clientState.UpdateStateOnMisbehaviour(suite.ctx, suite.chainA.Codec, suite.store, clientMsg) - }) - } - }) - } -} - -func (suite *WasmTestSuite) TestUpdateStateOnMisbehaviourTendermint() { - var path *ibctesting.Path - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "success", - func() {}, - true, + }, + errorsmod.Wrap(types.ErrWasmContractCallFailed, wasmtesting.ErrMockContract.Error()), + nil, }, } for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { // reset suite to create fresh application state - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) + suite.SetupWasmWithMockVM() + expectedClientStateBz = nil - err := path.EndpointA.CreateClient() + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() suite.Require().NoError(err) - tc.malleate() - - clientState := path.EndpointA.GetClientState() - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - - misbehaviourHeader, err := path.EndpointA.Chain.ConstructUpdateTMClientHeader(path.EndpointA.Counterparty.Chain, path.EndpointA.ClientID) - suite.Require().NoError(err) - tmMisbehaviour := &ibctm.Misbehaviour{ - Header1: misbehaviourHeader, - Header2: misbehaviourHeader, + store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientMsg = &types.ClientState{ + Data: clienttypes.MustMarshalClientMessage(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientMisbehaviour), } - wasmData, err := suite.chainB.Codec.MarshalInterface(tmMisbehaviour) - suite.Require().NoError(err) - clientMessage := &wasmtypes.Misbehaviour{ - Data: wasmData, - } - clientState.UpdateStateOnMisbehaviour(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, clientMessage) - - if tc.expPass { - clientStateBz := clientStore.Get(host.ClientStateKey()) - suite.Require().NotEmpty(clientStateBz) + clientState := endpoint.GetClientState() - newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz) - newWasmClientState := newClientState.(*wasmtypes.ClientState) - - var innerClientState exported.ClientState - err = suite.chainA.Codec.UnmarshalInterface(newWasmClientState.Data, &innerClientState) - suite.Require().NoError(err) - suite.Require().Equal(misbehaviourHeader.GetHeight(), innerClientState.(*ibctm.ClientState).FrozenHeight) + tc.malleate() - status := clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.Codec) - suite.Require().Equal(exported.Frozen, status) + if tc.panicErr == nil { + clientState.UpdateStateOnMisbehaviour(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), store, clientMsg) + if expectedClientStateBz != nil { + suite.Require().Equal(expectedClientStateBz, store.Get(host.ClientStateKey())) + } + } else { + suite.Require().PanicsWithError(tc.panicErr.Error(), func() { + clientState.UpdateStateOnMisbehaviour(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), store, clientMsg) + }) } }) } diff --git a/modules/light-clients/08-wasm/types/upgrade.go b/modules/light-clients/08-wasm/types/upgrade.go index 10732b37c58..8e3e504216b 100644 --- a/modules/light-clients/08-wasm/types/upgrade.go +++ b/modules/light-clients/08-wasm/types/upgrade.go @@ -1,12 +1,13 @@ package types import ( + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) type verifyUpgradeAndUpdateStatePayload struct { @@ -25,7 +26,7 @@ type verifyUpgradeAndUpdateStateMsgPayload struct { func (c ClientState) VerifyUpgradeAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, - store sdk.KVStore, + store storetypes.KVStore, newClient exported.ClientState, newConsState exported.ConsensusState, proofUpgradeClient, @@ -33,13 +34,13 @@ func (c ClientState) VerifyUpgradeAndUpdateState( ) error { wasmUpgradeClientState, ok := newClient.(*ClientState) if !ok { - return sdkerrors.Wrapf(clienttypes.ErrInvalidClient, "upgraded client state must be wasm light client state. expected %T, got: %T", + return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "upgraded client state must be wasm light client state. expected %T, got: %T", &ClientState{}, wasmUpgradeClientState) } wasmUpgradeConsState, ok := newConsState.(*ConsensusState) if !ok { - return sdkerrors.Wrapf(clienttypes.ErrInvalidConsensus, "upgraded consensus state must be wasm light consensus state. expected %T, got: %T", + return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "upgraded consensus state must be wasm light consensus state. expected %T, got: %T", &ConsensusState{}, wasmUpgradeConsState) } @@ -47,7 +48,7 @@ func (c ClientState) VerifyUpgradeAndUpdateState( lastHeight := c.LatestHeight _, err := GetConsensusState(store, cdc, lastHeight) if err != nil { - return sdkerrors.Wrap(err, "could not retrieve consensus state for lastHeight") + return errorsmod.Wrap(err, "could not retrieve consensus state for lastHeight") } payload := verifyUpgradeAndUpdateStatePayload{ diff --git a/modules/light-clients/08-wasm/types/upgrade_test.go b/modules/light-clients/08-wasm/types/upgrade_test.go index 910c9c0caad..a734561bea4 100644 --- a/modules/light-clients/08-wasm/types/upgrade_test.go +++ b/modules/light-clients/08-wasm/types/upgrade_test.go @@ -1,643 +1,257 @@ package types_test import ( + "encoding/json" "time" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + wasmvm "github.com/CosmWasm/wasmvm" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + + storetypes "cosmossdk.io/store/types" + + wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v8/testing" ) -// TestVerifyUpgrade currently only tests the interface into the contract. -// Test code is used in the grandpa contract. -// New client state, consensus state, and client metadata is expected to be set in the contract on success -func (suite *WasmTestSuite) TestVerifyUpgradeGrandpa() { +func (suite *TypesTestSuite) TestVerifyClientMessage() { var ( - clientState exported.ClientState - upgradedClient exported.ClientState - upgradedConsState exported.ConsensusState - proofUpgradedClient []byte - proofUpgradedConsState []byte - err error - ok bool + clientMsg exported.ClientMessage + clientStore storetypes.KVStore ) testCases := []struct { - name string - setup func() - expPass bool + name string + malleate func() + expErr error }{ { - "successful upgrade", - func() {}, - true, - }, - { - "unsuccessful upgrade: invalid new client state", - func() { - upgradedClient = &solomachine.ClientState{} - }, - false, - }, - { - "unsuccessful upgrade: invalid new consensus state", - func() { - upgradedConsState = &solomachine.ConsensusState{} - }, - false, - }, - { - "unsuccessful upgrade: invalid client state proof", + "success: valid misbehaviour", func() { - proofUpgradedClient = []byte("invalid client state proof") - }, - false, - }, - { - "unsuccessful upgrade: invalid consensus state proof", - func() { - proofUpgradedConsState = []byte("invalid consensus state proof") - }, - false, - }, - } + suite.mockVM.RegisterQueryCallback(types.VerifyClientMessageMsg{}, func(_ wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + var msg *types.QueryMsg - for _, tc := range testCases { - tc := tc - - // reset suite - suite.SetupWithChannel() - clientState = suite.clientState - upgradedClient = suite.clientState - upgradedConsState, ok = suite.chainA.App.GetIBCKeeper().ClientKeeper.GetLatestClientConsensusState(suite.ctx, "08-wasm-0") - suite.Require().True(ok) - proofUpgradedClient = []byte("upgraded client state proof") - proofUpgradedConsState = []byte("upgraded consensus state proof") - - tc.setup() - - err = clientState.VerifyUpgradeAndUpdateState( - suite.ctx, - suite.chainA.Codec, - suite.store, - upgradedClient, - upgradedConsState, - proofUpgradedClient, - proofUpgradedConsState, - ) - - if tc.expPass { - suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name) - clientStateBz := suite.store.Get(host.ClientStateKey()) - suite.Require().NotEmpty(clientStateBz) - newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz) - // Stubbed code will increment client state - suite.Require().Equal(clientState.GetLatestHeight().Increment(), newClientState.GetLatestHeight()) - } else { - suite.Require().Error(err, "verify upgrade passed on invalid case: %s", tc.name) - } - } -} + err := json.Unmarshal(queryMsg, &msg) + suite.Require().NoError(err) -func (suite *WasmTestSuite) TestVerifyUpgradeTendermint() { - var ( - newChainID string - upgradedClient exported.ClientState - upgradedConsState exported.ConsensusState - lastHeight clienttypes.Height - path *ibctesting.Path - proofUpgradedClient, proofUpgradedConsState []byte - upgradedClientBz, upgradedConsStateBz []byte - err error - ) - - testCases := []struct { - name string - setup func() - expPass bool - }{ - { - name: "successful upgrade", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) + suite.Require().NotNil(msg.VerifyClientMessage) + suite.Require().NotNil(msg.VerifyClientMessage.ClientMessage) + suite.Require().Nil(msg.Status) + suite.Require().Nil(msg.CheckForMisbehaviour) + suite.Require().Nil(msg.TimestampAtHeight) + suite.Require().Nil(msg.ExportMetadata) - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test + suite.Require().Equal(env.Contract.Address, defaultWasmClientID) - // commit upgrade store changes and update clients + resp, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + return resp, wasmtesting.DefaultGasUsed, nil + }) }, - expPass: true, + nil, }, { - name: "successful upgrade to same revision", - setup: func() { - var tmUpgradedClient exported.ClientState - tmUpgradedClient = ibctm.NewClientState(suite.chainB.ChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), upgradedClient.GetLatestHeight().GetRevisionHeight()+10), commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClient = tmUpgradedClient.ZeroCustomFields() - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) - - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) - upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) - suite.Require().NoError(err) - - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + "failure: clientStore prefix does not include clientID", + func() { + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), ibctesting.InvalidID) }, - expPass: true, + types.ErrWasmContractCallFailed, }, - { - name: "unsuccessful upgrade: upgrade height revision height is more than the current client revision height", - setup: func() { - // upgrade Height is 10 blocks from now - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+10)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) + "failure: invalid client message", + func() { + clientMsg = &ibctm.Header{} - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) + suite.mockVM.RegisterQueryCallback(types.VerifyClientMessageMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + resp, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + return resp, wasmtesting.DefaultGasUsed, nil + }) }, - expPass: false, + ibcerrors.ErrInvalidType, }, { - name: "unsuccessful upgrade: committed client does not have zeroed custom fields", - setup: func() { - // non-zeroed upgrade client - var tmUpgradedClient exported.ClientState //nolint:gosimple // ignore error for test - tmUpgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) - - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) - upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) - suite.Require().NoError(err) - - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + "failure: error return from contract vm", + func() { + suite.mockVM.RegisterQueryCallback(types.VerifyClientMessageMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, queryMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) }, - expPass: false, + types.ErrWasmContractCallFailed, }, - { - name: "unsuccessful upgrade: chain-specified parameters do not match committed client", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - // change upgradedClient client-specified parameters - var tmUpgradedClient exported.ClientState - tmUpgradedClient = ibctm.NewClientState("wrongchainID", ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClient = tmUpgradedClient.ZeroCustomFields() - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) - - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) - - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) + } - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: client-specified parameters do not match previous client", - setup: func() { - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - // change upgradedClient client-specified parameters - var tmUpgradedClient exported.ClientState - tmUpgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, lastHeight, commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClient = tmUpgradedClient.ZeroCustomFields() - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) + for _, tc := range testCases { + suite.Run(tc.name, func() { + // reset suite to create fresh application state + suite.SetupWasmWithMockVM() - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() + suite.Require().NoError(err) - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) + clientStore = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), endpoint.ClientID) + clientState := endpoint.GetClientState() - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) + clientMsg = &types.ClientState{ + Data: clienttypes.MustMarshalClientMessage(suite.chainA.App.AppCodec(), wasmtesting.MockTendermintClientHeader), + } - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: relayer-submitted consensus state does not match counterparty-committed consensus state", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - var tmUpgradedConsState exported.ConsensusState //nolint:gosimple // ignore error for test - tmUpgradedConsState = &ibctm.ConsensusState{ - Timestamp: time.Now(), - Root: commitmenttypes.NewMerkleRoot([]byte("malicious root hash")), - NextValidatorsHash: []byte("01234567890123456789012345678901"), - } - tmUpgradedConsStateBz, err := clienttypes.MarshalConsensusState(suite.chainA.App.AppCodec(), tmUpgradedConsState) - suite.Require().NoError(err) + tc.malleate() - upgradedConsState = &wasmtypes.ConsensusState{ - Data: tmUpgradedConsStateBz, - Timestamp: tmUpgradedConsState.GetTimestamp(), - } + err = clientState.VerifyClientMessage(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), clientStore, clientMsg) - // commit upgrade store changes and update clients - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() + expPass := tc.expErr == nil + if expPass { suite.Require().NoError(err) + } else { + suite.Require().ErrorIs(err, tc.expErr) + } + }) + } +} - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: client proof unmarshal failed", - setup: func() { - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - - proofUpgradedClient = []byte("proof") - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: consensus state proof unmarshal failed", - setup: func() { - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - - proofUpgradedConsState = []byte("proof") - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: client proof verification failed", - setup: func() { - // do not store upgraded client - - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for test - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: consensus state proof verification failed", - setup: func() { - // do not store upgraded client - - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) +func (suite *TypesTestSuite) TestVerifyUpgradeAndUpdateState() { + var ( + upgradedClient exported.ClientState + upgradedConsState exported.ConsensusState + proofUpgradedClient []byte + proofUpgradedConsState []byte + ) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, + testCases := []struct { + name string + malleate func() + expErr error + }{ { - name: "unsuccessful upgrade: upgrade path is empty", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - - // SetClientState with empty upgrade path - wasmClient, _ := cs.(*wasmtypes.ClientState) - var wasmClientData exported.ClientState - err = suite.chainA.Codec.UnmarshalInterface(wasmClient.Data, &wasmClientData) - suite.Require().NoError(err) - tmClient := wasmClientData.(*ibctm.ClientState) - tmClient.UpgradePath = []string{""} - - tmClientBz, err := suite.chainA.Codec.MarshalInterface(tmClient) - suite.Require().NoError(err) - wasmClient.Data = tmClientBz - - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID, wasmClient) + "success: successful upgrade", + func() { + suite.mockVM.RegisterSudoCallback(types.VerifyUpgradeAndUpdateStateMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + expectedUpgradedClient, ok := upgradedClient.(*types.ClientState) + suite.Require().True(ok) + expectedUpgradedConsensus, ok := upgradedConsState.(*types.ConsensusState) + suite.Require().True(ok) + + // verify payload values + suite.Require().Equal(expectedUpgradedClient.Data, payload.VerifyUpgradeAndUpdateState.UpgradeClientState) + suite.Require().Equal(expectedUpgradedConsensus.Data, payload.VerifyUpgradeAndUpdateState.UpgradeConsensusState) + suite.Require().Equal(proofUpgradedClient, payload.VerifyUpgradeAndUpdateState.ProofUpgradeClient) + suite.Require().Equal(proofUpgradedConsState, payload.VerifyUpgradeAndUpdateState.ProofUpgradeConsensusState) + + // verify other Sudo fields are nil + suite.Require().Nil(payload.UpdateState) + suite.Require().Nil(payload.UpdateStateOnMisbehaviour) + suite.Require().Nil(payload.VerifyMembership) + suite.Require().Nil(payload.VerifyNonMembership) + + data, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + // set new client state and consensus state + wrappedUpgradedClient := clienttypes.MustUnmarshalClientState(suite.chainA.App.AppCodec(), expectedUpgradedClient.Data) + store.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)) + store.Set(host.ConsensusStateKey(wrappedUpgradedClient.GetLatestHeight()), clienttypes.MustMarshalConsensusState(suite.chainA.App.AppCodec(), upgradedConsState)) + + return &wasmvmtypes.Response{Data: data}, wasmtesting.DefaultGasUsed, nil + }) }, - expPass: false, + nil, }, { - name: "unsuccessful upgrade: upgraded height is not greater than current height", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + "failure: upgraded client state is not wasm client state", + func() { + // set upgraded client state to solomachine client state + upgradedClient = &solomachine.ClientState{} }, - expPass: false, + clienttypes.ErrInvalidClient, }, { - name: "unsuccessful upgrade: consensus state for upgrade height cannot be found", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+100)) - - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + "failure: upgraded consensus state is not wasm consensus state", + func() { + // set upgraded consensus state to solomachine consensus state + upgradedConsState = &solomachine.ConsensusState{} }, - expPass: false, + clienttypes.ErrInvalidConsensus, }, { - name: "unsuccessful upgrade: client is expired", - setup: func() { - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test - - // commit upgrade store changes and update clients - - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - // expire chainB's client - suite.chainA.ExpireClient(ubdPeriod) - - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + "failure: contract returns error", + func() { + suite.mockVM.RegisterSudoCallback(types.VerifyUpgradeAndUpdateStateMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) { + return nil, 0, wasmtesting.ErrMockContract + }) }, - expPass: false, + types.ErrWasmContractCallFailed, }, - { - name: "unsuccessful upgrade: updated unbonding period is equal to trusting period", - setup: func() { - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) + } - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for test + for _, tc := range testCases { + suite.Run(tc.name, func() { + // reset suite + suite.SetupWasmWithMockVM() - // commit upgrade store changes and update clients + endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + err := endpoint.CreateClient() + suite.Require().NoError(err) - suite.coordinator.CommitBlock(suite.chainB) - err := path.EndpointA.UpdateClient() - suite.Require().NoError(err) + clientState := endpoint.GetClientState().(*types.ClientState) - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) + newLatestHeight := clienttypes.NewHeight(2, 10) + wrappedUpgradedClient := wasmtesting.CreateMockTendermintClientState(newLatestHeight) + wrappedUpgradedClientBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), wrappedUpgradedClient) + upgradedClient = types.NewClientState(wrappedUpgradedClientBz, clientState.CodeId, newLatestHeight) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - { - name: "unsuccessful upgrade: final client is not valid", - setup: func() { - // new client has smaller unbonding period such that old trusting period is no longer valid - var tmUpgradedClient exported.ClientState - tmUpgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClient = tmUpgradedClient.ZeroCustomFields() - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) + wrappedUpgradedConsensus := ibctm.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("new-hash")), []byte("new-nextValsHash")) + wrappedUpgradedConsensusBz := clienttypes.MustMarshalConsensusState(suite.chainA.App.AppCodec(), wrappedUpgradedConsensus) + upgradedConsState = types.NewConsensusState(wrappedUpgradedConsensusBz) - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) - upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) - suite.Require().NoError(err) + tc.malleate() - // upgrade Height is at next block - lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1)) + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), defaultWasmClientID) - // zero custom fields and store in upgrade store - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) //nolint:errcheck // ignore error for testing - suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) //nolint:errcheck // ignore error for testing + proofUpgradedClient = wasmtesting.MockUpgradedClientStateProofBz + proofUpgradedConsState = wasmtesting.MockUpgradedConsensusStateProofBz - // commit upgrade store changes and update clients + err = clientState.VerifyUpgradeAndUpdateState( + suite.chainA.GetContext(), + suite.chainA.Codec, + clientStore, + upgradedClient, + upgradedConsState, + proofUpgradedClient, + proofUpgradedConsState, + ) - suite.coordinator.CommitBlock(suite.chainB) - err = path.EndpointA.UpdateClient() + expPass := tc.expErr == nil + if expPass { suite.Require().NoError(err) - cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - }, - expPass: false, - }, - } - - for _, tc := range testCases { - tc := tc - - // reset suite - suite.SetupWasmTendermint() - path = ibctesting.NewPath(suite.chainA, suite.chainB) - - suite.coordinator.SetupClients(path) - - clientState := path.EndpointA.GetClientState().(*wasmtypes.ClientState) - var clientStateData exported.ClientState - err = suite.chainA.Codec.UnmarshalInterface(clientState.Data, &clientStateData) - suite.Require().NoError(err) - tmClientState := clientStateData.(*ibctm.ClientState) - - revisionNumber := clienttypes.ParseChainID(tmClientState.ChainId) - - newChainID, err = clienttypes.SetRevisionNumber(tmClientState.ChainId, revisionNumber+1) - suite.Require().NoError(err) - - var tmUpgradedClient exported.ClientState - tmUpgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(revisionNumber+1, clientState.GetLatestHeight().GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath) - tmUpgradedClient = tmUpgradedClient.ZeroCustomFields() - tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) - suite.Require().NoError(err) - - upgradedClient = wasmtypes.NewClientState(tmUpgradedClientBz, clientState.CodeId, clienttypes.NewHeight(revisionNumber+1, clientState.GetLatestHeight().GetRevisionHeight()+1)) - upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) - suite.Require().NoError(err) - - var tmUpgradedConsState exported.ConsensusState //nolint:gosimple // ignore error for test - tmUpgradedConsState = &ibctm.ConsensusState{ - Timestamp: time.Now(), - Root: commitmenttypes.NewMerkleRoot([]byte("root hash")), - NextValidatorsHash: []byte("01234567890123456789012345678901"), - } - tmUpgradedConsStateBz, err := clienttypes.MarshalConsensusState(suite.chainA.App.AppCodec(), tmUpgradedConsState) - suite.Require().NoError(err) - - upgradedConsState = &wasmtypes.ConsensusState{ - Data: tmUpgradedConsStateBz, - Timestamp: tmUpgradedConsState.GetTimestamp(), - } - upgradedConsStateBz, err = clienttypes.MarshalConsensusState(suite.chainA.App.AppCodec(), upgradedConsState) - suite.Require().NoError(err) - - tc.setup() - - cs := suite.chainA.GetClientState(path.EndpointA.ClientID) - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID) - - err = cs.VerifyUpgradeAndUpdateState( - suite.chainA.GetContext(), - suite.chainA.Codec, - clientStore, - upgradedClient, - upgradedConsState, - proofUpgradedClient, - proofUpgradedConsState, - ) - - if tc.expPass { - suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name) - - clientState := suite.chainA.GetClientState(path.EndpointA.ClientID) - suite.Require().NotNil(clientState, "verify upgrade failed on valid case: %s", tc.name) - - consensusState, found := suite.chainA.GetConsensusState(path.EndpointA.ClientID, clientState.GetLatestHeight()) - suite.Require().NotNil(consensusState, "verify upgrade failed on valid case: %s", tc.name) - suite.Require().True(found) - } else { - suite.Require().Error(err, "verify upgrade passed on invalid case: %s", tc.name) - } + // verify new client state and consensus state + clientStateBz := clientStore.Get(host.ClientStateKey()) + suite.Require().NotEmpty(clientStateBz) + suite.Require().Equal(upgradedClient, clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz)) + + consStateBz := clientStore.Get(host.ConsensusStateKey(upgradedClient.GetLatestHeight())) + suite.Require().NotEmpty(consStateBz) + suite.Require().Equal(upgradedConsState, clienttypes.MustUnmarshalConsensusState(suite.chainA.Codec, consStateBz)) + } else { + suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) + } + }) } } diff --git a/modules/light-clients/08-wasm/types/validation.go b/modules/light-clients/08-wasm/types/validation.go index 96ff8c60366..107040da7d2 100644 --- a/modules/light-clients/08-wasm/types/validation.go +++ b/modules/light-clients/08-wasm/types/validation.go @@ -1,14 +1,29 @@ package types +import errorsmod "cosmossdk.io/errors" + const MaxWasmSize = 3 * 1024 * 1024 -func ValidateWasmCode(code []byte) (bool, error) { +func ValidateWasmCode(code []byte) error { if len(code) == 0 { - return false, ErrWasmEmptyCode + return ErrWasmEmptyCode } if len(code) > MaxWasmSize { - return false, ErrWasmCodeTooLarge + return ErrWasmCodeTooLarge + } + + return nil +} + +// ValidateWasmChecksum validates that the checksum is of the correct length +func ValidateWasmChecksum(checksum Checksum) error { + lenChecksum := len(checksum) + if lenChecksum == 0 { + return errorsmod.Wrap(ErrInvalidChecksum, "checksum cannot be empty") + } + if lenChecksum != 32 { // sha256 output is 256 bits long + return errorsmod.Wrapf(ErrInvalidChecksum, "expected length of 32 bytes, got %d", lenChecksum) } - return true, nil + return nil } diff --git a/modules/light-clients/08-wasm/types/vm.go b/modules/light-clients/08-wasm/types/vm.go index c59ff1fcc75..856f63ccc45 100644 --- a/modules/light-clients/08-wasm/types/vm.go +++ b/modules/light-clients/08-wasm/types/vm.go @@ -1,16 +1,25 @@ package types import ( + errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" + "encoding/json" + "errors" cosmwasm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var ( - WasmVM *cosmwasm.VM + WasmVM ibcwasm.WasmEngine VMGasRegister = NewDefaultWasmGasRegister() + wasmvmAPI = cosmwasm.GoAPI{ + HumanAddress: humanAddress, + CanonicalAddress: canonicalAddress, + } ) type queryResponse struct { @@ -43,7 +52,7 @@ func (r contractResult) Error() string { } // Calls vm.Init with appropriate arguments -func initContract(codeID []byte, ctx sdk.Context, store sdk.KVStore) (*wasmvmtypes.Response, error) { +func initContract(codeID []byte, ctx sdk.Context, store storetypes.KVStore, payload InstantiateMessage) (*wasmvmtypes.Response, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -68,20 +77,24 @@ func initContract(codeID []byte, ctx sdk.Context, store sdk.KVStore) (*wasmvmtyp }, } + encodedData, err := json.Marshal(payload) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to marshal payload for wasm contract instantiation") + } + msgInfo := wasmvmtypes.MessageInfo{ Sender: "", Funds: nil, } - initMsg := []byte("{}") - ctx.GasMeter().ConsumeGas(VMGasRegister.NewContractInstanceCosts(len(initMsg)), "Loading CosmWasm module: instantiate") - response, gasUsed, err := WasmVM.Instantiate(codeID, env, msgInfo, initMsg, NewStoreAdapter(store), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) + ctx.GasMeter().ConsumeGas(VMGasRegister.NewContractInstanceCosts(len(encodedData)), "Loading CosmWasm module: instantiate") + response, gasUsed, err := WasmVM.Instantiate(codeID, env, msgInfo, encodedData, NewStoreAdapter(store), wasmvmAPI, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return response, err } // Calls vm.Execute with internally constructed Gas meter and environment -func callContract(codeID []byte, ctx sdk.Context, store sdk.KVStore, msg []byte) (*wasmvmtypes.Response, error) { +func callContract(codeID []byte, ctx sdk.Context, store storetypes.KVStore, msg []byte) (*wasmvmtypes.Response, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -106,18 +119,15 @@ func callContract(codeID []byte, ctx sdk.Context, store sdk.KVStore, msg []byte) }, } - msgInfo := wasmvmtypes.MessageInfo{ - Sender: "", - Funds: nil, - } ctx.GasMeter().ConsumeGas(VMGasRegister.InstantiateContractCosts(len(msg)), "Loading CosmWasm module: execute") - resp, gasUsed, err := WasmVM.Execute(codeID, env, msgInfo, msg, NewStoreAdapter(store), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) + resp, gasUsed, err := WasmVM.Sudo(codeID, env, msg, NewStoreAdapter(store), wasmvmAPI, + nil, multipliedGasMeter, gasLimit, costJSONDeserialization) VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return resp, err } // Call vm.Query -func queryContractWithStore(codeID cosmwasm.Checksum, ctx sdk.Context, store sdk.KVStore, msg []byte) ([]byte, error) { +func queryContractWithStore(codeID cosmwasm.Checksum, ctx sdk.Context, store storetypes.KVStore, msg []byte) ([]byte, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -146,3 +156,11 @@ func queryContractWithStore(codeID cosmwasm.Checksum, ctx sdk.Context, store sdk VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return resp, err } + +func humanAddress(canon []byte) (string, uint64, error) { + return "", 0, errors.New("humanAddress not implemented") +} + +func canonicalAddress(human string) ([]byte, uint64, error) { + return nil, 0, errors.New("canonicalAddress not implemented") +} diff --git a/modules/light-clients/08-wasm/types/wasm.pb.go b/modules/light-clients/08-wasm/types/wasm.pb.go index 5bd4a99e2b7..d04e07ad018 100644 --- a/modules/light-clients/08-wasm/types/wasm.pb.go +++ b/modules/light-clients/08-wasm/types/wasm.pb.go @@ -8,7 +8,7 @@ import ( types1 "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + types "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" io "io" math "math" math_bits "math/bits"